![]() |
PATH![]() |
![]() ![]() |
The ColorSync Manager defines the following data types for storing standard color values:
CMXYZComponent
CMXYZColor
CMFixedXYZColor
CMLabColor
CMLuvColor
CMYxyColor
CMRGBColor
CMHLSColor
CMHSVColor
CMCMYKColor
CMCMYColor
CMGrayColor
CMNamedColor
CMColor
Three components combine to express a color value defined by the CMXYZColor type definition in the XYZ color space. Each color component is described by a numeric value defined by the CMXYZComponent type definition. A component value of type CMXYZComponent is expressed as a 16-bit value. This is formatted as an unsigned value with 1 bit of integer portion and 15 bits of fractional portion.
typedef unsigned short CMXYZComponent; /* expresses value in XYZ color space; 1 bit
for integer part, 15 bits for fraction */
Three color component values defined by the CMXYZComponent type definition combine to form a color value specified in the XYZ color space. The color value is defined by the CMXYZColor type definition.
Your application uses the CMXYZColor data structure to specify a color value in the CMColor union to use in general purpose color matching, color checking, or color conversion. You also use the CMXYZColor data structure to specify the XYZ white point reference used in the conversion of colors to or from the XYZ color space.
struct CMXYZColor {
CMXYZComponent X; /* X component of color in XYZ color space */
CMXYZComponent Y; /* Y component of color in XYZ color space */
CMXYZComponent Z; /* Z component of color in XYZ color space */
};
ColorSync uses the CMFixedXYZColor data type to specify the profile illuminant in the profile header's white field and to specify other profile element values. Color component values defined by the Fixed type definition can be used to specify a color value in the XYZ color space with greater precision than a color whose components are expressed as CMXYZComponent data types. The Fixed data type is a signed 32-bit value. A color value expressed in the XYZ color space whose color components are of type Fixed is defined by the CMFixedXYZColor type definition.
Your application can convert colors defined in the XYZ color space between
CMXYZColor
data types (in which the color components are expressed as 16-bit unsigned values) and
CMFixedXYZColor
data types (in which the colors are expressed as 32-bit signed values). To convert color values, you use the functions
CMConvertFixedXYZToXYZ
and
CMConvertXYZToFixedXYZ
.
struct CMFixedXYZColor {
Fixed X; /* Fixed X component of color in XYZ color space */
Fixed Y; /* Fixed Y component of color in XYZ color space */
Fixed Z; /* Fixed Z component of color in XYZ color space */
};
A color expressed in the L*a*b* color space is composed of L , a , and b component values. The L color component is expressed as a numeric value within the range of 0 to 65535, which maps to 0 to 100 inclusive. Note that this encoding is slightly different from the 0 to 65280 encoding of the L channel defined in the ICC specification for PCS L*a*b values. The a and b components range from 0 to 65535, which maps to -128 to 127.996 inclusive. The color value is defined by the CMLabColor type definition.
struct CMLabColor {
unsigned short L; /* L component of color in Lab color space */
unsigned short a; /* a component of color in Lab color space */
unsigned short b; /* b component of color in Lab color space */
};
A color value expressed in the L*u*v* color space is composed of L , u , and v component values. Each color component is expressed as a numeric value within the range of 0 to 65535. For the L component, this maps to 0 to 100 inclusive. For the u and v components, this maps to -128 to 127.996 inclusive. The color value is defined by the CMLuvColor type definition.
struct CMLuvColor {
unsigned short L; /* L component of color in Luv color space */
unsigned short u; /* u component of color in Luv color space */
unsigned short v; /* v component of color in Luv color space */
};
A color value expressed in the Yxy color space is composed of capY , x , and y component values. Each color component is expressed as a numeric value within the range of 0 to 65535 which maps to 0 to 1. The color value is defined by the CMYxyColor type definition
struct CMYxyColor {
unsigned short capY; /* 0..65535 maps to 0..1 */
unsigned short x; /* 0..65535 maps to 0..1 */
unsigned short y; /* 0..65535 maps to 0..1 */
};
A color value expressed in the RGB color space is composed of red , green , and blue component values. Each color component is expressed as a numeric value within the range of 0 to 65535.
struct CMRGBColor {
unsigned short red;
unsigned short green;
unsigned short blue;
};
A color value expressed in the HLS color space is composed of hue , lightness , and saturation component values. Each color component is expressed as a numeric value within the range of 0 to 65535 inclusive. The hue value represents a fraction of a circle in which red is positioned at 0.
struct CMHLSColor {
unsigned short hue;
unsigned short lightness;
unsigned short saturation;
};
A color value expressed in the HSV color space is composed of hue , saturation , and value component values. Each color component is expressed as a numeric value within the range of 0 to 65535 inclusive. The hue value represents a fraction of a circle in which red is positioned at 0.
struct CMHSVColor {
unsigned short hue;
unsigned short saturation;
unsigned short value;
};
A color value expressed in the CMYK color space is composed of cyan , magenta , yellow , and black component values. Each color component is expressed as a numeric value within the range of 0 to 65535 inclusive.
struct CMCMYKColor {
unsigned short cyan;
unsigned short magenta;
unsigned short yellow;
unsigned short black;
};
A color value expressed in the CMY color space is composed of cyan , magenta , and yellow component values. Each color component is expressed as a numeric value within the range of 0 to 65535 inclusive.
struct CMCMYColor {
unsigned short cyan;
unsigned short magenta;
unsigned short yellow;
};
A color value expressed in the Gray color space is composed of a single component, gray , represented as a numeric value within the range of 0 to 65535 inclusive.
struct CMGrayColor {
unsigned short gray;
};
A color value expressed in a named color space is composed of a single component, namedColorIndex , represented as a numeric value within the range of an unsigned long, or 1 to 232 - 1 inclusive.
struct CMNamedColor {
unsigned long namedColorIndex; /* 1..a lot */
};
A color expressed in one of the multichannel color spaces with 5, 6, 7, or 8 channels. The color value for each channel component is expressed as an unsigned byte of type char .
struct CMMultichannel5Color {
unsigned char components[5];
};
struct CMMultichannel6Color {
unsigned char components[6];
};
struct CMMultichannel7Color {
unsigned char components[7];
};
struct CMMultichannel8Color {
unsigned char components[8];
};
Your application can use a union of type CMColor to specify a color value defined by one of the 15 data types supported by the union. Your application uses an array of color unions to specify a list of colors to match, check, or convert. The array is passed as a parameter to the general purpose color matching, color checking, or color conversion functions. The following functions use a color union:
CWMatchColors
matches the colors in the color list array to the data color space of the destination profile specified by the color world.CWCheckColors
checks the colors in the color list array against the color gamut specified by the color world's destination profile.IMPORTANT
You do not use a union of type CMColor to convert colors expressed in the XYZ color space as values of type CMFixedXYZ because the CMColor union does not support the CMFixedXYZ data type.
The color union is defined by the CMColor type definition. Each of the color types included in the union is defined previously.
union CMColor {
CMRGBColor rgb;
CMHSVColor hsv;
CMHLSColor hls;
CMXYZColor XYZ;
CMLabColor Lab;
CMLuvColor Luv;
CMYxyColor Yxy;
CMCMYKColor cmyk;
CMCMYColor cmy;
CMGrayColor gray;
CMMultichannel5Color mc5;
CMMultichannel6Color mc6;
CMMultichannel7Color mc7;
CMMultichannel8Color mc8;
CMNamedColor namedColor;
};
A color union can contain one of the following fields.
CMRGBColor
.CMHSVColor
.CMHLSColor
. CMXYZColor
.CMLabColor
. CMLuvColor
.CMYxyColor
.CMCMYKColor
.CMCMYColor
.CMGrayColor
.CMNamedColor
for a description of the
CMNamedColor
data type.