Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.4 and later. |
Companion guide | |
Declared in | NSColorSpace.h |
Related sample code |
The NSColorSpace
class enables the creation of objects representing custom color spaces. You can make custom color spaces from ColorSync profiles or from ICC profiles. NSColorSpace
also has factory methods that return objects representing the system color spaces.
You can use the colorWithColorSpace:components:count:
method of the NSColor
class to create color objects using custom NSColorSpace
objects. You can also send the colorUsingColorSpace:
message to an NSColor
object to convert it between two color spaces, either of which may be a custom color space.
+ deviceRGBColorSpace
+ genericRGBColorSpace
+ deviceCMYKColorSpace
+ genericCMYKColorSpace
+ deviceGrayColorSpace
+ genericGrayColorSpace
+ sRGBColorSpace
+ adobeRGB1998ColorSpace
– CGColorSpace
– colorSpaceModel
– colorSyncProfile
– ICCProfileData
– localizedName
– numberOfColorComponents
Returns an NSColorSpace
object representing an Adobe RGB (1998) color space.
+ (NSColorSpace *)adobeRGB1998ColorSpace
The NSColorSpace object. This color-additive color space has red, green, blue, and alpha components.
The Adobe RGB (1998) color space was designed to encompass most of the colors achievable on CMYK color printers, but by using RGB primary colors on a device such as the computer display. For more information on this color space, go to http://www.adobe.com/digitalimag/adobergb.html.
NSColorSpace.h
Returns an NSColorSpace
object representing a calibrated or device-dependent CMYK color space.
+ (NSColorSpace *)deviceCMYKColorSpace
The NSColorSpace
object. This color space has cyan, magenta, yellow, black, and alpha components. Typical devices that use the color-subtractive CMYK color space are color printers. This object corresponds to the Cocoa color space name NSDeviceCMYKColorSpace
.
NSColorSpace.h
Returns an NSColorSpace
object representing a calibrated or device-dependent gray color space.
+ (NSColorSpace *)deviceGrayColorSpace
The NSColorSpace
object. The color space also includes an alpha component. Typical devices that use this color space are grayscale printers and displays. This object corresponds to the Cocoa color space name NSDeviceWhiteColorSpace
.
NSColorSpace.h
Returns an NSColorSpace
object representing a calibrated or device-dependent RGB color space.
+ (NSColorSpace *)deviceRGBColorSpace
The NSColorSpace
object. This color space has red, green, blue, and alpha components. Typical devices that use the color-additive RGB color space are displays and scanners. This object corresponds to the Cocoa color space name NSDeviceRGBColorSpace
.
NSColorSpace.h
Returns an NSColorSpace
object representing a device-independent CMYK color space.
+ (NSColorSpace *)genericCMYKColorSpace
The NSColorSpace
object. This color space has cyan, magenta, yellow, black and alpha component.
NSColorSpace.h
Returns an NSColorSpace
object representing a device-independent gray color space.
+ (NSColorSpace *)genericGrayColorSpace
The NSColorSpace
object. The color space also includes an alpha component. This object corresponds to the Cocoa color space name NSCalibratedWhiteColorSpace
.
NSColorSpace.h
Returns an NSColorSpace
object representing a device-independent RGB color space.
+ (NSColorSpace *)genericRGBColorSpace
The NSColorSpace
object. This color-additive color space has red, green, blue, and alpha components. This object corresponds to the Cocoa color space name NSCalibratedRGBColorSpace
.
NSColorSpace.h
Returns an NSColorSpace
object representing an sRGB color space.
+ (NSColorSpace *)sRGBColorSpace
The NSColorSpace
object. This color-additive color space has red, green, blue, and alpha components.
The sRGB color space is a standard color space for use on monitors, printers, and the Internet. For further information on sRGB, see http://www.color.org/srgb.html.
NSColorSpace.h
Returns a Core Graphics color-space object that represents a color space equivalent to the receiver’s.
- (CGColorSpaceRef)CGColorSpace
A reference to an Core Graphics color-space object (CGColorSpaceRef
) or NULL
if the type of color space represented by the receiver cannot be represented by a CGColorSpace
object.
NSColorSpace.h
Returns the model on which the color space of the receiver is based.
- (NSColorSpaceModel)colorSpaceModel
A constant specifying the color space model of the receiver. See Color Space Models for a list of valid NSColorSpaceModel constants.
NSColorSpace.h
Returns the ColorSync profile from which the receiver was created.
- (void *)colorSyncProfile
The ColorSync profile on which the receiver is based. You need to cast this value to an object of opaque type CMProfileRef. Returns NULL
if the receiver was created from a ICC-profile data instead. See ColorSync Manager Reference for further information on CMProfileRef.
NSColorSpace.h
Returns the ICC profile data from which the receiver was created.
- (NSData *)ICCProfileData
The ICC profile from which the receiver was created. This method attempts to compute the profile data from a CMProfileRef object and returns nil
if it is unable to.
For information on ICC profiles, see the latest ICC specification at the International Color Consortium website.
NSColorSpace.h
Initializes and returns an NSColorSpace
object initialized from a Core Graphics color-space object.
- (id)initWithCGColorSpace:(CGColorSpaceRef)cgColorSpace
A reference to a Core Graphics color-space object (CGColorSpaceRef
).
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
.
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.
NSColorSpace.h
Initializes and returns an NSColorSpace
object given a ColorSync profile.
- (id)initWithColorSyncProfile:(void *)prof
The ColorSync profile to use when initializing the NSColorSpace
object. This should be an object of opaque type CMProfileRef. See ColorSync Manager Reference for further information on CMProfileRef.
The initialized NSColorSpace
object or nil
if initialization was not successful.
NSColorSpace.h
Initializes and returns an NSColorSpace
object given an ICC profile.
- (id)initWithICCProfileData:(NSData *)iccData
The ICC profile to use when initializing the NSColorSpace
object. For information on ICC profiles, see the latest ICC specification at the International Color Consortium website.
The initialized NSColorSpace
object or nil
if initialization was not successful.
NSColorSpace.h
Returns the localized name of the receiver.
- (NSString *)localizedName
The name of the color space as a localized string or nil
if no localized name exists.
NSColorSpace.h
Returns the number of components supported by the receiver.
- (NSInteger)numberOfColorComponents
The number of components (excluding alpha) the receiver supports or zero if the receiver is not based on float
components.
NSColorSpace.h
The type of the color-space mode constants listed in “Color Space Models.”
typedef NSInteger NSColorSpaceModel;
NSColorSpace.h
Identify the abstract model on which an NSColorSpace
object is based.
typedef enum { NSUnknownColorSpaceModel = -1, NSGrayColorSpaceModel, NSRGBColorSpaceModel, NSCMYKColorSpaceModel, NSLABColorSpaceModel, NSDeviceNColorSpaceModel, NSIndexedColorSpaceModel, NSPatternColorSpaceModel };
NSUnknownColorSpaceModel
This model is not known to NSColorSpace
.
Available in Mac OS X v10.4 and later.
Declared in NSColorSpace.h
.
NSGrayColorSpaceModel
The grayscale color-space model. Can refer to both device-dependent and generic color space variants.
Available in Mac OS X v10.4 and later.
Declared in NSColorSpace.h
.
NSRGBColorSpaceModel
The RGB (red green blue) color-space model. Can refer to both device-dependent and generic color space variants.
Available in Mac OS X v10.4 and later.
Declared in NSColorSpace.h
.
NSCMYKColorSpaceModel
The CYMK (cyan, yellow, magenta, black) color-space model. Can refer to both device-dependent and generic color space variants.
Available in Mac OS X v10.4 and later.
Declared in NSColorSpace.h
.
NSLABColorSpaceModel
The L*a*b* device-independent color-space model, which represents colors relative to a reference white point.
Available in Mac OS X v10.4 and later.
Declared in NSColorSpace.h
.
NSDeviceNColorSpaceModel
DeviceN is a color-space model from Adobe Systems, Inc. used in PostScript and PDF color specification.
Available in Mac OS X v10.4 and later.
Declared in NSColorSpace.h
.
NSIndexedColorSpaceModel
An indexed color space, which identifies specified discrete colors in a color list by index number. An indexed color value (a color specification in indexed color space) consists of an index value that refers to a color in a color list.
Available in Mac OS X version 10.5 and later.
Declared in NSColorSpace.h
.
NSPatternColorSpaceModel
Identifies a pattern color space, which is simply an image that is repeated over and over again in a tiled pattern.
Available in Mac OS X version 10.5 and later.
Declared in NSColorSpace.h
.
These constants are returned from colorSpaceModel
and are derived from the profile data encapsulated by the object.
NSColorSpace.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-28)