createCGImage(_:from:)
Creates a Core Graphics image from a region of a Core Image image instance.
Declaration
func createCGImage(_ image: CIImage, from fromRect: CGRect) -> CGImage?Parameters
- image:
A Ciimage image instance for which to create a
CGImage. - fromRect:
The
CGRectregion of theimageto use. This region relative to the cartesean coordinate system ofimage. This region will be intersected with integralized and intersected withimage.extent.
Return Value
Returns a new CGImage instance. You are responsible for releasing the returned image when you no longer need it. The returned value will be null if the extent is empty or too big.
Discussion
The color space of the created CGImage will be sRGB unless the receiving CIContext was created with a kCIContextOutputColorSpace option.
Normally the pixel format of the created CGImage will be 8 bits-per-component. It will be 16 bits-per-component float if the above color space is HDR.