![]() |
CMCopyProfile |
||||
Header: | CMApplication.h | Carbon status: | Supported | |
Duplicates the specified existing profile.
CMError CMCopyProfile ( CMProfileRef *targetProf, const CMProfileLocation *targetLocation, CMProfileRef srcProf );
A pointer to a profile reference of type CMProfileRef. On return, points to the profile copy that was created.
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 is not 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 data type CMProfileLocation.
A profile reference to the profile to duplicate.
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 sets the value of the modified flag for that 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 function CMGetProfileElement, specifying the cmCopyrightTag tag signature for the copyright element (defined in the CMICCProfile.h header file).
You should also check the flags field of the profile header structure CM2Header for copyright information. You can test the cmEmbeddedUseMask bit of the flags field to determine whether the profile can be used independently. If the bit is set, you should use this profile as an embedded profile only and not copy the profile for your own purposes. The cmEmbeddedUseMask mask is described in
if (myCM2Header.flags & cmEmbeddedUseMask)
{
// profile should only be used as an embedded profile
}
else
{
// profile can be used independently
}
A calibration program, for example, might use the CMCopyProfile function to copy a devices original profile, then modify the copy to reflect the current state of the device. Or an application might want to copy a profile after unflattening it.
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 function CMOpenProfile. To create a new profile, use the function CMNewProfile. 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 function CMCloneProfileRef to increment the reference count for the reference each time you reuse it. Calling the CMCloneProfileRef function increments the count; calling the function CMCloseProfile decrements it. The profile remains open as long as the reference count is greater than 0, indicating at least one routine retains a reference to the profile.
Supported in Carbon. Available in Carbon 1.0.2 and later when ColorSync 2.0 or later is present.
© 2000 Apple Computer, Inc. (Last Updated 7/17/2000)