Converts the information in an ICCTAG_PARAMETRIC_CURVE_TYPE structure into one buffer of sequential bytes.
#include "ltwrappr.h"
L_INT LICCProfile::ConvertParametricCurveTypeToBuffer(pData, pIccTagParametricCurveType)
Pointer to a buffer to be updated with the converted information as one buffer of sequential bytes.
Pointer to an ICCTAG_PARAMETRIC_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 pIccTagParametricCurveType parameter; otherwise an error may occur and corrupted data will return.
The size of pData buffer can be calculated as follows: 4 + 4 + 2 + 2 + 4 * number of parameters retrieved by calling the LICCProfile::GetParametricCurveNumberOfParameters function. For more information, refer to the ICC.1:2004-10 specification page 56 in the https://www.color.org/index.xalter website.
This example converts an ICCTAG_PARAMETRIC_CURVE_TYPE structure into a buffer
void FillIccParametricCurveType(ICCTAG_PARAMETRIC_CURVE_TYPE * piccParametricCurveType)
{
LICCProfile ICCProfile;
// get the number of parameters for our function
L_INT numOfParameters = ICCProfile.GetParametricCurveNumberOfParameters (Func4Bytes);
// create the IccParametricCurve class
piccParametricCurveType->ParametricCurve.uFunctionType = Func4Bytes;
// since we know that we will have 1 parameter for our function,
// we will fill it directly, define the function parameters
piccParametricCurveType->ParametricCurve.pParameters = (L_INT *)GlobalAlloc(GPTR, numOfParameters * sizeof(L_INT));
piccParametricCurveType->ParametricCurve.pParameters [0] = (int) LICCProfile::ConvertDoubleTo2bFixed2bNumber(5.0);
// define the tag base
piccParametricCurveType->tagBase.Signature = ParametricCurveTypeSig;
}
L_INT LICCProfile_ConvertParametricCurveTypeToBufferExample()
{
L_INT nRet = FAILURE;
LICCProfile ICCProfile;
/* This example converts an ICCTAG_CURVE_TYPE structure into a buffer */
ICCTAG_PARAMETRIC_CURVE_TYPE iccParametricCurveType;
L_UCHAR * pData;
L_INT nDataSize;
// fill the parametric curve type tag
memset(&iccParametricCurveType, 0 ,sizeof(ICCTAG_PARAMETRIC_CURVE_TYPE));
FillIccParametricCurveType(&iccParametricCurveType);
// calculate the data size
nDataSize = 4 + 4 + 2 + 2 + 4 * ICCProfile.GetParametricCurveNumberOfParameters ((ICCFUNCTIONTYPE)iccParametricCurveType.ParametricCurve.uFunctionType);
// then allocate the destination data pointer
pData = (L_UCHAR *) GlobalAlloc(GPTR, nDataSize * sizeof(L_UCHAR));
if (pData == NULL)
{
GlobalFree(iccParametricCurveType.ParametricCurve.pParameters);
return nRet;
}
else
{
// now convert it into buffer
nRet = ICCProfile.ConvertParametricCurveTypeToBuffer(pData, &iccParametricCurveType);
GlobalFree(iccParametricCurveType.ParametricCurve.pParameters);
GlobalFree(pData);
return nRet;
}
}