Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Advanced Color Imaging Reference /
Chapter 3 - ColorSync Manager Reference for Applications and Device Drivers / ColorSync Manager Functions
Accessing Profiles /


CMOpenProfile

Opens the specified profile and returns a reference to the profile.

pascal CMError CMOpenProfile (
                  CMProfileRef *prof         
                  const CMProfileLocation *theProfile);
prof
A pointer to a profile reference (page 3-63). On output, the reference refers to the opened profile.
theProfile
The profile location (page 3-40) of the profile to open. Commonly a profile is disk-file based, but it may instead be temporary, handle-based, pointer-based, or accessed through a procedure supplied by your application.
function result
A result code of type CMError. See "Result Codes" (page 3-174) for a list of ColorSync-specific result codes.
DISCUSSION
If the CMOpenProfile function executes successfully, the profile reference refers to the opened profile. Your application uses this reference, for example, when it calls functions to color match, copy, and update a profile, and validate its contents.

The ColorSync Manager maintains private storage for each request to open a profile, allowing more than one application to use a profile concurrently.

When you create a new profile or modify the elements of an existing profile, the ColorSync Manager stores the new or modified elements in the private storage it maintains for your application. Any new or changed profile elements are not incorporated into the profile itself unless your application calls the CMUpdateProfile function (page 3-73) to update the profile. If you call the CMCopyProfile function (page 3-76) to create a copy of an existing profile under a new name, any changes you have made are incorporated in the profile duplicate but the original profile remains unchanged.

Before you call the CMOpenProfile function, you must set the CMProfileLocation data structure to identify the location of the profile to open. Most commonly, a profile is stored in a disk file. If the profile is in a disk file, use the profile location data type to provide its file specification. If the profile is in memory, use the profile location data type to specify a handle or pointer to the profile. If the profile is accessed through a procedure provided by your application, use the profile location data type to supply a universal procedure pointer to your procedure.

Your application must obtain a profile reference before you copy or validate a profile, and before you flatten the profile to embed it.

For example, your application can

  1. open a profile
  2. call the CMGetProfileHeader function to obtain the profile's header to modify its values
  3. set new values
  4. call the CMSetProfileHeader function to replace the modified header
  5. pass the profile reference to a function such as NCWNewColorWorld as the source or destination profile in a color world for a color-matching session

When you close your reference to the profile by calling the CMCloseProfile function (page 3-71), your changes are discarded (unless you called the CMUpdateProfile function).


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 NOV 1996