Function

CGColorCreate

Creates a color using a list of intensity values (including alpha) and an associated color space.

Declaration

CGColorRef CGColorCreate(CGColorSpaceRef space, const CGFloat *components);

Parameters

colorspace

A color space for the new color. Core Graphics retains this object; upon return, you may safely release it.

components

An array of intensity values describing the color. The array should contain n+1 values that correspond to the n color components in the specified color space, followed by the alpha component. Each component value should be in the range appropriate for the color space. Values outside this range will be clamped to the nearest correct value.

Return Value

A new color. You are responsible for releasing this object using CGColorRelease.

See Also

Creating Color Objects

CGColorCreateCopy

Creates a copy of an existing color.

CGColorCreateGenericGray

Creates a color in the Generic gray color space.

CGColorCreateGenericRGB

Creates a color in the Generic RGB color space.

CGColorCreateSRGB

Creates a color in the sRGB color space.

CGColorCreateGenericCMYK

Creates a color in the Generic CMYK color space.

CGColorCreateCopyWithAlpha

Creates a copy of an existing color, substituting a new alpha value.

CGColorCreateWithPattern

Creates a color using a list of intensity values (including alpha), a pattern color space, and a pattern.

CGColorCreateCopyByMatchingToColorSpace

Creates a new color in a different color space that matches the provided color.