![]() |
CMMGetPS2ColorSpace |
||||
Header: | CMMComponent.h | Carbon status: | Unsupported | |
Handles the kCMMGetPS2ColorSpace request by obtaining or deriving the color space element data from the source profile.
CMError CMMGetPS2ColorSpace ( CMMComponentInst cmm, CMProfileRef srcProf, UInt32 flags, CMFlattenUPP proc, void *refCon );
A handle to your CMMs storage for the instance of your component associated with the calling application or device driver.
A profile reference to the source profile from which you must obtain or derive the color space element data.
Reserved for future use.
A pointer to a ColorSyncDataTransfer function supplied by the calling application or device driver. Your CMMGetPS2ColorSpace function calls this function repeatedly as necessary until you have passed all the source profiles color space element data to this function.
A reference constant, containing data specified by the calling application or device driver, that your CMMGetPS2ColorSpace function must pass to the CMFlattenProcPtr function.
A CMM may respond to the kCMMGetPS2ColorSpace 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 CMGetPS2ColorSpace 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 kCMMGetPS2ColorSpace request code by calling a CMM-defined function (for example, CMMGetPS2ColorSpace) 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 CMMGetPS2ColorSpace function must obtain or derive the color space element data from the source profile whose reference is passed to your function in the srcProf parameter.
The color space data may be assigned to the PostScript Level 2 color space array (ps2CSATag) tag in the source profile. The byte stream containing the color space element data that your function passes to the CMFlattenProcPtr function is used as the operand to the PostScript setColorSpace operator.
Your function must allocate a data buffer in which to pass the color space element data to the CMFlattenProcPtr function supplied by the calling application or driver. Your CMMGetPS2ColorSpace function must call the CMFlattenProcPtr function repeatedly until you have passed all the data to it.
Your CMMGetPS2ColorSpace 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 color space element 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 color space 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 CMMGetPS2ColorSpace function keeps track of the number of bytes of remaining color space element data.
Each time your CMMGetPS2ColorSpace 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.
CMMGetPS2ColorSpace is an API to CMMs. Use CMGetPS2ColorSpace 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)