## liboilfuncs-pixel

liboilfuncs-pixel —

##

# Synopsis

    void        oil_argb_paint_u8               (uint8_t *i_4xn,
                                                 const uint8_t *s1_4,
                                                 const uint8_t *s2_n,
                                                 int n);
    void        oil_ayuv2argb_u8                (uint8_t *d_4xn,
                                                 const uint8_t *s_4xn,
                                                 int n);
    void        oil_ayuv2uyvy                   (uint32_t *d_n,
                                                 const uint32_t *s_n,
                                                 int n);
    void        oil_ayuv2yuyv                   (uint32_t *d_n,
                                                 const uint32_t *s_n,
                                                 int n);
    void        oil_ayuv2yvyu                   (uint32_t *d_n,
                                                 const uint32_t *s_n,
                                                 int n);
    void        oil_composite_add_argb          (uint32_t *i_n,
                                                 const uint32_t *s1_n,
                                                 int n);
    void        oil_composite_add_argb_const_src
                                                (uint32_t *i_n,
                                                 const uint32_t *s1_1,
                                                 int n);
    void        oil_composite_in_argb           (uint32_t *d_n,
                                                 const uint32_t *s1_n,
                                                 const uint8_t *s2_n,
                                                 int n);
    void        oil_composite_in_argb_const_mask
                                                (uint32_t *d_n,
                                                 const uint32_t *s1_n,
                                                 const uint8_t *s2_1,
                                                 int n);
    void        oil_composite_in_argb_const_src (uint32_t *d_n,
                                                 const uint32_t *s1_1,
                                                 const uint8_t *s2_n,
                                                 int n);
    void        oil_composite_in_over_argb      (uint32_t *i_n,
                                                 const uint32_t *s1_n,
                                                 const uint8_t *s2_n,
                                                 int n);
    void        oil_composite_in_over_argb_const_mask
                                                (uint32_t *i_n,
                                                 const uint32_t *s1_n,
                                                 const uint8_t *s2_1,
                                                 int n);
    void        oil_composite_in_over_argb_const_src
                                                (uint32_t *i_n,
                                                 const uint32_t *s1_1,
                                                 const uint8_t *s2_n,
                                                 int n);
    void        oil_composite_over_argb         (uint32_t *i_n,
                                                 const uint32_t *s1_n,
                                                 int n);
    void        oil_composite_over_argb_const_src
                                                (uint32_t *i_n,
                                                 const uint32_t *s1_1,
                                                 int n);
    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);
    void        oil_resample_linear_argb        (uint32_t *d_n,
                                                 const uint32_t *s_2xn,
                                                 int n,
                                                 uint32_t *i_2);
    void        oil_resample_linear_u8          (uint8_t *d_n,
                                                 const uint8_t *s_2xn,
                                                 int n,
                                                 uint32_t *i_2);
    void        oil_rgb2bgr                     (uint8_t *d_3xn,
                                                 const uint8_t *s_3xn,
                                                 int n);
    void        oil_rgb2rgba                    (uint8_t *d_4xn,
                                                 const uint8_t *s_3xn,
                                                 int n);
    void        oil_yuv2rgbx_sub2_u8            (uint8_t *d_4xn,
                                                 const uint8_t *src1,
                                                 const uint8_t *src2,
                                                 const uint8_t *src3,
                                                 int n);
    void        oil_yuv2rgbx_sub4_u8            (uint8_t *d_4xn,
                                                 const uint8_t *src1,
                                                 const uint8_t *src2,
                                                 const uint8_t *src3,
                                                 int n);
    void        oil_yuv2rgbx_u8                 (uint8_t *d_4xn,
                                                 const uint8_t *src1,
                                                 const uint8_t *src2,
                                                 const uint8_t *src3,
                                                 int n);
    void        oil_uyvy2ayuv                   (uint32_t *d_n,
                                                 const uint32_t *s_n,
                                                 int n);
    void        oil_yuyv2ayuv                   (uint32_t *d_n,
                                                 const uint32_t *s_n,
                                                 int n);
    void        oil_yvyu2ayuv                   (uint32_t *d_n,
                                                 const uint32_t *s_n,
                                                 int n);

## Description

## Details

### 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.

`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.)

`d_4xn` : |
`s_4xn` : |
`n` : |

### 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.

`d_n` : |
`s_n` : | 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.

`d_n` : |
`s_n` : | 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.

`d_n` : |
`s_n` : | 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.

`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.

`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.

`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.

`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.

`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.

`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.

`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.

`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.

`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.

`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.

`d_n` : |
`s_n` : |
`s2_n` : |
`s3_1` : |
`n` : |

### 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.

`d_n` : |
`s_2xn` : |
`n` : |
`i_2` : |

### 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.

`d_n` : |
`s_2xn` : |
`n` : |
`i_2` : |

### 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).

`d_3xn` : |
`s_3xn` : |
`n` : |

### 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.

`d_4xn` : |
`s_3xn` : |
`n` : |

### 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.

`d_4xn` : |
`src1` : | Y component
`src2` : | U component
`src3` : | V component
`n` : |

### 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.

`d_4xn` : |
`src1` : | Y component
`src2` : | U component
`src3` : | V component
`n` : |

### 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.

`d_4xn` : |
`src1` : | Y component
`src2` : | U component
`src3` : | V component
`n` : |

### 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.

`d_n` : |
`s_n` : | 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.

`d_n` : |
`s_n` : | 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.

`d_n` : |
`s_n` : | n:
`n` : |