PATHMac OS 8 Developer Documentation > Mutlimedia and Graphics > ColorSync Manager >

Managing Color With ColorSync


Accessing Named Color Profile Values

This section describes the functions you use to retrieve information from a named color profile.


CMGetNamedColorInfo

Obtains information about a named color space from its profile reference.

pascal CMError CMGetNamedColorInfo (
                     CMProfileRef prof,
                     unsigned long *deviceChannels,
                     OSType *deviceColorSpace,
                     OSType *PCSColorSpace,
                     unsigned long *count,
                     StringPtr prefix,
                     StringPtr suffix);
prof
A profile reference of type CMProfileRef to a named color space profile to obtain named color information from.
deviceChannels
A pointer to a count value. On output, the number of device channels in the color space for the profile. It should agree with the "data color space" field in the profile header. For example, Pantone maps to CMYK, a four-channel color space. A value of 0 indicates no device channels were available.
deviceColorSpace
A pointer to a device color space. On output, a device color space, such as CMYK.
PCSColorSpace
A pointer to a profile connection space color space. On output, an interchange color space, such as Lab.
count
A pointer to a count value. On output, the number of named colors in the profile.
prefix
A pointer to a Pascal string. On output, the string contains a prefix, such as "Pantone", for each color name. The prefix identifies the named color system described by the profile.
suffix
A pointer to a Pascal string. On output, the string contains a suffix for each color name, such as "CVC".
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMGetNamedColorInfo function returns information about the named color space referred to by the passed profile reference.


CMGetNamedColorValue

Obtains device and PCS color values for a specific color name from a named color space profile.

pascal CMError CMGetNamedColorValue (
                     CMProfileRef prof,
                     StringPtr name,
                     CMColor *deviceColor,
                     CMColor *PCSColor);
prof
A profile reference of type CMProfileRef to a named color space profile to obtain color values from.
name
A pointer to a Pascal string. You supply a color name string for the color to get information for.
deviceColor
A pointer to a device color. On output, a device color value in CMColor union format. If the profile does not contain device values, deviceColor is undefined.
PCSColor
A pointer to a profile connection space color. On output, an interchange color value in CMColor union format.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

Based on the passed color name, the CMGetNamedColorValue function does a lookup into the named color tag and, if the name is found in the tag, returns device and color PCS values. Otherwise, CMGetNamedColorValue returns an error code.


CMGetIndNamedColorValue

Obtains device and PCS color values for a specific named color index from a named color space profile.

pascal CMError CMGetIndNamedColorValue (
                     CMProfileRef prof,
                     unsigned long index,
                     CMColor *deviceColor,
                     CMColor *PCSColor);
prof
A profile reference of type CMProfileRef to a named color space profile to obtain color values from.
index
A one-based index value for a named color.
deviceColor
A pointer to a device color. On output, a device color value in CMColor union format. If the profile does not contain device values, deviceColor is undefined.
PCSColor
A pointer to a profile connection space color. On output, an interchange color value in CMColor union format.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

Based on the passed named color index, the CMGetIndNamedColorValue function does a lookup into the named color tag and returns device and PCS values. If the index is greater than the number of named colors, CMGetIndNamedColorValue returns an error code.


CMGetNamedColorIndex

Obtains a named color index for a specific color name from a named color space profile.

pascal CMError CMGetNamedColorIndex (
                     CMProfileRef prof,
                     StringPtr name,
                     unsigned long *index);
prof
A profile reference of type CMProfileRef to a named color space profile to obtain a named color index from.
name
A pointer to a Pascal string. You supply a color name string value for the color to obtain the color index for.
index
A pointer to an index value. On output, an index value for a named color.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

Based on the passed color name, the CMGetNamedColorIndex function does a lookup into the named color tag and, if the name is found in the tag, returns the index. Otherwise, CMGetNamedColorIndex returns an error code.


CMGetNamedColorName

Obtains a named color name for a specific named color index from a named color space profile.

pascal CMError CMGetNamedColorName (
                     CMProfileRef prof,
                     unsigned long index,
                     StringPtr name)
prof
A profile reference of type CMProfileRef to a named color space profile to obtain a named color name from.
index
An index value for a named color to obtain the color name for.
name
A pointer to a Pascal string. On output, a color name string.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

Based on the passed color name index, the CMGetNamedColorName function does a lookup into the named color tag and returns the name. If the index is greater than the number of named colors, CMGetNamedColorName returns an error code.


© 1988-1999 Apple Computer, Inc. — (Last Updated 20 Jan 99)