Function

CGImageCreateCopyWithColorSpace

Creates a copy of a bitmap image, replacing its colorspace.

Declaration

CGImageRef CGImageCreateCopyWithColorSpace(CGImageRef image, CGColorSpaceRef space);

Parameters

image

The graphics image to copy.

colorspace

The destination color space. The number of components in this color space must be the same as the number in the specified image.

Return Value

A new CGImage that is a copy of the image passed as the image parameter but with its color space replaced by that specified by the colorspace parameter. Returns NULL if image is an image mask, or if the number of components of colorspace is not the same as the number of components of the colorspace of image. You are responsible for releasing this object using CGImageRelease.

See Also

Creating Bitmap Images

CGImageCreate

Creates a bitmap image from data supplied by a data provider.

CGImageCreateCopy

Creates a copy of a bitmap image.

CGImageCreateWithJPEGDataProvider

Creates a bitmap image using JPEG-encoded data supplied by a data provider.

CGImageCreateWithPNGDataProvider

Creates a bitmap image using PNG-encoded data supplied by a data provider.

CGImageCreateWithImageInRect

Creates a bitmap image using the data contained within a subregion of an existing bitmap image.

CGImageCreateWithMask

Creates a bitmap image from an existing image and an image mask.

CGImageCreateWithMaskingColors

Creates a bitmap image by masking an existing bitmap image with the provided color values.