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

Managing Color With ColorSync


Getting and Setting Default Profiles by Color Space

This section describes the ColorSync functions, new in version 2.5, that you use to get and set default profiles for RGB, CMYK, Lab, and XYZ color spaces. Note that a user can set the default profile for the RGB and CMYK color spaces with the ColorSync control panel, as described in Setting Default Profiles .


CMGetDefaultProfileBySpace

New in ColorSync 2.5

Gets the default profile for the specified color space.
pascal CMError CMGetDefaultProfileBySpace(
                     OSType dataColorSpace,
                     CMProfileRef * prof);
dataColorSpace
A four-character identifier of type OSType. You pass a color space signature that identifies the color space you wish to get the default profile for. The currently-supported values are cmRGBData , cmCMYKData , cmLabData , and cmXYZData . These constants are a subset of the constants described in Color Space Signatures . If you supply a value that isn't supported, the CMGetDefaultProfileBySpace function returns an error value of paramErr .
prof
A pointer to a profile reference. On return, the reference specifies the current profile for the color space specified by dataColorSpace . CMGetDefaultProfileBySpace currently supports only file-based profiles.
function result
A result code of type CMError . For possible values, see the description of dataColorSpace for this function, as well as Result Codes for the ColorSync Manager .

DISCUSSION

The CMGetDefaultProfileBySpace function currently supports the RGB, CMYK, Lab, and XYZ color spaces. The signature constants for these color spaces (shown above with the dataColorSpace parameter description) are described in Color Space Signatures . Support for additional color spaces may be provided in the future. CMGetDefaultProfileBySpace returns an error value of paramErr if you pass a color space constant it doesn't currently support.

The CMGetDefaultProfileBySpace function always attempts to return a file-based profile for a supported color space. For example, if the user has not specified a default profile in the ColorSync control panel for the specified color space, or if the profile is not found (the user may have deleted the profiles in the ColorSync Profiles folder or even the folder itself), CMGetDefaultProfileBySpace creates a profile, stores it on disk, and returns a reference to that profile. However, you should always check for an error return--for example, a user may have booted from a CD, so that CMGetDefaultProfileBySpace cannot save a profile file to disk.


CMSetDefaultProfileBySpace

New in ColorSync 2.5

Sets the default profile for the specified color space.
pascal CMError CMSetDefaultProfileBySpace (
                     OSType dataColorSpace,
                     CMProfileRef prof);
dataColorSpace
A four-character identifier of type OSType. You pass a color space signature that identifies the color space you wish to set the default profile for. The currently-supported values are cmRGBData , cmCMYKData , cmLabData , and cmXYZData . These constants are a subset of the constants described in Color Space Signatures . If you supply a value that isn't supported, the CMGetDefaultProfileBySpace function returns an error value of paramErr .
prof
A profile reference. Before calling CMSetDefaultProfileBySpace , set the reference to specify the default profile for the color space. The profile must be file-based; otherwise, the function returns a CMInvalidProfileLocation error.
function result
A result code of type CMError . For possible values, see the descriptions of dataColorSpace and prof for this function, as well as Result Codes for the ColorSync Manager .

DISCUSSION

The CMSetDefaultProfileBySpace function currently supports the RGB, CMYK, Lab, and XYZ color spaces. The signature constants for these color spaces (shown above with the dataColorSpace parameter description) are described in Color Space Signatures . Support for additional color spaces may be provided in the future. CMSetDefaultProfileBySpace returns a value of paramErr if you pass a color space constant it doesn't currently support.

Note that a user can also use the ColorSync control panel to specify a default profile for the RGB and CMYK color spaces, as described in Setting Default Profiles .


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