Creates an RGB color space based on primitives typically found in Y'CbCr specifications.


func vImageCreateRGBColorSpaceWithPrimariesAndTransferFunction(_ primaries: UnsafePointer<vImageRGBPrimaries>, _ tf: UnsafePointer<vImageTransferFunction>, _ intent: CGColorRenderingIntent, _ flags: vImage_Flags, _ error: UnsafeMutablePointer<vImage_Error>!) -> Unmanaged<CGColorSpace>!



A set of x, y tristimulus values that define the color primaries for the RGB colorspace.


The transfer function to convert from linear RGB (using above primaries) to non-linear RGB.


A rendering intent constant that specifies how to handle colors not located within the gamut of the destination color space.


The options to use when performing the operation. This function only supports kvImagePrintDiagnosticsToConsole, which prints diagnostic information to the console in the event of a failure.


A pointer to a vImage_Error; the pointer is overwritten to indicate the success or failure of the operation.

Return Value

A CGColorSpace with a reference count of one.


You use this function to create a CGColorSpace instance to correspond with a given set of color primaries and a transfer function. The CGColorSpace instance defines an RGB color space. (A Y'CbCr color space is defined as an RGB color space and a conversion matrix from RGB to Y'CbCr.) The color primaries give the extent of a color space in x, y, z space, and the transfer function gives the transformation from linear color to nonlinear color that the pixels reside in.

See Also

Creating Core Graphics Image Formats

struct vImage_CGImageFormat

The description of a Core Graphics image.

struct vImageRGBPrimaries

A structure that represents the chromaticity of primaries defining a color space.

struct vImageWhitePoint

A structure that represents a white point according to the CIE 1931 color space.

struct vImageTransferFunction

A structure that represents a transfer function to convert from linear to nonlinear RGB.