Important: The information in this document is obsolete and should not be used for new development.
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 specifycmNoProfileBase
as the kind of profile in the profile location structure or specifyNULL
for this parameter. To specify the location, you use theCMProfileLocation
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
TheCMCopyProfile
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 callingCMUpdateProfile
, those changes are included in the duplicated profile. They are not saved to the original profile unless you callCMUpdateProfile
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 tofalse
.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 theflags
field of theCMProfileHeader
(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 theCMOpenProfile
function (page 3-69). To create a new profile, use theCMNewProfile
function (page 3-75). As an alternative to using theCMCopyProfile
function to duplicate an entire profile, you can use the same profile reference more than once. To do so, you call theCMCloneProfileRef
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 theCMCloseProfile
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.