Instance Method

initWithCGColorSpace:

Initializes and returns an NSColorSpace object initialized from a Core Graphics color-space object.

Declaration

- (instancetype)initWithCGColorSpace:(CGColorSpaceRef)cgColorSpace;

Parameters

cgColorSpace

A reference to a Core Graphics color-space object (CGColorSpaceRef).

Return Value

The initialized NSColorSpace object or nil if initialization was not successful, which might happen if the color space represented by the CGColorSpace object is not supported by NSColorSpace.

Discussion

Because NSColorSpace might retain or copy the CGColorSpace object depending on circumstances, you should not assume pointer equality of the provided object with that returned by CGColorSpace. And even if the pointer equality is preserved during runtime, it may not be after the NSColorSpace object is archived and unarchived.

See Also

Initializing a Custom NSColorSpace Object

- initWithColorSyncProfile:

Initializes and returns an NSColorSpace object given a ColorSync profile.

- initWithICCProfileData:

Initializes and returns an NSColorSpace object given an ICC profile.