Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSColorSpace

Inherits from
Implements
Package
com.apple.cocoa.application
Availability
Available in Mac OS X v10.4 and later.
Companion guide

Overview

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 send the colorUsingColorSpace message to an NSColor object to convert it between two color spaces, either of which may be a custom color space.

Tasks

Constructors

Getting a Named NSColorSpace Object

Accessing Color-space Data and Attributes

Constructors

NSColorSpace

public NSColorSpace()

Discussion

Creates an NSColorSpace object.

Creates an NSColorSpace object initialized with the ICC profile in iccData.

NSColorSpace(NSData iccData)

Discussion

For information on ICC profiles, see the latest ICC specification at the International Color Consortium website (http://www.color.org/icc_specs2.html)

Static Methods

deviceCMYKColorSpace

Returns an NSColorSpace object representing a calibrated or device-dependent CMYK color space.

public static NSColorSpace deviceCMYKColorSpace()

Discussion

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 DeviceCMYKColorSpace.

Availability
See Also

deviceGrayColorSpace

Returns an NSColorSpace object representing a calibrated or device-dependent gray-scale color space.

public static NSColorSpace deviceGrayColorSpace()

Discussion

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 DeviceWhiteColorSpace.

Availability
See Also

deviceRGBColorSpace

Returns an NSColorSpace object representing a calibrated or device-dependent RGB color space.

public static NSColorSpace deviceRGBColorSpace()

Discussion

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 DeviceRGBColorSpace.

Availability
See Also

genericCMYKColorSpace

Returns an NSColorSpace object representing a device-independent CMYK color space.

public static NSColorSpace genericCMYKColorSpace()

Discussion

This color space has cyan, magenta, yellow, black and alpha component.

Availability
See Also

genericGrayColorSpace

Returns an NSColorSpace object representing a device-independent grayscale color space.

public static NSColorSpace genericGrayColorSpace()

Discussion

The color space also includes an alpha component. This object corresponds to the Cocoa color space name CalibratedWhiteColorSpace.

Availability
See Also

genericRGBColorSpace

Returns an NSColorSpace object representing a device-independent RGB grayscale.

public static NSColorSpace genericRGBColorSpace()

Discussion

This color-additive color space has red, green, blue, and alpha components. This object corresponds to the Cocoa color space name CalibratedRGBColorSpace.

Availability
See Also

Instance Methods

colorSpaceModel

Returns the model on which the color space of the receiver is based.

public int colorSpaceModel()

Discussion

See “Constants” for a list of valid NSColorSpaceModel constants.

Availability

ICCProfileData

Returns the ICC profile data from which the receiver was created.

public native NSData ICCProfileData()

Discussion

This method attempts to compute the profile data from a CMProfileRef object and returns null if it is unable to. For information on ICC profiles, see the latest ICC specification at the International Color Consortium website (http://www.color.org/icc_specs2.html).

Availability

localizedName

Returns the localized name of the receiver.

public String localizedName()

Discussion

Returns null if no localized name exists.

Availability

numberOfColorComponents

Returns the number of components (excluding alpha) supported by the receiver.

public int numberOfColorComponents()

Discussion

Returns zero if the receiver is not based on float components.

Availability

Constants

The following constants indentify the abstract model on which an NSColorSpace object is based. This constant is returned from colorSpaceModel and is derived from the profile data encapsulated by the object.

Constant

Description

UnknownColorSpaceModel

This model is not known to NSColorSpace.

GrayColorSpaceModel

The grayscale color-space model. Can refer to both device-dependent and generic color space variants.

RGBColorSpaceModel

The RGB (red green blue) color-space model. Can refer to both device-dependent and generic color space variants.

CMYKColorSpaceModel

The CYMK (cyan, yellow, magenta, black) color-space model. Can refer to both device-dependent and generic color space variants.

LABColorSpaceModel

The L*a*b* device-independent color-space model, which represents colors relative to a reference white point.

DeviceNColorSpaceModel

DeviceN is a color-space model from Adobe Systems, Inc. used in PostScript and PDF color specification.



Next Page > Hide TOC


© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.