LICCProfile::ConvertCLUTToBuffer

#include "ltwrappr.h"

L_INT LICCProfile::ConvertCLUTToBuffer(pData, pIccCLUT, nPrecision, nDataSize)

L_UCHAR * pData;

pointer to a buffer

L_VOID * pIccCLUT;

pointer to a structure

L_INT nPrecision;

precision of the data

L_SSIZE_T nDataSize;

size of the data

Converts the information in an ICC_CLUT8 or ICC_CLUT16 structure into one buffer of sequential data.

Parameter Description
pData Pointer to a buffer to be updated with the converted information as one buffer of sequential bytes.
pIccCLUT Pointer to an ICC_CLUT8 or ICC_CLUT16 structure that contains the information to be converted into one buffer of sequential data.
nPrecision Value that represents the number of bytes for each element of the data pointed to by pData member of the pIccCLUT parameter. Possible values are:
  Value Meaning
  1 Used if the pIccCLUT parameter is of ICC_CLUT8 structure.
  2 Used if the pIccCLUT parameter is of ICC_CLUT16 structure.
nDataSize Size in bytes, of the structure pointed to by pIccCLUT, for versioning. Use either sizeof(ICC_CLUT8) or sizeof(ICC_CLUT16).

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 pIccCLUT parameter; otherwise an error may occur and corrupted data will return.

The size of pData buffer can be calculated as follows: 16 + 1 + 3 + nDataSize. For more information on how to calculate the nDataSize, refer to the ICC.1:2004-10 specification pages 48 or 51 in the http://www.color.org/index.xalter 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

Functions:

LICCProfile::InitHeader, LICCProfile::Initialize, LICCProfile::SetCMMType, LICCProfile::SetColorSpace, LICCProfile::SetConnectionSpace, LICCProfile::SetCreator, LICCProfile::SetDateTime, LICCProfile::SetDeviceAttributes, LICCProfile::SetDeviceClass, LICCProfile::SetDevManufacturer, LICCProfile::SetDevModel, LICCProfile::SetFlags, LICCProfile::SetPrimaryPlatform, LICCProfile::SetRenderingIntent, LICCProfile::Convert2bFixed2bNumberToDouble, LICCProfile::CreateTagData, LICCProfile::DeleteTag, LICCProfile::ConvertDoubleTo2bFixed2bNumber, LICCProfile::FreeTagType, LICCProfile::GenerateFile, LICCProfile::GeneratePointer, LICCProfile::GetTagData, LICCProfile::GetTagTypeSig, LICCProfile::Save, LICCProfile::SetTagData, LICCProfile::Fill, LICCProfile::Load, LICCProfile::Free, LICCProfile::GetParametricCurveNumberOfParameters, LICCProfile::DoubleToU8Fixed8Number, LICCProfile::U8Fixed8NumberToDouble, LICCProfile::ConvertCurveTypeToBuffer, LICCProfile::ConvertParametricCurveTypeToBuffer, LICCProfile::SetProfileId, LICCProfile::GetParametricCurveNumberOfParameters, Class Members

Topics:

Using ICC Profile Functions

 

ICC Profile Functions: Tags

 

ICC Profile Functions: Creating an ICC Profile

Example

This example fills an ICC_CLUT16 structure and then converts it into a buffer

L_INT LICCProfile_ConvertCLUTToBufferExample() 
{ 
   LICCProfile ICCProfile; 
   L_UCHAR * dstBuffer; 
   ICC_CLUT16 iccCLUT16; 
   L_INT nCntr, nRet = FAILURE; 
   L_SSIZE_T nDataSize; 
   memset(&iccCLUT16, 0, sizeof(ICC_CLUT16)); 
   // each data element in 
   // the pData pointer is 2 bytes in size 
   iccCLUT16.uPrecision = 2; 
   // the number of items in the grid points array is 
   // the number of input channels. If assume that 
   // the number of channels is 2 
   iccCLUT16.NumOfGridPoints[0] = 0; 
   iccCLUT16.NumOfGridPoints[1] = 1; 
   // the size of the data buffer is 
   // all the data in the NumOfGridPoints array, multiplied by 
   // the number of output channels, multiplied by the precision 
   nDataSize = 1; 
   for (nCntr = 0; nCntr < 2; nCntr++) 
   nDataSize = iccCLUT16.NumOfGridPoints[nCntr]; 
   // assume 3 output channels 
   nDataSize *= 3 * iccCLUT16.uPrecision; 
   // allocate the data pointer 
   iccCLUT16.pData = (L_IccUInt16Number *) GlobalAlloc(GHND, nDataSize *sizeof(L_IccUInt16Number)); 
   if (iccCLUT16.pData == NULL) 
      return FAILURE; 
   // fill it with the needed information. For example, to clear it 
   memset(iccCLUT16.pData, 0, nDataSize); 
   // then add the byte count for the NumOfGridPoints and Precision and Pad bytes 
   nDataSize += 16 + 1 + 3; 
   // now allocate the destination buffer 
   dstBuffer = (L_UCHAR *) GlobalAlloc(GHND, nDataSize * sizeof(L_UCHAR)); 
   if (dstBuffer == NULL) 
   { 
      GlobalFree(iccCLUT16.pData); 
      return nRet; 
   } 
   // after that call the conversion function 
   nRet = ICCProfile.ConvertCLUTToBuffer(dstBuffer, (L_VOID *) &iccCLUT16, iccCLUT16.uPrecision, nDataSize); 
   GlobalFree(iccCLUT16.pData); 
   GlobalFree(dstBuffer); 
   return nRet; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Color Conversion C++ Class Library Help