Carbon


CMFlattenProcPtr

Header: CMApplication.h Carbon status: Supported

Defines a pointer to a data transfer callback function. Your data transfer callback function transfers profile data from the format for embedded profiles to disk file format or vice versa. It is used, for example, by PostScript functions to transfer data from a profile to text format usable by a PostScript driver.

typedef OSErr(* CMFlattenProcPtr) (
    SInt32 command, 
    SInt32 *size, 
    void *data, 
    void *refCon
);

You would declare your function like this if you were to name it MyCMFlattenCallback:

OSErr MyCMFlattenCallback (
    SInt32 command, 
    SInt32 *size, 
    void *data, 
    void *refCon
);
Parameter descriptions
command

The command with which the MyCMFlattenCallback function is called. This command specifies the operation the function is to perform.

size

A pointer to a size value. On input, the size in bytes of the data to transfer. On return, the size of the data actually transferred.

data

A pointer to the buffer supplied by the ColorSync Manager to use for the data transfer.

refCon

A pointer to a reference constant that holds the application data passed in from the functions CMFlattenProfile, CMUnflattenProfile, CMGetPS2ColorRenderingVMSize, CMGetPS2ColorRenderingIntent, or CMFlattenProfile. Each time the CMM calls your MyCMFlattenCallback function, it passes this data to the function.

Starting in ColorSync version 2.5, the ColorSync Manager calls your function directly, without going through the preferred, or any, CMM.

function result

A result code.

DISCUSSION

Starting in ColorSync version 2.5, the ColorSync Manager calls your data transfer function directly, without going through the preferred, or any, CMM. So any references to the CMM in the discussion that follows are applicable only to versions of ColorSync prior to version 2.5. Where the discussion does not involve CMMs, it is applicable to all versions of ColorSync.

Your MyCMFlattenCallback function is called to flatten and unflatten profiles or to transfer PostScript-related data from a profile to the PostScript format to send to an application or device driver.

The ColorSync Manager and the CMM communicate with the MyCMFlattenCallback function using the command parameter to identify the operation to perform. To read and write profile data, your function must support the following commands: cmOpenReadSpool, cmOpenWriteSpool, cmReadSpool, cmWriteSpool, and cmCloseSpool.

You determine the behavior of your MyCMFlattenCallback function. The following sections describe how your function might handle the flattening and unflattening processes.

Flattening a Profile:

The ColorSync Manager calls the specified profile’s preferred CMM when an application calls the CMFlattenProfile function to transfer profile data embedded in a graphics document.

The ColorSync Manager determines if the CMM supports the CMFlattenProfile function. If so, the ColorSync Manager dispatches the CMFlattenProfile function to the CMM. If not, ColorSync calls the default CMM, dispatching the CMFlattenProfile function to it.

The CMM communicates with the MyCMFlattenCallback function using a command parameter to identify the operation to perform. The CMM calls your function as often as necessary, passing to it on each call any data transferred to the CMM from the CMFlattenProfile function’s refCon parameter.

The ColorSync Manager calls your function with the following sequence of commands: cmOpenWriteSpool, cmWriteSpool, and cmCloseSpool. Here is how you should handle these commands:

As part of this process, your function can embed the profile data in a graphics document, for example, a PICT file or a TIFF file. For example, your MyCMFlattenCallback function can call the QuickDraw PicComment function to embed the flattened profile in a picture.

Unflattening a Profile:

When an application calls the CMUnflattenProfile function to transfer a profile that is embedded in a graphics document to an independent disk file, the ColorSync Manager calls your MyCMFlattenCallback function with the following sequence of commands: cmOpenReadSpool, cmReadSpool, cmCloseSpool. Here is how you should handle these commands:

VERSION NOTES

Starting in ColorSync version 2.5, the ColorSync Manager calls your function directly, without going through the preferred, or any, CMM.


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