Pixel Operations

Pixel Operations — Operations on pixels

Functions

Description

Pixels are 4-element arrays of type uint8_t. The elements, in memory order, represent the alpha, red, green, and blue components respectively. The color components are premultiplied with the alpha component. Liboil functions represent pixels as the type uint32_t.

The compositing operators IN, OVER, and ADD are defined the same as cairo.

Functions

oil_argb_paint_u8 ()

void
oil_argb_paint_u8 (uint8_t *i_4xn,
                   const uint8_t *s1_4,
                   const uint8_t *s2_n,
                   int n);

Composites source color onto in-place array according to the alpha array.

Deprecated.

Parameters

i_4xn

array

 

s1_4

source color

 

s2_n

source alpha array

 

n

number of elements

 

oil_ayuv2argb_u8 ()

void
oil_ayuv2argb_u8 (uint8_t *d_4xn,
                  const uint8_t *s_4xn,
                  int n);

Converts AYUV pixels to ARGB pixels. AYUV pixels are in the JPEG colorspace. Note that this function doesn't follow normal liboil pixel conventions.

(This function should be replaced by one that handles other conversion factors.)


oil_ayuv2uyvy ()

void
oil_ayuv2uyvy (uint32_t *d_n,
               const uint32_t *s_n,
               int n);

Converts pixels in AYUV format to UYVY. Note that only approximately half of the destination array is written. Alpha values are ignored.

Parameters

s_n

n:

 

oil_ayuv2yuyv ()

void
oil_ayuv2yuyv (uint32_t *d_n,
               const uint32_t *s_n,
               int n);

Converts pixels in AYUV format to YUYV. Note that only approximately half of the destination array is written. Alpha values are ignored.

Parameters

s_n

n:

 

oil_ayuv2yvyu ()

void
oil_ayuv2yvyu (uint32_t *d_n,
               const uint32_t *s_n,
               int n);

Converts pixels in AYUV format to YVYU. Note that only approximately half of the destination array is written. Alpha values are ignored.

Parameters

s_n

n:

 

oil_composite_add_argb ()

void
oil_composite_add_argb (uint32_t *i_n,
                        const uint32_t *s1_n,
                        int n);

Performs the compositing operation DEST = SRC ADD DEST.

Parameters

i_n

DEST

 

s1_n

SRC

 

n

number of elements

 

oil_composite_add_argb_const_src ()

void
oil_composite_add_argb_const_src (uint32_t *i_n,
                                  const uint32_t *s1_1,
                                  int n);

Performs the compositing operation DEST = SRC ADD DEST, for a constant SRC.

Parameters

i_n

DEST

 

s1_1

SRC

 

n

number of elements

 

oil_composite_in_argb ()

void
oil_composite_in_argb (uint32_t *d_n,
                       const uint32_t *s1_n,
                       const uint8_t *s2_n,
                       int n);

Performs the compositing operation DEST = SRC IN MASK.

Parameters

d_n

DEST

 

s1_n

SRC

 

s2_n

MASK

 

n

number of elements

 

oil_composite_in_argb_const_mask ()

void
oil_composite_in_argb_const_mask (uint32_t *d_n,
                                  const uint32_t *s1_n,
                                  const uint8_t *s2_1,
                                  int n);

Performs the compositing operation DEST = SRC IN MASK, for a constant MASK.

Parameters

d_n

DEST

 

s1_n

SRC

 

s2_1

MASK

 

n

number of elements

 

oil_composite_in_argb_const_src ()

void
oil_composite_in_argb_const_src (uint32_t *d_n,
                                 const uint32_t *s1_1,
                                 const uint8_t *s2_n,
                                 int n);

Performs the compositing operation DEST = SRC IN MASK, for a constant SRC.

Parameters

d_n

DEST

 

s1_1

SRC

 

s2_n

MASK

 

n

number of elements

 

oil_composite_in_over_argb ()

void
oil_composite_in_over_argb (uint32_t *i_n,
                            const uint32_t *s1_n,
                            const uint8_t *s2_n,
                            int n);

Performs the compositing operation DEST = (SRC IN MASK) OVER DEST.

Parameters

i_n

DEST

 

s1_n

SRC

 

s2_n

MASK

 

n

number of elements

 

oil_composite_in_over_argb_const_mask ()

void
oil_composite_in_over_argb_const_mask (uint32_t *i_n,
                                       const uint32_t *s1_n,
                                       const uint8_t *s2_1,
                                       int n);

Performs the compositing operation DEST = (SRC IN MASK) OVER DEST, for a constant MASK.

Parameters

i_n

DEST

 

s1_n

SRC

 

s2_1

MASK

 

n

number of elements

 

oil_composite_in_over_argb_const_src ()

void
oil_composite_in_over_argb_const_src (uint32_t *i_n,
                                      const uint32_t *s1_1,
                                      const uint8_t *s2_n,
                                      int n);

Performs the compositing operation DEST = (SRC IN MASK) OVER DEST, for a constant SRC.

Parameters

i_n

DEST

 

s1_1

SRC

 

s2_n

MASK

 

n

number of elements

 

oil_composite_over_argb ()

void
oil_composite_over_argb (uint32_t *i_n,
                         const uint32_t *s1_n,
                         int n);

Performs the compositing operation DEST = SRC OVER DEST.

Parameters

i_n

DEST

 

s1_n

SRC

 

n

number of elements

 

oil_composite_over_argb_const_src ()

void
oil_composite_over_argb_const_src (uint32_t *i_n,
                                   const uint32_t *s1_1,
                                   int n);

Performs the compositing operation DEST = SRC OVER DEST, for a constant SRC.

Parameters

i_n

DEST

 

s1_1

SRC

 

n

number of elements

 

oil_merge_linear_argb ()

void
oil_merge_linear_argb (uint32_t *d_n,
                       const uint32_t *s_n,
                       const uint32_t *s2_n,
                       const uint32_t *s3_1,
                       int n);

Linearly interpolate the s_n and s2_n arrays using the scale factor in s3_1 . The value s3_1 must be in the range [0, 256] A value of 0 indicates weights of 1.0 and 0.0 for the s_n and s2_n arrays respectively. A value of 256 indicates weights of 0.0 and 1.0 respectively.

This function is not intended for alpha blending; use one of the compositing functions instead.


oil_resample_linear_argb ()

void
oil_resample_linear_argb (uint32_t *d_n,
                          const uint32_t *s_2xn,
                          int n,
                          uint32_t *i_2);

Linearly resamples a row of pixels. FIXME.


oil_resample_linear_u8 ()

void
oil_resample_linear_u8 (uint8_t *d_n,
                        const uint8_t *s_2xn,
                        int n,
                        uint32_t *i_2);

Linearly resamples a row of pixels. FIXME.


oil_rgb2bgr ()

void
oil_rgb2bgr (uint8_t *d_3xn,
             const uint8_t *s_3xn,
             int n);

Converts arrays of 24-bit RGB pixels from RGBRGBRGB ordering to BGRBGRBGR ordering (and vice-versa).


oil_rgb2rgba ()

void
oil_rgb2rgba (uint8_t *d_4xn,
              const uint8_t *s_3xn,
              int n);

Converts arrays of 24-bit RGB pixels in RGBRGBRGB memory order to 32-bit RGBA pixels in RGBARGBA order.


oil_yuv2rgbx_sub2_u8 ()

void
oil_yuv2rgbx_sub2_u8 (uint8_t *d_4xn,
                      const uint8_t *src1,
                      const uint8_t *src2,
                      const uint8_t *src3,
                      int n);

Converts YUV pixels to RGB pixels. Each YUV component is in a separate source array, and are combined and converted to RGB. The U and V arrays are subsampled by a factor of 2, so only half of each array is used.

This function should be replaced by one that makes sense.

Parameters

src1

Y component

 

src2

U component

 

src3

V component

 

oil_yuv2rgbx_sub4_u8 ()

void
oil_yuv2rgbx_sub4_u8 (uint8_t *d_4xn,
                      const uint8_t *src1,
                      const uint8_t *src2,
                      const uint8_t *src3,
                      int n);

Converts YUV pixels to RGB pixels. Each YUV component is in a separate source array, and are combined and converted to RGB. The U and V arrays are subsampled by a factor of 4, so only a quarter of each array is used.

This function should be replaced by one that makes sense.

Parameters

src1

Y component

 

src2

U component

 

src3

V component

 

oil_yuv2rgbx_u8 ()

void
oil_yuv2rgbx_u8 (uint8_t *d_4xn,
                 const uint8_t *src1,
                 const uint8_t *src2,
                 const uint8_t *src3,
                 int n);

Converts YUV pixels to RGB pixels. Each YUV component is in a separate source array, and are combined and converted to RGB.

This function should be replaced by one that makes sense.

Parameters

src1

Y component

 

src2

U component

 

src3

V component

 

oil_uyvy2ayuv ()

void
oil_uyvy2ayuv (uint32_t *d_n,
               const uint32_t *s_n,
               int n);

Converts pixels in UYVY format to AYUV. Note that only approximately half of the source array is used. Alpha values are set to 255.

Parameters

s_n

n:

 

oil_yuyv2ayuv ()

void
oil_yuyv2ayuv (uint32_t *d_n,
               const uint32_t *s_n,
               int n);

Converts pixels in YUYV format to AYUV. Note that only approximately half of the source array is used. Alpha values are set to 255.

Parameters

s_n

n:

 

oil_yvyu2ayuv ()

void
oil_yvyu2ayuv (uint32_t *d_n,
               const uint32_t *s_n,
               int n);

Converts pixels in YVYU format to AYUV. Note that only approximately half of the source array is used. Alpha values are set to 255.

Parameters

s_n

n:

 

Types and Values