PATHDocumentation > Mac OS 8 and 9 > Mutlimedia and Graphics > ColorSync Manager >

Managing Color With ColorSync


Profile Location

In most cases, a ColorSync version 2.x profile is stored in a disk file. (For information on profile version numbers see ColorSync and ICC Profile Format Version Numbers ) However, to support special requirements, a profile can also be located in memory or in an arbitrary location that is accessed by a procedure you specify. The ColorSync Manager provides the following data types for working with profile locations:

IMPORTANT

Starting with ColorSync version 2.5, you should use the NCMGetProfileLocation function to obtain a profile location, rather than the CMGetProfileLocation function.


CMProfLoc

You use a union of type CMProfLoc to identify the location of a profile. You specify the union in the u field of the data type CMProfileLocation . Your application passes a pointer to a CMProfileLocation structure when it calls the CMOpenProfile function to identify the location of a profile or the CMNewProfile , CMCopyProfile , or CWNewLinkProfile functions to specify the location for a newly created profile.

You also pass a pointer to a CMProfileLocation structure to the NCMGetProfileLocation and CMGetProfileLocation functions to get the location of an existing profile. The NCMGetProfileLocation function is available starting with ColorSync version 2.5. It differs from its predecessor, CMGetProfileLocation , in that the newer version has a parameter for the size of the location structure for the specified profile.

union CMProfLoc {
    CMFileLocation          fileLoc;    /* specifies location on disk*/
    CMHandleLocation        handleLoc;  /* specifies location in relocatable memory */
    CMPtrLocation           ptrLoc;     /* specifies location in nonrelocatable
                                            memory */
    CMProcedureLocation     procLoc;    /* specifies access procedure */
};

Field descriptions

fileLoc
A data structure containing a file system specification record specifying the location of a profile disk file.
handleLoc
A data structure containing a handle that indicates the location of a profile in relocatable memory.
ptrLoc
A data structure containing a pointer that points to a profile in nonrelocatable memory.
procLoc
A data structure containing a universal procedure pointer that points to a profile access procedure supplied by you. The ColorSync Manager calls your procedure when the profile is created, initialized, opened, read, updated, or closed.

CMProfileLocation

Your application passes a profile location structure of type CMProfileLocation when it calls:

struct CMProfileLocation {
    short        locType;   /* location type for profile */
    CMProfLoc    u;         /* location information for profile */
};

Field descriptions

locType
The type of data structure that the u field's CMProfLoc union holds--a file specification, a handle, a pointer, or a universal procedure pointer. To specify the type, you use the constants defined in the enumeration described in Profile Location Type .
u
A union of type CMProfLoc identifying the profile location.

CMFileLocation

Your application uses the CMFileLocation structure to provide a file specification for a profile stored in a disk file. You provide a file specification structure in the CMProfileLocation structure's u field to specify the location of an existing profile or a profile to be created.

struct CMFileLocation {
    FSSpec   spec;  /* specifies profile file location on disk */
};

Field descriptions

spec
A file system specification structure giving the location of the profile file. A file specification structure includes the volume reference number, the directory ID of the parent directory, and the filename or directory name. For a description of the FSSpec data structure, see Inside Macintosh: Files.

CMHandleLocation

Your application uses the CMHandleLocation structure to provide a handle specification for a profile stored in relocatable memory. You provide the handle specification structure in the CMProfileLocation structure's u field to specify an existing profile or a profile to be created.

struct CMHandleLocation {
    Handle   h; /* handle that specifies profile's location in memory */
};

Field descriptions

h
A data structure of type Handle containing a handle that indicates the location of a profile in memory. For a description of the Handle data structure, see Inside Macintosh: Memory.

CMPtrLocation

Your application uses the CMPtrLocation structure to provide a pointer specification for a profile stored in nonrelocatable memory. You provide the pointer specification structure in the CMProfileLocation structure's u field to point to an existing profile.

struct CMPtrLocation {
    Ptr  p; /* pointer that specifies profile's location in memory */
};

Field descriptions

p
A data structure of type Ptr holding a pointer that points to the location of a profile in memory. For a description of the Ptr data structure, see Inside Macintosh: Memory.

CMProcedureLocation

Your application uses the CMProcedureLocation structure to provide a universal procedure pointer to a profile access procedure. You provide this structure in the CMProfileLocation structure's u field. The CMProcedureLocation structure also contains a pointer field to specify data associated with the profile access procedure.

The ColorSync Manager calls your profile access procedure when the profile is created, initialized, opened, read, updated, or closed.

struct CMProcedureLocation {
    CMProfileAccessUPP      proc;   /* profile access function universal
                                        procedure pointer */
    void *                  refCon; /* pointer to access procedure's
                                        private data, if any */
};

Field descriptions

proc
A universal procedure pointer to a profile access procedure. For a description of the procedure, see the function MyCMProfileAccessProc.
refCon
A pointer to the profile access procedure's private data, such as a file or resource name, a pointer to a current offset, and so on.

The ColorSync Manager defines the CMProfileAccessUPP type as follows:

typedef UniversalProcPtr CMProfileAccessUPP;

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