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 /


CMCopyProfile

Duplicates the specified existing profile.

pascal CMError CMCopyProfile (
CMProfileRef *targetProf, 
const CMProfileLocation *targetLocation,
CMProfileRef srcProf);
targetProf
A pointer to a profile reference (page 3-63). On output, points to the profile copy that was created.
targetLocation
A pointer to a location specification that indicates the location, such as in memory or on disk, where the ColorSync Manager is to create the copy of the profile. A profile is commonly disk-file based. However, to accommodate special requirements, you can create a handle- or pointer-based profile, you can create a profile that is accessed through a procedure provided by your application, or you can create a temporary profile that isn't saved after you call the CMCloseProfile function. To create a temporary profile, you either specify cmNoProfileBase as the kind of profile in the profile location structure or specify NULL for this parameter. To specify the location, you use the CMProfileLocation data type (page 3-40).
srcProf
A profile reference to the profile to duplicate.
function result
A result code of type CMError. See "Result Codes" (page 3-174) for a list of ColorSync-specific result codes.
DISCUSSION
The CMCopyProfile function duplicates an entire open profile whose reference you specify. If you have made temporary changes to the profile, which you have not saved by calling CMUpdateProfile, those changes are included in the duplicated profile. They are not saved to the original profile unless you call CMUpdateProfile for that profile.

The ColorSync Manager maintains a modified flag to track whether a profile has been modified. After copying a profile, the CMCopyProfile function initializes the value of the modified flag for the resulting profile to false.

Unless you are copying a profile that you created, you should not infringe on copyright protection specified by the profile creator. To obtain the copyright information, you call the CMGetProfileElement function (page 3-87), specifying the 'cprt' tag signature for the copyright element. You should also check the flags field of the CMProfileHeader (page 3-43) for copyright information. The second bit of the flags field at position 1 indicates whether the profile can be used independently. If the profile developer set this bit to 1, you should use this profile as an embedded profile only and not copy the profile for your own purposes.

A calibration program might use this function, for example, to copy a device's original profile, then modify the copy to reflect the current state of the device. You might also want to copy a profile after you unflatten it.

SEE ALSO
To copy a profile, you must obtain a reference to that profile by either opening the profile or creating it. To open a profile, use the CMOpenProfile function (page 3-69). To create a new profile, use the CMNewProfile function (page 3-75). As an alternative to using the CMCopyProfile function to duplicate an entire profile, you can use the same profile reference more than once. To do so, you call the CMCloneProfileRef function (page 3-78) to increment the reference count for the reference each time you reuse it. Calling the CMCloneProfileRef function increments the count; calling the CMCloseProfile function (page 3-71) decrements it. The profile remains open as long as the reference count is greater than 0, indicating that at least one routine retains a reference to the profile.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 NOV 1996