Pass image data between Core Graphics and vImage.
A typical Core Graphics-based vImage workflow consists of:
Selecting a source image; for example, a Core Graphics-backed
Initializing a vImage buffer from the image's bitmap data.
Performing an operation on the vImage buffer; for example, scaling or adjusting gamma.
Creating a destination image from the operation result in the same format as the source from the vImage buffer.
vImage provides these functions:
Image Buffer _Init With CGImage(_: _: _: _: _:)
Initializes a vImage buffer with the contents of a Core Graphics image.
Image Create CGImage From Buffer(_: _: _: _: _: _:)
Creates a Core Graphics image from a vImage buffer.
The following code shows a pass through function that accepts a
UIImage, converts its underlying
CGImage image data to a vImage buffer, and returns a
UIImage created from the buffer. In this simple example, you create a description of the Core Graphics image format from the
cg property of the supplied
The description is used by
v to initialize a vImage buffer from the image:
v uses the same description to create an image from the buffer: