L_ClrSetConversionParams

#include "ltkrn.h"
#include "ltclr.h"

L_LTCLR_API L_INT L_ClrSetConversionParams(ClrHandle, pParams)

Sets new conversion parameters.

Parameters

L_HANDLE ClrHandle

Handle to an existing color conversion. This handle is obtained by calling the L_ClrInit function.

LPCONVERSION_PARAMS pParams

Pointer to a CONVERSION_PARAMS structure, this structure will describe the conversion properties.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

If pParams is NULL, this function will fail. A valid color conversion handle is needed. To check the handle validity, use L_ClrIsValid.

Platforms

Win32, x64.

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

Topics

Example

L_INT ClrSetConversionParamsExample( 
   L_UCHAR* pInput, 
   L_UCHAR* pOutput, 
   L_INT nWidth, 
   L_INT nHeight) 
{ 
   L_INT nRet; 
   HANDLE ClrHandle;         /* color Handle       */ 
   CONVERSION_PARAMS convparams; /* conversion options */ 
 
   /* Conversion with options: 
      The conversion will be done with the options specified in the convparams variable*/ 
   /* set the convparams size */ 
   convparams.uStructSize = sizeof(CONVERSION_PARAMS); 
    
   /* we want to use the built in ICC conversion method and built in conversion */ 
   /* use built in conversion and LEAD ICC Engine*/ 
   convparams.nMethod = USE_BUILTIN | USE_ICC; 
    
   /* set the active conversion method */ 
   convparams.nActiveMethod = USE_BUILTIN; 
    
   /* allocate a D50 white point option */ 
   convparams.pWpoint = (LPWHITEPOINT)malloc(sizeof(WHITEPOINT)); 
    
   /* D50 white point */ 
   convparams.pWpoint->nWhitePoint = CIELAB_D50; 
    
   /* allocate a cmyk option */ 
   convparams.pCmykParams = (LPCMYK_PARAMS)malloc(sizeof(CMYK_PARAMS)); 
   convparams.pCmykParams->uStructSize = sizeof(CMYK_PARAMS); 
   convparams.pCmykParams->nMask = CMYK_GCR; 
    
   /* 17.5 % GCR value */ 
   convparams.pCmykParams->nGcr_level = 175; 
    
   /* initialize the color conversion */ 
   nRet = L_ClrInit(&ClrHandle, CCS_CMYK, CCS_RGB, &convparams); 
   if(nRet != SUCCESS) 
      return nRet; 
    
   /* convert the image buffer */ 
   nRet = L_ClrConvert(ClrHandle, /* conversion handle */ 
      pInput,        /* input buffer      */ 
      pOutput,       /* output buffer     */ 
      nWidth,        /* pixels width      */ 
      nHeight,       /* pixels height     */ 
      0,             /* 0 bytes align     */ 
      0);            /* 0 bytes align     */ 
   if(nRet != SUCCESS) 
      return nRet; 
    
   /* change the active method for conversion */ 
   convparams.nMethod = CHANGE_ACTIVE_METHOD; 
    
   /* switch to ICC conversion method */ 
   convparams.nActiveMethod = USE_ICC; 
    
   /* update the conversion state */ 
   nRet = L_ClrSetConversionParams(ClrHandle, &convparams); 
   if(nRet != SUCCESS) 
      return nRet; 
    
   /* convert the image buffer */ 
   nRet = L_ClrConvert(ClrHandle, /* conversion handle */ 
      pInput,        /* input buffer      */ 
      pOutput,       /* output buffer     */ 
      nWidth,        /* pixels width      */ 
      nHeight,       /* pixels height     */ 
      0,             /* 0 bytes align     */ 
      0);            /* 0 bytes align     */ 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* free the conversion */ 
   nRet = L_ClrFree (ClrHandle); 
 
   /* save the image */ 
   /*...*/ 
    
   free(convparams.pWpoint); 
   free(convparams.pCmykParams); 
 
   return nRet; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Color Conversion C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.