![]() |
CMMFlattenProfile |
||||
Header: | CMMComponent.h | Carbon status: | Unsupported | |
Handles the kCMMFlattenProfile request by extracting profile data from the profile to flatten and passing it to the specified function.
CMError CMMFlattenProfile ( CMMComponentInst cmm, CMProfileRef prof, 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 reference to the profile to flatten.
Reserved for future use.
A pointer to the CMFlattenProcPtr function supplied by the calling application or device driver to perform the low-level data transfer. Your CMMFlattenProfile function calls this function repeatedly as necessary until all the profile data is transferred.
A reference constant containing data specified by the calling application or device driver.
A CMM may respond to the kCMMFlattenProfile request code, but it is not required to do so. Most CMMs can rely on the default CMM to handle this request code adequately. The ColorSync Manager sends this request code to your CMM on behalf of an application or device driver that called the CMFlattenProfile function. The ColorSync Manager dispatches this request to the Component Manager, which calls your CMM to service the request. A CMM that handles the kCMMFlattenProfile request code typically responds by calling a CMM-defined function (for example, CMMFlattenProfile).
Only in rare circumstances should a custom CMM need to support this request code. The process of flattening a profile is complex, and the default CMM handles this process adequately for most cases. A custom CMM might respond to this request code if the CMM provides special services such as profile data encryption or compression, for example. Read the rest of this description if your CMM handles this request code.
Your CMMFlattenProfile function must extract the profile data from the profile to flatten, identified by the prof parameter, and pass the profile data to the function specified in the proc parameter.
Your CMMFlattenProfile function calls the CMFlattenProcPtr function supplied by the calling application.
Your CMMFlattenProfile 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 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 profile 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 function keeps track of the number of bytes of remaining profile data.
Your CMMFlattenProfile function is responsible for obtaining the profile data from the profile, allocating a buffer in which to pass the data to the CMFlattenProcPtr function, and keeping track of the amount of remaining data to transfer to the CMFlattenProcPtr function.
Each time your CMMFlattenProfile function calls the CMFlattenProcPtr function, you pass it the reference constant passed to your function in the reference constant parameter.
Starting with ColorSync version 2.5, the ColorSync Manager calls the function provided by the calling program directly, without going through the preferred, or any, CMM. Your CMM only needs to handle the kCMMFlattenProfile request code for versions of ColorSync prior to version 2.5.
CMMFlattenProfile is an API to CMMs. Use CMFlattenProfile 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)