Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Advanced Color Imaging Reference /
Chapter 4 - ColorSync Manager Reference for Color Management Modules / Optional CMM-Defined Functions
/


MyCMMGetPS2ColorRenderingIntent

Handles the kCMMGetPS2ColorRenderingIntent request by obtaining the rendering intent from the source profile.

A CMM may respond to the kCMMGetPS2ColorRenderingIntent request code, but it is not required to do so. The ColorSync Manager sends this request code to your CMM on behalf of an application that called the CMGetPS2ColorRenderingIntent function. The ColorSync Manager dispatches this request to the Component Manager, which calls your CMM to service the request. A CMM typically responds to the kCMMGetPS2ColorRenderingIntent request code by calling a CMM-defined function (for example, MyCMMGetPS2ColorRenderingIntent) to handle the request.

The MyCMMGetPS2ColorRenderingIntent function is a color management module-defined subroutine.

pascal CMError MyCMMGetPS2ColorRenderingIntent(
ComponentInstance CMSession,
CMProfileRef srcProf, 
unsigned long flags,
CMFlattenUPP proc,
void *refCon);
CMSession
A handle to your CMM's storage for the instance of your component associated with the calling application or device driver.
srcProf
A profile reference to the source profile whose header contains the rendering intent.
flags
Reserved for future use.
proc
A pointer to a function supplied by the calling application or device driver. Your MyCMMGetPS2ColorRenderingIntent function calls this function repeatedly as necessary until you have passed all the source profile's rendering intent data to this function.
refCon
A reference constant, containing data specified by the calling application or device driver, that your MyCMMGetPS2ColorRenderingIntent function must pass to the MyColorSyncDataTransfer function.
function result
A result code of type CMError. See "Result Codes" (page 3-172) for a list of ColorSync-specific result codes.
DISCUSSION
Only for special cases should a custom CMM need to support this request code. If your CMM supports this function, your MyCMMGetPS2ColorRenderingIntent function must obtain the rendering intent from the source profile whose reference is passed to your function in the srcProf parameter. The byte stream containing the rendering intent data that your function passes to the MyColorSyncDataTransfer function is used as the operand to the PostScript findRenderingIntent operator.

Your function must allocate a data buffer in which to pass the rendering intent data to the MyColorSyncDataTransfer function supplied by the calling application or driver. Your MyCMMGetPS2ColorRenderingIntent function must call the MyColorSyncDataTransfer function repeatedly until you have passed all the data to it.

Here is the prototype for the MyColorSyncDataTransfer function pointed to by the proc parameter:

pascal OSErr MyColorSyncDataTransfer(
                  long command,
                  long *size, 
                  void *data,
                  void *refCon); 
Your MyCMMGetPS2ColorRenderingIntent function communicates with the MyColorSyncDataTransfer function using a command parameter to identify the operation to perform. Your function should call the MyColorSyncDataTransfer function first with the openWriteSpool command to direct the MyColorSyncDataTransfer function to begin the process of writing the profile color-rendering intent element data you pass it in the data buffer. Next, you should call the MyColorSyncDataTransfer function with the writeSpool command. After the MyColorSyncDataTransfer function returns in the size parameter the amount of data it actually read, you should call the MyColorSyncDataTransfer function again with the writeSpool command, repeating this process as often as necessary until all the color-rendering intent data is transferred. After the data is transferred, you should call the MyColorSyncDataTransfer function with the closeSpool command.

When your function calls the MyColorSyncDataTransfer function, it passes in the data buffer the profile data to transfer to the MyColorSyncDataTransfer function and the size in bytes of the buffered data in the size parameter. The MyColorSyncDataTransfer function may not always write all the data you pass it in the data buffer. Therefore, on return the MyColorSyncDataTransfer function command passes back in the size parameter the number of bytes it actually wrote. Your MyCMMGetPS2ColorRenderingIntent function keeps track of the number of bytes of remaining color-rendering intent element data.

Each time your MyCMMGetPS2ColorRenderingIntent function calls the MyColorSyncDataTransfer function, you pass it the reference constant passed to your function in the reference constant parameter.

SEE ALSO
For information about PostScript operations, see the PostScript Language Manual, second edition.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 NOV 1996