LICCProfile::ConvertCurveTypeToBuffer

#include "ltwrappr.h"

L_INT LICCProfile::ConvertCurveTypeToBuffer(pData, pIccTagCurveType)

Converts the information of an ICCTAG_CURVE_TYPE structure into one buffer of sequential bytes.

Parameters

L_UCHAR * pData

Pointer to a buffer to be updated with the converted information as one buffer of sequential bytes.

pICCTAG_CURVE_TYPE pIccTagCurveType

Pointer to an ICCTAG_CURVE_TYPE structure that contains the information to be converted into one buffer of sequential data.

Returns

Value Meaning
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 http://www.color.org/index.xalter website.

Required DLLs and Libraries

See Also

Functions

Topics

Example

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 iccCurveType 
    
   iccCurveType->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 base 
   iccCurveType->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 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*) GlobalAlloc(GPTR, nDataSize * sizeof(L_UCHAR));  
   if (pData)  
   { 
      // now convert it into buffer 
      nRet = ICCProfile.ConvertCurveTypeToBuffer(pData, &iccCurveType); 
      GlobalFree(iccCurveType.Curve.pCurveData); 
      GlobalFree(pData); 
      return nRet; 
 
   } 
   else 
   { 
      GlobalFree(iccCurveType.Curve.pCurveData); 
      return nRet; 
   } 
} 

Help Version 20.0.2019.9.23
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Color Conversion C++ Class Library Help