Function

vImageFlatten_ARGBFFFF

Performs an alpha composite of an ARGBFFFF image over a solid background color.

Declaration

vImage_Error vImageFlatten_ARGBFFFF(const vImage_Buffer *argbSrc, const vImage_Buffer *argbDst, const Pixel_FFFF argbBackgroundColorPtr, bool isImagePremultiplied, vImage_Flags flags);

Parameters

argbSrc

A pointer to a vImage buffer that references floating-point ARGB interleaved source pixels.

argbDst

A pointer to a vImage buffer data structure. You're responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer this structure points to contains the destination image data. When you no longer need the data buffer, you must deallocate the memory.

argbBackgroundColorPtr

A pointer to Pixel_FFFF that references floating-point ARGB premultiplied background color.

isImagePremultiplied

True if the source image is premultiplied; otherwise, false.

flags

The options to use when performing the operation. If you plan to perform your own tiling or use multithreading, pass kvImageDoNotTile.

Return Value

kvImageNoError; otherwise, one of the error codes described in Data Types and Constants.

Discussion

The per-pixel operation is:

 resultAlpha = pixelAlpha + (1 - pixelAlpha) * backgroundAlpha
 if(isImagePremultiplied)
 {
     resultColor = pixelColor + (1 - pixelAlpha) * backgroundColor
 }
 else
 {
     resultColor = pixelColor * pixelAlpha + (1 - pixelAlpha) * backgroundColor
 }

The source and destination buffers must have the same height and width.

See Also

Flattening 32-bit Images

vImageFlatten_ARGBFFFFToRGBFFF

Transforms an ARGBFFFF image to an RGBFFF image against an opaque background of the provided color.

vImageFlatten_BGRAFFFFToRGBFFF

Transforms a BGRAFFFF image to an RGBFFF image against an opaque background of the provided color.

vImageFlatten_RGBAFFFF

Performs an alpha composite of an RGBAFFFF image over a solid background color.

vImageFlatten_RGBAFFFFToRGBFFF

Transforms an RGBAFFFF image to an RGB888 image against an opaque background of the provided color.