Function

CGImageCreateWithMaskingColors

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

Declaration

CGImageRef CGImageCreateWithMaskingColors(CGImageRef image, const CGFloat *components);

Parameters

image

The image to mask. This parameter may not be an image mask, may not already have an image mask or masking color associated with it, and cannot have an alpha component.

components

An array of color components that specify a color or range of colors to mask the image with. The array must contain 2N values { min[1], max[1], ... min[N], max[N] } where N is the number of components in color space of image. Each value in components must be a valid image sample value. If image has integer pixel components, then each value must be in the range [0 .. 2**bitsPerComponent - 1] (where bitsPerComponent is the number of bits/component of image). If image has floating-point pixel components, then each value may be any floating-point number which is a valid color component.

Return Value

An image created by masking image with the colors specified in the components array. You are responsible for releasing this object by calling CGImageRelease.

Discussion

Any image sample with color value {c[1], ... c[N]} where min[i] <= c[i] <= max[i] for 1 <= i <= N is masked out (that is, not painted). This means that anything underneath the unpainted samples, such as the current fill color, shows through.

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.

CGImageCreateCopyWithColorSpace

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

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.