CMGetIndProfileElement
Obtains the element data corresponding to a particular index from the specified profile.
Declaration
CMError CMGetIndProfileElement (
CMProfileRef prof,
UInt32 index,
UInt32 *elementSize,
void *elementData
);Parameters
- prof:
A profile reference of type Cmprofileref to the profile containing the element.
- index:
The index of the element whose data you want to obtain. This is a one-based element index within the range returned as the
elementCountparameter of theCMCountProfileElementsfunction. - elementSize:
A pointer to an element data size. On input, specify the size of the element data to copy (except when
elementDatais set toNULL). SpecifyNULLto copy the entire element data. To obtain a portion of the element data, specify the number of bytes to be copy.On return, the size of the element data actually copied.
- elementData:
A pointer to memory for element data. On input, you allocate memory. On return, 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.
Return Value
A CMError value. See Result Codes.
Overview
Before you call the CMGetIndProfileElement function to obtain the element data for an element at a specific index, you first determine the size in bytes of the element data. To determine the data size, you can
call the function CMGetIndProfileElementInfo, passing the element’s index
call the
CMGetIndProfileElementfunction itself, specifying a pointer to an unsigned long data type in theelementSizefield and aNULLvalue in theelementDatafield
Once you have determined the size of the element data, you allocate a buffer to hold as much of the data as you need. If you want all of the element data, you specify NULL in the elementSize parameter. If you want only a portion of the element data, you specify the number of bytes you want in the elementSize parameter. You supply a pointer to the data buffer in the elementData parameter. After calling CMGetIndProfileElement, the elementSize parameter contains the size in bytes of the element data actually copied.
Before calling this function, you should call the function CMCountProfileElements. It returns the profile’s total element count in the elementCount parameter.