Function

vImageConvert_ARGB8888toPlanarF(_:_:_:_:_:_:_:_:)

Separates an ARGB8888 image into four PlanarF images.

Declaration

func vImageConvert_ARGB8888toPlanarF(_ src: UnsafePointer<vImage_Buffer>!, _ alpha: UnsafePointer<vImage_Buffer>!, _ red: UnsafePointer<vImage_Buffer>!, _ green: UnsafePointer<vImage_Buffer>!, _ blue: UnsafePointer<vImage_Buffer>!, _ maxFloat: UnsafePointer<Float>!, _ minFloat: UnsafePointer<Float>!, _ flags: vImage_Flags) -> vImage_Error

Parameters

src

A pointer to a vImage buffer structure that contains the source image whose data you want to separate.

alpha

A pointer to a vImage buffer data structure that represents the alpha channel destination. 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. When you no longer need the data buffer, you must deallocate the memory.

red

A pointer to a vImage buffer data structure that represents the red channel destination. 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. When you no longer need the data buffer, you must deallocate the memory.

green

A pointer to a vImage buffer data structure that represents the green channel destination. 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. When you no longer need the data buffer, you must deallocate the memory.

blue

A pointer to a vImage buffer data structure that represents the blue channel destination. 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. When you no longer need the data buffer, you must deallocate the memory.

maxFloat

The maxFloat value in the per-pixel formula.

minFloat

The minFloat value in the per-pixel formula.

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

For each pixel in src, do the following:

 float  alpha = (maxFloat[0] - minFloat[0]) * (float) src[0] / 255.0  + minFloat[0];
 float    red = (maxFloat[1] - minFloat[1]) * (float) src[1] / 255.0  + minFloat[1];
 float  green = (maxFloat[2] - minFloat[2]) * (float) src[2] / 255.0  + minFloat[2];
 float   blue = (maxFloat[3] - minFloat[3]) * (float) src[3] / 255.0  + minFloat[3];

The source image, and the alpha, red, green, and blue destination buffers, must have the same height and the same width. This function works in place for one destination buffer. The others must be allocated separately.

See Also

Converting from ARGB Formats

func vImageConvert_ARGBFFFFtoRGBFFF(UnsafePointer<vImage_Buffer>!, UnsafePointer<vImage_Buffer>!, vImage_Flags) -> vImage_Error

Converts a four-channel ARGBFFFF image to a three-channel RGBFFF image by removing the alpha channel.

func vImageConvert_ARGB8888toRGB888(UnsafePointer<vImage_Buffer>, UnsafePointer<vImage_Buffer>, vImage_Flags) -> vImage_Error

Converts a four-channel ARGB8888 image to a three-channel RGB888 image by removing the alpha channel..