Converts the information of an ICCTAG_CURVE_TYPE structure into one buffer of sequential bytes.
#include "ltwrappr.h"
L_INT LICCProfile::ConvertCurveTypeToBuffer(pData, pIccTagCurveType)
Pointer to a buffer to be updated with the converted information as one buffer of sequential bytes.
Pointer to an ICCTAG_CURVE_TYPE structure that contains the information to be converted into one buffer of sequential data.
| Value | Meaning |
|---|---|
| SUCCESS | The function was successful. |
| < 1 | An error occurred. Refer to Return Codes. |
The pData pointer must be allocated by the user. Its size must be equal to the size in bytes of the structure pointed to by the pIccTagCurveType parameter; otherwise an error may occur and corrupted data will return.
The size of the pData buffer can be calculated as follows: 4 + 4 + 4 + 2 * pIccTagCurveType.Curve.uCurveCount. For more information, refer to the ICC.1:2004-10 specification page 39 in the https://www.color.org/index.xalter website.
This example converts an ICCTAG_CURVE_TYPE structure into a buffer
void FillIccCurveType(ICCTAG_CURVE_TYPE * iccCurveType){LICCProfile ICCProfile;// preparing curve data, it consists of domain and range values// if we have 1 value, it should be of type IccU8Fixed8Number,// and if we have more than 1 value, their type should be IccUInt16Number,// in this example we will use 1 value, look at the VB example for more// than 1 value curve data example// for more information about domain and range values refer to// ICC.1:2004-10 specification page 39.// create the new iccCurveTypeiccCurveType->Curve.uCurveCount = 1;iccCurveType->Curve.pCurveData = (L_IccUInt16Number*) GlobalAlloc(GPTR, sizeof(L_IccUInt16Number));if(iccCurveType->Curve.pCurveData){iccCurveType->Curve.pCurveData[0] = ICCProfile.DoubleToU8Fixed8Number (1.5);}// define the tag baseiccCurveType->tagBase.Signature = CurveTypeSig;}L_INT LICCProfile_ConvertCurveTypeToBufferExample(){L_INT nRet = FAILURE;LICCProfile ICCProfile;ICCTAG_CURVE_TYPE iccCurveType;L_UCHAR* pData = NULL;L_INT nDataSize;// fill the curve type tagmemset(&iccCurveType, 0, sizeof(ICCTAG_CURVE_TYPE));FillIccCurveType(&iccCurveType);// calculate the data sizenDataSize = 4 + 4 + 4 + 2 * iccCurveType.Curve.uCurveCount;// then allocate the destination data pointerpData = (L_UCHAR*) GlobalAlloc(GPTR, nDataSize * sizeof(L_UCHAR));if (pData){// now convert it into buffernRet = ICCProfile.ConvertCurveTypeToBuffer(pData, &iccCurveType);GlobalFree(iccCurveType.Curve.pCurveData);GlobalFree(pData);return nRet;}else{GlobalFree(iccCurveType.Curve.pCurveData);return nRet;}}