PATHMac OS 8 Developer Documentation > Mutlimedia and Graphics > ColorSync Manager >

Managing Color With ColorSync


Cached Profile Searching

The function CMIterateColorSyncFolder takes advantage of the profile cache available starting with ColorSync version 2.5 to provide optimized searching and quick access to profile information. The function iterates through the available profiles, calling a function you supply to process each profile you are interested in. For more information, see Searching for Specific Profiles Prior to ColorSync 2.5 and Searching for Profiles With ColorSync 2.5 .

The ColorSync Manager defines the following types for profile searching with the CMIterateColorSyncFolder function:


CMProfileIterateProcPtr

New in ColorSync 2.5

The function CMIterateColorSyncFolder has a parameter of type CMProfileIterateUPP . ColorSync defines the procedure pointer CMProfileIterateProcPtr to use for this parameter. For a description of the application-defined function itself, see MyCMProfileFilterProc.

CMProfileIterateProcPtr is defined as follows:

pascal OSErr (*CMProfileIterateProcPtr )
                    (CMProfileIterateData *iterateData,
                     void *refCon);
iterateData
A pointer to a structure of type CMProfileIterateData . When the CMIterateColorSyncFolder function calls your application-defined function, as it does once for each found profile, the structure contains key information about the profile.
refCon
An untyped pointer to arbitrary data your application previously passed to the function CMIterateColorSyncFolder .
callback return value
A result code of type CMError . If your callback function returns an error, CMIterateColorSyncFolder stops iterating and returns the error value to its caller (presumably your code). For possible values, see Result Codes for the ColorSync Manager .

DISCUSSION

When you call CMIterateColorSyncFolder , you pass a universal procedure pointer of type CMProfileIterateProcPtr that points to a callback function you provide. For more information on the callback function, see MyProfileIterateProc .


CMProfileIterateData

New in ColorSync 2.5

The ColorSync Manager defines the CMProfileIterateData structure to provide your CMProfileIterateProcPtr callback routine with a description of a profile during an iteration through the available profiles that takes place when you call CMIterateColorSyncFolder .

struct CMProfileIterateData {
    unsigned long   dataVersion;    /* cmProfileIterateDataVersion1 */
    CM2Header       header;
    ScriptCode      code;
    Str255          name;
    CMProfileLocation location;
};
typedef struct CMProfileIterateData CMProfileIterateData;
dataVersion
A value identifying the version of the structure. Currently set to cmProfileIterateDataVersion1 .
header
A ColorSync version 2.x profile header structure of type CM2Header , containing information such as the profile size, type, version, and so on.
code
A script code identifying the script system used for the profile description. You can learn more about script codes in Inside Macintosh: Text . The ScriptCode data type is defined in the MacTypes.h header file.
name
The profile name, stored as a Pascal-type string (with length byte first) of up to 255 characters.
location
A structure specifying the profile location. With ColorSync 2.5, the location is always file-based, but that may not be true for future versions. Your code should always verify that the location structure contains a file specification before attempting to use it.

© 1988-1999 Apple Computer, Inc. — (Last Updated 20 Jan 99)