LColor::SetConversionParams

#include "ltwrappr.h"

L_INT LColor::SetConversionParams(pParams);

LPCONVERSION_PARAMS pParams;

/* pointer to a structure */

Sets new conversion parameters.

Parameter

Description

pParams

Pointer to a CONVERSION_PARAMS structure that specifies the conversion parameters to set.

Returns

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 class object is needed. To check the object validity, use LColor::IsValid.

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:

LColor::Convert, LColor::Free, LColor::Initialize, Class Members

Topics:

Conversion Process

 

Raster Image Functions: Color Conversion

Example

L_VOID ConvertCMYKToRGB(L_UCHAR *pInput, L_UCHAR *pOutput,L_INT height,L_INT width) 
{
   L_INT nRet = 0 ; 
   LColor clr; /*Color Conversion object*/
   CONVERSION_PARAMS params;   /*conversion options*/
   /* Conversion with options. The conversion will be done with the options specified in the params variable*/
   memset(&params,0,sizeof(params)); 
   /* set the params size */
   params.uStructSize = sizeof(params); 
   /* we want to use the built in ICC conversion method and built in conversion */
   params.nMethod = USE_BUILTIN | USE_ICC /* use built in conversion and LEAD ICC Engine*/;
   /* set the active conversion method */
   params.nActiveMethod = USE_BUILTIN; 
   /* allocate a D50 white point option */
   params.pWpoint = (LPWHITEPOINT)malloc(sizeof(WHITEPOINT)); 
   params.pWpoint->nWhitePoint = CIELAB_D50; /* D50 white point */
   /* allocate a cmyk option */
   params.pCmykParams = (LPCMYK_PARAMS)malloc(sizeof(CMYK_PARAMS)); 
   params.pCmykParams->uStructSize = sizeof(CMYK_PARAMS); 
   params.pCmykParams->nMask = CMYK_GCR; 
   params.pCmykParams->nGcr_level = 175; /* 17.5 % GCR value */

   /* initialize the color conversion */
   nRet = clr.Initialize (CCS_CMYK,CCS_RGB,NULL); 
   /* convert the image buffer */
   nRet = clr.Convert (pInput, /* input buffer */
                        pOutput, /* output buffer */
                        width, /*pixels width*/
                        height, /*pixels height*/
                        0, /* 0 bytes align*/
                        0); /*0 bytes align*/

   /* change the active method for conversion */
   params.nMethod = CHANGE_ACTIVE_METHOD; 
   /* switch to ICC conversion method */
   params.nActiveMethod = USE_ICC; 

   /* update the conversion state */
   nRet = clr.SetConversionParams(&params); 
   /* convert the image buffer */
   nRet = clr.Convert (pInput, /* input buffer */
               pOutput, /* output buffer */
               width, /*pixels width*/
               height, /*pixels height*/
               0, /* 0 bytes align*/
               0); /*0 bytes align*/
   /* free the conversion */
   nRet = clr.Free ();
   
   /* save the image */
   /*...*/
   
   free(params.pWpoint); 
   free(params.pCmykParams); 
}