LICCProfile::ConvertCurveTypeToBuffer
#include "ltwrappr.h"
L_INT LICCProfile::ConvertCurveTypeToBuffer(pData, pIccTagCurveType)
L_UCHAR * pData; |
/* pointer to a buffer */ |
pICCTAG_CURVE_TYPE pIccTagCurveType; |
/* pointer to a structure */ |
Converts the information of an ICCTAG_CURVE_TYPE structure into one buffer of sequential bytes.
Parameter |
Description |
pData |
Pointer to a buffer to be updated with the converted information as one buffer of sequential bytes. |
pIccTagCurveType |
Pointer to an ICCTAG_CURVE_TYPE structure that contains the information to be converted into one buffer of sequential data. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
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 www.color.org website.
Required DLLs and Libraries
LTCLR For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Example
void CICCProfileDlg::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 iccCurveType
iccCurveType->Curve.uCurveCount = 1;
iccCurveType->Curve.pCurveData = (L_IccUInt16Number*) GlobalAllocPtr(GHND, sizeof(L_IccUInt16Number));
if(iccCurveType->Curve.pCurveData)
{
iccCurveType->Curve.pCurveData[0] = ICCProfile.DoubleToU8Fixed8Number (1.5);
}
// define the tag base
iccCurveType->tagBase.Signature = CurveTypeSig;
}
/* This example converts an ICCTAG_CURVE_TYPE structure into a buffer */
void CICCProfileDlg::OnConvertCurveTypeToBuffer()
{
LICCProfile ICCProfile;
ICCTAG_CURVE_TYPE iccCurveType;
L_UCHAR * pData = NULL;
L_INT nDataSize;
// fill the curve type tag
memset(&iccCurveType, 0, sizeof(ICCTAG_CURVE_TYPE));
FillIccCurveType(&iccCurveType);
// calculate the data size
nDataSize = 4 + 4 + 4 + 2 * iccCurveType.Curve.uCurveCount;
// then allocate the destination data pointer
pData = (L_UCHAR *) GlobalAllocPtr(GHND, nDataSize * sizeof(L_UCHAR));
if (pData)
{
int nRet = 0;
// now convert it into buffer
nRet = ICCProfile.ConvertCurveTypeToBuffer(pData, &iccCurveType);
}
}