Provide descriptions of Core Graphics image formats for conversions to and from vImage.
Conversions between Core Graphics-backed images and vImage buffers require that you define the Core Graphics image format. The format describes the number of color channels and how they're ordered; the size, in bits, of the color channels; and whether the image data is premultiplied by an alpha value.
You can initialize a Core Graphics image format in either of two ways: by hard-coding values or by deriving the format properties from a
Initialize a Core Graphics Image Format from Hard-Coded Values
The following example shows how you create a Core Graphics image format that describes an image containing four 8-bit channels in the following order: alpha (transparency), red, green, and blue. This combination of properties is referred to as ARGB8888.
v structure created by this code is reusable. You declare it as a variable because it's passed to subsequent vImage functions as an in-out parameter.
nil to the
color parameter creates an sRGB color space—the default in iOS. The
color parameter requires an unmanaged
CGColor instance. If you want to pass an explicit color space, use the
pass function; for example: