CGColorSpace

A profile that specifies how to interpret a color value for display.

Overview

A color space is multi-dimensional, and each dimension represents a specific color component. For example, the colors in an RGB color space have three dimensions or components—red, green, and blue. The intensity of each component is represented by floating point values—their range and meaning depends on the color space in question.

Different types of devices (scanners, monitors, printers) operate within different color spaces (RGB, CMYK, grayscale). Additionally, two devices of the same type (for example, color displays from different manufacturers) may operate within the same kind of color space, yet still produce a different range of colors, or gamut. Color spaces that are correctly specified ensure that an image has a consistent appearance regardless of the output device.

Core Graphics supports several kinds of color spaces:

  • Calibrated color spaces ensure that colors appear the same when displayed on different devices. The visual appearance of the color is preserved, as far as the capabilities of the device allow.

  • Device-dependent color spaces are tied to the system of color representation of a particular device. Device color spaces are not recommended when high-fidelity color preservation is important.

  • Special color spaces—indexed and pattern. An indexed color space contains a color table with up to 256 entries and a base color space to which the color table entries are mapped. Each entry in the color table specifies one color in the base color space. A pattern color space is used when stroking or filling with a pattern.

Topics

Creating Device-Independent Color Spaces

CGColorSpaceCreateCalibratedGray

Creates a calibrated grayscale color space.

CGColorSpaceCreateCalibratedRGB

Creates a calibrated RGB color space.

CGColorSpaceCreateICCBased

Creates a device-independent color space that is defined according to the ICC color profile specification.

CGColorSpaceCreateWithICCProfile

Creates an ICC-based color space using the ICC profile contained in the specified data.

Deprecated
CGColorSpaceCreateLab

Creates a device-independent color space that is relative to human color perception, according to the CIE L*a*b* standard.

Creating Generic or Device-Dependent Color Spaces

CGColorSpaceCreateDeviceCMYK

Creates a device-dependent CMYK color space.

CGColorSpaceCreateDeviceGray

Creates a device-dependent grayscale color space.

CGColorSpaceCreateDeviceRGB

Creates a device-dependent RGB color space.

CGColorSpaceCreateWithPlatformColorSpace

Creates a platform-specific color space.

Creating Special Color Spaces

CGColorSpaceCreateIndexed

Creates an indexed color space, consisting of colors specified by a color lookup table.

CGColorSpaceCreatePattern

Creates a pattern color space.

CGColorSpaceCreateWithName

Creates a specified type of Quartz color space.

Getting Information About Color Spaces

CGColorSpaceCopyICCProfile

Returns a copy of the ICC profile of the provided color space.

Deprecated
CGColorSpaceCopyICCData

Returns a copy of the ICC profile data of the provided color space.

CGColorSpaceSupportsOutput

Returns a Boolean indicating whether the color space can be used as a destination color space.

CGColorSpaceGetNumberOfComponents

Returns the number of color components in a color space.

CGColorSpaceGetTypeID

Returns the Core Foundation type identifier for Quartz color spaces.

CGColorSpaceGetModel

Returns the color space model of the provided color space.

CGColorSpaceIsWideGamutRGB

Returns whether the RGB color space covers a significant portion of the NTSC color gamut.

CGColorSpaceGetBaseColorSpace

Returns the base color space of a pattern or indexed color space.

CGColorSpaceGetColorTableCount

Returns the number of entries in the color table of an indexed color space.

CGColorSpaceGetColorTable

Copies the entries in the color table of an indexed color space.

CGColorSpaceCopyName

Returns the name used to create the specified color space.

Retaining and Releasing Color Spaces

CGColorSpaceRelease

Decrements the retain count of a color space.

CGColorSpaceRetain

Increments the retain count of a color space.

Data Types

CGColorSpaceModel

Models for color spaces.

CGColorRenderingIntent

Handling options for colors that are not located within the destination color space of a graphics context.

CGColorSpaceRef

A profile that specifies how to interpret a color value for display.

Constants

Color Space Names

Convenience constants for commonly used color spaces.

See Also

Opaque Types

CGBitmapContext

A type of CGContextRef that you can use for drawing bits to memory.

CGColor

A set of components that define a color, with a color space specifying how to interpret them.

CGColorConversionInfo

An object that describes how to convert between color spaces for use by other system services.

CGContext

A Quartz 2D drawing destination.

CGDataConsumer

An abstraction for data-writing tasks that eliminates the need to manage a raw memory buffer.

CGDataProvider

An abstraction for data-reading tasks that eliminates the need to manage a raw memory buffer.

CGFont

A set of character glyphs and layout information for drawing text.

CGFunction

A general facility for defining and using callback functions.

CGGLContext

Deprecated. A type of CGContextRef for drawing OpenGL content.

CGGradient

A definition for a smooth transition between colors for drawing radial and axial gradient fills.

CGImage

A bitmap image or image mask.

CGLayer

An offscreen context for reusing content drawn with Core Graphics.

CGPath

Immutable and mutable types for graphics paths: mathematical descriptions of shapes or lines to be drawn in a graphics context.

CGPattern

A 2D pattern to be used for drawing graphics paths.

CGPDFArray

An array structure within a PDF document.

CGPDFContentStream

A representation of one or more content data streams in a PDF page.

CGPDFContext

A type of CGContextRef for drawing PDF content.

CGPDFDictionary

A dictionary structure within a PDF document.

CGPDFDocument

A document that contains PDF (Portable Document Format) drawing information.

CGPDFObject

An object representing content within a PDF document.

CGPDFOperatorTable

A set of callback functions for operators used when scanning content in a PDF document.

CGPDFPage

A page in a PDF document.

CGPDFScanner

A parser object for handling content and operators in a PDF content stream.

CGPDFStream

A stream or sequence of data bytes in a PDF document.

CGPDFString

A text string in a PDF document.

CGPSConverter

An object that converts PostScript data to PDF data.

CGShading

A definition for a smooth transition between colors, controlled by a custom function you provide, for drawing radial and axial gradient fills.