CGColor
A set of components that define a color, with a color space specifying how to interpret them.
Declaration
class CGColorOverview
CGColor is the fundamental data type used internally by Core Graphics to represent colors. CGColor objects, and the functions that operate on them, provide a fast and convenient way of managing and setting colors directly, especially colors that are reused (such as black for text).
A color object contains a set of components (such as red, green, and blue) that uniquely define a color, and a color space that specifies how those components should be interpreted.
Color objects provide a fast and convenient way to manage and set colors, especially colors that are used repeatedly. Drawing operations use color objects for setting fill and stroke colors, managing alpha, and setting color with a pattern.
CGColor is derived from CFTypeRef and inherits the properties that all Core Foundation types have in common.
Topics
Creating Colors
copy()copy(alpha:)init(genericCMYKCyan:magenta:yellow:black:alpha:)init(gray:alpha:)init(genericGrayGamma2_2Gray:alpha:)init(red:green:blue:alpha:)init(srgbRed:green:blue:alpha:)init(colorSpace:components:)init(patternSpace:pattern:components:)
Getting System Colors
Examining a Color
Converting Between Color Spaces
Working with Core Foundation Types
Type Properties
Initializers
Instance Properties
See Also
Related Documentation
- Quartz 2D Programming Guide