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

Managing Color With ColorSync


Converting Between Color Spaces

See Converting Between Color Spaces for a description of the color conversion capabilities the ColorSync Manager provides. That section also describes color conversion prior to ColorSync version 2.1.

The ColorSync Manager provides the following functions to convert colors between a base color space and any of its derived color spaces or between two derivatives of the same base family.


CMConvertXYZToLab

Converts colors specified in the XYZ color space to the L*a*b* color space.

pascal CMError CMConvertXYZToLab (
                     const CMColor *src,
                     const CMXYZColor *white,
                     CMColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of XYZ colors to convert to L*a*b* colors.
white
A pointer to a reference white point.
dst
A pointer to an array containing the list of L*a*b* colors resulting from the conversion.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertXYZToLab function converts one or more colors defined in the XYZ color space to equivalent colors defined in the L*a*b* color space. Both color spaces are device independent.

If your application does not require that you preserve the source color list, you can pass the pointer to the same color list array as the src and dst parameters and allow the CMConvertXYZToLab function to overwrite the source colors with the resulting converted color specifications.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertLabToXYZ

Converts colors specified in the L*a*b* color space to the XYZ color space.

pascal CMError CMConvertLabToXYZ (
                     const CMColor *src,
                     const CMXYZColor *white,
                     CMColor *dst,
                     unsigned long count);
src
A pointer to a buffer containing the list of L*a*b* colors to convert to XYZ colors.
white
A pointer to a reference white point.
dst
A pointer to a buffer containing the list of colors as specified in the XYZ color space resulting from the conversion.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertLabToXYZ function converts one or more colors defined in the L*a*b color space to equivalent colors defined in the XYZ color space. Both color spaces are device independent.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertXYZToLuv

Converts colors specified in the XYZ color space to the L*u*v* color space.

pascal CMError CMConvertXYZToLuv (
                     const CMColor *src,
                     const CMXYZColor *white,
                     CMColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of XYZ colors to convert to L*u*v* colors.
white
A pointer to a reference white point.
dst
A pointer to an array containing the list of colors represented in L*u*v* color space resulting from the conversion.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertXYZToLuv function converts one or more colors defined in the XYZ color space to equivalent colors defined in the L*u*v* color space. Both color spaces are device independent.

If your application does not require that you preserve the source color list, you can pass the pointer to the same color list array as the src and dst parameters and allow the CMConvertXYZToLuv function to overwrite the source colors with the resulting converted color specifications.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertLuvToXYZ

Converts colors specified in the L*u*v* color space to the XYZ color space.

pascal CMError CMConvertLuvToXYZ (
                     const CMColor *src,
                     const CMXYZColor *white,
                     CMColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of L*u*v* colors to convert.
white
A pointer to a reference white point.
dst
A pointer to an array containing the list of colors, resulting from the conversion, as specified in the XYZ color space.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertLuvToXYZ function converts one or more colors defined in the L*u*v color space to equivalent colors defined in the XYZ color space. Both color spaces are device independent.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertXYZToYxy

Converts colors specified in the XYZ color space to the Yxy color space.

pascal CMError CMConvertXYZToYxy (
                     const CMColor *src,
                     CMColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of XYZ colors to convert to Yxy colors.
dst
A pointer to an array containing the list of colors resulting from the conversion represented in the Yxy color space.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertXYZToYxy function converts one or more colors defined in the XYZ color space to equivalent colors defined in the Yxy color space. Both color spaces are device independent.

If your application does not require that you preserve the source color list, you can pass the pointer to the same color list array as the src and dst parameters and allow the CMConvertXYZToYxy function to overwrite the source colors with the resulting converted color specifications.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertYxyToXYZ

Converts colors specified in the Yxy color space to the XYZ color space.

pascal CMError CMConvertYxyToXYZ (
                     const CMColor *src,
                     CMColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of Yxy colors to convert.
dst
A pointer to an array containing the list of colors, resulting from the conversion, as specified in the XYZ color space.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertYxyToXYZ function converts one or more colors defined in the Yxy color space to equivalent colors defined in the XYZ color space. Both color spaces are device independent.

If your application does not require that you preserve the source color list, you can pass the pointer to the same color list array as the src and dst parameters and allow the CMConvertYxyToXYZ function to overwrite the source colors with the resulting converted color specifications.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertXYZToFixedXYZ

Converts colors specified in the XYZ color space whose components are expressed as XYZ 16-bit unsigned values of type CMXYZColor to equivalent colors expressed as 32-bit signed values of type CMFixedXYZColor .

pascal CMError CMConvertXYZToFixedXYZ (
                     const CMXYZColor *src,
                     CMFixedXYZColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of XYZ colors to convert to Fixed XYZ colors.
dst
A pointer to an array containing the list of colors resulting from the conversion in which the colors are specified as Fixed XYZ colors.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertXYZToFixedXYZ function converts one or more colors whose components are defined as XYZ colors to equivalent colors whose components are defined as Fixed XYZ colors. Fixed XYZ colors allow for 32-bit precision. The XYZ color space is device independent.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertFixedXYZToXYZ

Converts colors specified in XYZ color space whose components are expressed as Fixed XYZ 32-bit signed values of type CMFixedXYZColor to equivalent colors expressed as XYZ 16-bit unsigned values of type CMXYZColor .

pascal CMError CMConvertFixedXYZToXYZ (
                     const CMFixedXYZColor *src,
                     CMXYZColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of Fixed XYZ colors to convert to XYZ colors.
dst
A pointer to an array containing the list of colors resulting from the conversion specified as XYZ colors.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertFixedXYZToXYZ function converts one or more colors defined in the Fixed XYZ color space to equivalent colors defined in the XYZ color space. The XYZ color space is device independent.

If your application does not require that you preserve the source color list, you can pass the pointer to the same color list array as the src and dst parameters and allow the CMConvertFixedXYZToXYZ function to overwrite the source colors with the resulting converted color specifications.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertRGBToHLS

Converts colors specified in the RGB color space to equivalent colors defined in the HLS color space.

pascal CMError CMConvertRGBToHLS (
                     const CMColor *src,
                     CMColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of RGB colors to convert to HLS colors.
dst
A pointer to an array containing the list of colors, resulting from the conversion, as specified in the HLS color space.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertRGBToHLS function converts one or more colors defined in the RGB color space to equivalent colors defined in the HLS color space. Both color spaces are device dependent.

If your application does not require that you preserve the source color list, you can pass the pointer to the same color list array as the src and dst parameters and allow the CMConvertRGBToHLS function to overwrite the source colors with the resulting converted color specifications.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertHLSToRGB

Converts colors specified in the HLS color space to equivalent colors defined in the RGB color space.

pascal CMError CMConvertHLSToRGB (
                     const CMColor *src,
                     CMColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of HLS colors to convert to RGB colors.
dst
A pointer to an array containing the list of colors, resulting from the conversion, as specified in the RGB color space.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertHLSToRGB function converts one or more colors defined in the HLS color space to equivalent colors defined in the RGB color space. Both color spaces are device dependent.

If your application does not require that you preserve the source color list, you can pass the pointer to the same color list array as the src and dst parameters and allow the CMConvertHLSToRGB function to overwrite the source colors with the resulting converted color specifications.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertRGBToHSV

Converts colors specified in the RGB color space to equivalent colors defined in the HSV color space when the device types are the same.

pascal CMError CMConvertRGBToHSV (
                     const CMColor *src,
                     CMColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of RGB colors to convert to HSV colors.
dst
A pointer to an array containing the list of colors, resulting from the conversion, as specified in the HSV color space.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertRGBToHSV function converts one or more colors defined in the RGB color space to equivalent colors defined in the HSV color space. Both color spaces are device dependent.

If your application does not require that you preserve the source color list, you can pass the pointer to the same color list array as the src and dst parameters and allow the CMConvertRGBToHSV function to overwrite the source colors with the resulting converted color specifications.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertHSVToRGB

Converts colors specified in the HSV color space to equivalent colors defined in the RGB color space.

pascal CMError CMConvertHSVToRGB (
                     const CMColor *src,
                     CMColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of HSV colors to convert to RGB colors.
dst
A pointer to an array containing the list of colors, resulting from the conversion, as specified in the RGB color space.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertHSVToRGB function converts one or more colors defined in the HSV color space to equivalent colors defined in the RGB color space. Both color spaces are device dependent.

If your application does not require that you preserve the source color list, you can pass the pointer to the same color list array as the src and dst parameters and allow the CMConvertHSVToRGB function to overwrite the source colors with the resulting converted color specifications.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


CMConvertRGBToGray

Converts colors specified in the RGB color space to equivalent colors defined in the Gray color space.

pascal CMError CMConvertRGBToGray (
                     const CMColor *src,
                     CMColor *dst,
                     unsigned long count);
src
A pointer to an array containing the list of colors specified in RGB space to convert to colors specified in Gray space.
dst
A pointer to an array containing the list of colors, resulting from the conversion, as specified in the Gray color space.
count
The number of colors to convert.
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMConvertRGBToGray function converts one or more colors defined in the RGB color space to equivalent colors defined in the Gray color space. Both color spaces are device dependent.

If your application does not require that you preserve the source color list, you can pass the pointer to the same color list array as the src and dst parameters and allow the CMConvertRGBToGray function to overwrite the source colors with the resulting converted color specifications.

SEE ALSO

For information about the color conversion routines in previous versions of ColorSync, see Converting Between Color Spaces .


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