Carbon


CMMGetPS2ColorRendering

Header: CMMComponent.h Carbon status: Unsupported

Handles the kCMMGetPS2ColorRendering request by obtaining the rendering intent from the header of the source profile.

CMError CMMGetPS2ColorRendering (
    CMMComponent cmm, 
    CMProfileRef srcProf, 
    CMProfileRef dstProf, 
    UInt32 flags, 
    CMFlattenUPP proc, 
    void *refCon
);
Parameter descriptions
cmm

A handle to your CMM’s private 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 indicates the rendering intent for generating the color rendering dictionary (CRD).

dstProf

A profile reference to the destination profile from which you obtain or derive the CRD.

flags

Reserved for future use.

proc

A pointer to a function supplied by the calling application or device driver. Your CMMGetPS2ColorRendering function calls this function repeatedly as necessary until you have passed all the CRD element data to this function.

refCon

A reference constant, containing data specified by the calling application or device driver, that your CMMGetPS2ColorRendering function must pass to the CMFlattenProcPtr function.

DISCUSSION

A CMM may respond to the kCMMGetPS2ColorRendering 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 CMGetPS2ColorRendering 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 kCMMGetPS2ColorRendering request code by calling a CMM-defined function (for example, CMMGetPS2ColorRendering) to handle the request.

Only for special cases should a custom CMM need to support this request code. If your CMM supports this function, your CMMGetPS2ColorRendering function must obtain the rendering intent from the header of the source profile identified by the srcProf parameter. The rendering intent identifies the color rendering dictionary (CRD) data that you must obtain or derive from the destination profile whose reference is passed to your function in the dstProf parameter. The byte stream containing the specified rendering intent’s CRD data that your function passes to the CMFlattenProcPtr function is used as the operand to the PostScript setColorRendering operator.

A profile may contain tags that specify the CRD data for each rendering intent. A profile’s ps2CRD0Tag element data contains the CRD for perceptual rendering. A profile’s ps2CRD1Tag contains the CRD for relative colorimetric rendering. A profile’s ps2CS2Tag contains the CRD for saturation rendering. A profile’s ps2CS3Tag contains the CRD for absolute colorimetric rendering. If the profile does not contain a CRD tag, your CMM should create the CRD from the destination profile using the rendering intent specified by the source profile.

Your function must allocate a data buffer in which to pass the CRD data to the CMFlattenProcPtr function supplied by the calling application or driver. Your CMMGetPS2ColorRendering function must call the CMFlattenProcPtr function repeatedly until you have passed all the data to it.

Your CMMGetPS2ColorRendering function communicates with the CMFlattenProcPtr function using a command parameter to identify the operation to perform. Your function should call the CMFlattenProcPtr function first with the cmOpenWriteSpool command to direct the CMFlattenProcPtr function to begin the process of writing the profile CRD data you pass it in the data buffer. Next, you should call the CMFlattenProcPtr function with the cmWriteSpool command. After the CMFlattenProcPtr function returns in the size parameter the amount of data it actually wrote, you should call the CMFlattenProcPtr function again with the cmWriteSpool command, repeating this process as often as necessary until all the CRD data is transferred. After the data is transferred, you should call the CMFlattenProcPtr function with the cmCloseSpool command.

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

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

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

CARBON NOTES

CMMGetPS2ColorRendering is an API to CMMs; use CMGetPS2ColorRendering instead. Application developers should avoid calling CMMs directly, since they may or may not support a given API.


© 2000 Apple Computer, Inc. (Last Updated 7/17/2000)