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

Managing Color With ColorSync


Color-Matching With PostScript Devices

The ColorSync Manager provides three functions that support color matching by PostScript Level 2 devices. The default CMM implements these functions if the preferred CMM corresponding to the profile does not.

Starting with PostScript version 2016, to provide better support for ColorSync and ICC profiles, Postscript Level 2 supports up to four-component color spaces through the addition of CIEBasedDEF and CIEBasedDEFG color spaces.

To use these new color spaces, starting with ColorSync version 2.1, the CMGetPS2ColorSpace function supports profiles with four components, as well as scanner and monitor profiles that contain multidimensional table information. In previous versions of ColorSync, routines such as CMGetPS2ColorSpace returned an error if asked to generate PostScript code for a profile with more than three components.

The CIEBasedDEF and CIEBasedDEFG color spaces are extensions to the CIEBasedABC color space. To work with these color spaces, PostScript defines the RangeDEF, RangeHIJK, DecodeDEFG, and Table arrays. You can read more about how these arrays are used to convert CIEBasedDEF and CIEBasedDEFG color space values in the PostScript Language Reference Manual Supplement , version 2016.

IMPORTANT

If you use ColorSync to generate PostScript output for CIEBasedDEF and CIEBasedDEFG color spaces, be sure the printer has PostScript version 2016 or later.


CMGetPS2ColorSpace

Obtains color space element data in text format usable as the parameter to the PostScript setColorSpace operator, which characterizes the color space of subsequent graphics data.

pascal CMError CMGetPS2ColorSpace (
                     CMProfileRef srcProf,
                     unsigned long flags,
                     CMFlattenUPP proc,
                     void *refCon,
                     Boolean *preferredCMMnotfound);
srcProf
A profile reference to the source profile that defines the data color space and identifies the preferred CMM.
flags
If the value of flags is equal to cmPS8bit , the generated PostScript will utilize 8-bit encoding whenever possible to achieve higher data compaction. If the value of flags is not equal to cmPS8bit , the generated data will be 7-bit safe, in either ASCII or ASCII base-85 encoding.
proc
A pointer to a callback flatten function to receive the PostScript data from the CMM. For information, see the function MyColorSyncDataTransfer .
refCon
An untyped pointer to arbitrary data supplied by your application. CMGetPS2ColorSpace passes this data in calls to your MyColorSyncDataTransfer function.
preferredCMMnotfound
A pointer to a flag for whether the preferred CMM was found. On output, has the value true if the CMM corresponding to profile was not available or if it was unable to perform the function and the default CMM was used. Otherwise, has the value false .
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMGetPS2ColorSpace function obtains PostScript color space data from the source profile. The valid profile classes for the CMGetPS2ColorSpace function are display, input, and output profiles with at most four components.

To determine which profile elements to use to generate the PostScript color space data, the CMM:

The CMM obtains the PostScript data from the profile and calls your low-level data transfer procedure passing the PostScript data to it. The CMM converts the data into a PostScript stream and calls your procedure as many times as necessary to transfer the data to it.

Typically, the low-level data transfer function returns this data to the calling application or device driver to pass to a PostScript printer as an operand to the PostScript setcolorspace operator, which defines the color space of graphics data to follow.

The CMGetPS2ColorSpace function is dispatched to the CMM component specified by the source profile. If the designated CMM is not available or the CMM does not implement this function, then the ColorSync Manager dispatches the function to the default CMM.


CMGetPS2ColorRenderingIntent

Obtains the rendering intent element data in text format usable as the parameter to the PostScript findRenderingIntent operator, which specifies the color-matching option for subsequent graphics data.

pascal CMError CMGetPS2ColorRenderingIntent (
                     CMProfileRef srcProf,
                     unsigned long flags,
                     CMFlattenUPP proc,
                     void *refCon,
                     Boolean *preferredCMMnotfound);
srcProf
A profile reference to the source profile that defines the data color space and identifies the preferred CMM.
flags
If the value of flags is equal to cmPS8bit , the generated PostScript will utilize 8-bit encoding whenever possible to achieve higher data compaction. If the value of flags is not equal to cmPS8bit , the generated data will be 7-bit safe, in either ASCII or ASCII base-85 encoding.
proc
A low-level data transfer function supplied by the calling application to receive the PostScript data from the CMM. For more information, see the function MyColorSyncDataTransfer .
refCon
An untyped pointer to arbitrary data supplied by your application. CMGetPS2ColorSpace passes this data in calls to your MyColorSyncDataTransfer function.
preferredCMMnotfound
A pointer to a flag for whether the preferred CMM was found. On output, has the value true if the CMM corresponding to profile was not available or if it was unable to perform the function and the default CMM was used. Otherwise, has the value false .
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMGetPS2ColorRenderingIntent function obtains PostScript rendering intent information from the header of the source profile. It returns data by calling your low-level data transfer procedure and passing the PostScript data to it. Typically, your low-level data transfer function returns this data to the calling application or device driver to pass to a PostScript printer.

The CMGetPS2ColorRenderingIntent function is dispatched to the CMM component specified by the source profile. If the designated CMM is not available or the CMM does not implement this function, then ColorSync dispatches the function to the default CMM.


CMGetPS2ColorRendering

Obtains the color rendering dictionary (CRD) element data usable as the parameter to the PostScript setColorRendering operator, which specifies the PostScript color rendering dictionary to use for the following graphics data.

pascal CMError CMGetPS2ColorRendering (
                     CMProfileRef srcProf,
                     CMProfileRef dstProf,
                     unsigned long flags,
                     CMFlattenUPP proc,
                     void *refCon,
                     Boolean *preferredCMMnotfound);
srcProf
A profile reference to a profile that supplies the rendering intent for the CRD.
dstProf
A profile reference to a profile from which to extract the CRD data.
flags
If the value of flags is equal to cmPS8bit , the generated PostScript will utilize 8-bit encoding whenever possible to achieve higher data compaction. If the value of flags is not equal to cmPS8bit , the generated data will be 7-bit safe, in either ASCII or ASCII base-85 encoding.
proc
A pointer to a callback flatten function to perform the data transfer. For information, see the function MyColorSyncDataTransfer .
refCon
An untyped pointer to arbitrary data supplied by your application. CMGetPS2ColorSpace passes this data in calls to your MyColorSyncDataTransfer function.
preferredCMMnotfound
A pointer to a flag for whether the preferred CMM was found. On output, has the value true if the CMM corresponding to profile was not available or if it was unable to perform the function and the default CMM was used. Otherwise, has the value false .
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

The CMGetPS2ColorRendering function obtains CRD data from the profile specified by the dstProf parameter. To be valid, the parameter must specify an output profile with at most four components. The CMM uses the rendering intent from the profile specified by the srcProf parameter to determine which of the PostScript tags ( ps2CR0Tag , ps2CR1Tag , ps2CR2Tag , or ps2CR3Tag ) to use in creating the CRD. If none of these tags exists in the profile, the CMM creates the CRD from one of the multidimensional table tags ( cmAToB0 , cmAToB1 , or cmAToB2 ), again chosen according to the rendering intent of the profile specified by the srcProf parameter.

This function is dispatched to the CMM component specified by the destination profile. If the designated CMM is not available or the CMM does not implement this function, the ColorSync Manager dispatches this function to the default CMM.

The CMM obtains the PostScript data and passes it to your low-level data transfer procedure, specified by the proc parameter. The CMM converts the data into a PostScript stream and calls your procedure as many times as necessary to transfer the data to it. Typically, the low-level data transfer function returns this data to the calling application or device driver to pass to a PostScript printer.

SEE ALSO

Before your application or device driver sends the CRD to the printer, it can call the function CMGetPS2ColorRenderingVMSize to determine the virtual memory size of the CRD.


CMGetPS2ColorRenderingVMSize

Determines the virtual memory size of the color rendering dictionary (CRD) for a printer profile before your application or driver obtains the CRD and sends it to the printer.

pascal CMError CMGetPS2ColorRenderingVMSize (
                     CMProfileRef srcProf,
                     CMProfileRef dstProf,
                     unsigned long *vmSize,
                     Boolean *preferredCMMnotfound);
srcProf
A profile reference to a profile that supplies the rendering intent for the CRD.
dstProf
A profile reference to the destination printer profile.
vmSize
A pointer to a memory size. On return, the virtual memory size of the CRD.
preferredCMMnotfound
A pointer to a flag for whether the preferred CMM was found. On output, has the value true if the CMM corresponding to profile was not available or if it was unable to perform the function and the default CMM was used. Otherwise, has the value false .
function result
A result code of type CMError . For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

Your application or device driver can call this function to determine if the virtual memory size of the color rendering dictionary exceeds the printer's capacity before sending the CRD to the printer. If the printer's profile contains the Apple-defined optional tag 'psvm' described in CMConcatProfileSet , then the default CMM will return the data supplied by this tag specifying the CRD virtual memory size for the rendering intent's CRD. If the printer's profile does not contain this tag, then the CMM uses an algorithm to assess the VM size of the CRD, in which case the assessment can be larger than the actual maximum VM size.

The CMM uses the profile specified by the srcProf parameter to determine the rendering intent to use.


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