Important: The information in this document is obsolete and should not be used for new development.
MyCMMGetPS2ColorRendering
Handles thekCMMGetPS2ColorRenderingrequest by obtaining the rendering intent from the header of the source profile.A CMM may respond to the
kCMMGetPS2ColorRenderingrequest 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 theCMGetPS2ColorRenderingfunction. The ColorSync Manager dispatches this request to the Component Manager, which calls your CMM to service the request. A CMM typically responds to thekCMMGetPS2ColorRenderingrequest code by calling a CMM-defined function (for example,MyCMMGetPS2ColorRendering) to handle the request.The MyCMMGetPS2ColorRendering function is a color management module-defined subroutine.
pascal CMError MyCMMGetPS2ColorRendering( ComponentInstance CMSession, CMProfileRef srcProf, CMProfileRef dstProf, unsigned long flags, CMFlattenUPP proc, void *refCon);
CMSession- 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
MyCMMGetPS2ColorRenderingfunction 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
MyCMMGetPS2ColorRenderingfunction must pass to theMyColorSyncDataTransferfunction.- 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, yourMyCMMGetPS2ColorRenderingfunction must obtain the rendering intent from the header of the source profile identified by thesrcProfparameter. 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 thedstProfparameter. The byte stream containing the specified rendering intent's CRD data that your function passes to theMyColorSyncDataTransferfunction is used as the operand to the PostScriptsetColorRenderingoperator.A profile may contain tags that specify the CRD data for each rendering intent. A profile's
ps2CRD0Tagelement data contains the CRD for perceptual rendering. A profile'sps2CRD1Tagcontains the CRD for relative colorimetric rendering. A profile'sps2CS2Tagcontains the CRD for saturation rendering. A profile'sps2CS3Tagcontains 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
databuffer in which to pass the CRD data to theMyColorSyncDataTransferfunction supplied by the calling application or driver. YourMyCMMGetPS2ColorRenderingfunction must call theMyColorSyncDataTransferfunction repeatedly until you have passed all the data to it. Here is the prototype for theMyColorSyncDataTransferfunction pointed to by theprocparameter:
pascal OSErr MyColorSyncDataTransfer( long command, long *size, void *data, void *refCon);YourMyCMMGetPS2ColorRenderingfunction communicates with theMyColorSyncDataTransferfunction using a command parameter to identify the operation to perform. Your function should call theMyColorSyncDataTransferfunction first with theopenWriteSpoolcommand to direct theMyColorSyncDataTransferfunction to begin the process of writing the profile CRD data you pass it in thedatabuffer. Next, you should call theMyColorSyncDataTransferfunction with thewriteSpoolcommand. After theMyColorSyncDataTransferfunction returns in thesizeparameter the amount of data it actually wrote, you should call theMyColorSyncDataTransferfunction again with thewriteSpoolcommand, repeating this process as often as necessary until all the CRD data is transferred. After the data is transferred, you should call theMyColorSyncDataTransferfunction with thecloseSpoolcommand.When your function calls the
MyColorSyncDataTransferfunction, it passes in thedatabuffer the profile data to transfer to theMyColorSyncDataTransferfunction and the size in bytes of the buffered data in thesizeparameter. TheMyColorSyncDataTransferfunction may not always write all the data you pass it in thedatabuffer. Therefore, on return theMyColorSyncDataTransferfunction command passes back in thesizeparameter the number of bytes it actually wrote. YourMyCMMGetPS2ColorRenderingfunction keeps track of the number of bytes of remaining CRD data.Each time your
MyCMMGetPS2ColorRenderingfunction calls theMyColorSyncDataTransferfunction, 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.