Important: The information in this document is obsolete and should not be used for new development.
CMGetProfileElement
Obtains element data from the specified profile based on the specified element tag signature.
pascal CMError CMGetProfileElement ( CMProfileRef prof, OSType tag, unsigned long *elementSize, void *elementData);
prof- A profile reference (page 3-63) to the profile containing the target element.
tag- The tag signature for the element in question. The tag identifies the element. For a complete list of the public tag signatures a profile may contain, including a description of each tag, refer to the International Color Consortium Profile Format Specification. The signatures for profile tags are defined in the
CMICCProfile.hheader file.elementSize- A pointer to a size value. On input, you specify the size of the element data to copy. Specify
NULLto copy the entire element data. To obtain a portion of the element data, specify the number of bytes to copy.- On output, the size of the data returned.
elementData- A pointer to memory for element data. On input, you allocate memory. On output, this buffer holds the element data.
- To obtain the element size in the
elementSizeparameter without copying the element data to this buffer, specifyNULLfor this parameter.- function result
- A result code of type CMError. See "Result Codes" (page 3-174) for a list of ColorSync-specific result codes.
DISCUSSION
Before you call theCMGetProfileElementfunction to obtain the element data for a specific element, you must know the size in bytes of the element data so you can allocate a buffer to hold the returned data.The
CMGetProfileElementfunction serves two purposes: to get an element's size and to obtain an element's data. In both instances, you provide a reference to the profile containing the element in theprofparameter and the tag signature of the element in thetagparameter.To obtain the element data size, call the
CMGetProfileElementfunction specifying a pointer to an unsigned long data type in theelementSizefield and aNULLvalue in theelementDatafield.After you obtain the element size, you should allocate a buffer large enough to hold the returned element data, then call the
CMGetProfileElementfunction again, specifyingNULLin theelementSizeparameter to copy the entire element data and a pointer to the data buffer in theelementDataparameter.To copy only a portion of the element data beginning from the first byte, allocate a buffer the size of the number of bytes of element data you want to obtain and specify the number of bytes to copy in the
elementSizeparameter. In this case, on output theelementSizeparameter contains the size in bytes of the element data actually returned.SEE ALSO
You cannot use theCMGetProfileElementfunction to copy a portion of element data beginning from an offset into the data. To copy a portion of the element data beginning from any offset, use theCMGetPartialProfileElementfunction (page 3-90).You cannot use this function to obtain a portion of a profile element in the
CM2Headerprofile header. Instead, you must call theCMGetProfileHeaderfunction (page 3-88) to copy the profile header and read its contents.