L_ClrSetConversionParams
#include "ltkrn.h"
#include "ltclr.h"
L_INT EXT_FUNCTION L_ClrSetConversionParams(ClrHandle, pParams)
HANDLE ClrHandle; |
/* handle to the color conversion */ |
LPCONVERSION_PARAMS pParams; |
/* pointer to a structure */ |
Sets new conversion parameters.
Parameter |
Description |
ClrHandle |
Handle to an existing color conversion. This handle is obtained by calling the L_ClrInit function. |
pParams |
Pointer to a CONVERSION_PARAMS structure, this structure will describe the conversion properties. |
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 handle is needed. To check the handle validity, use L_ClrIsValid.
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_VOID ConvertCMYKToRGB(L_UCHAR *pInput, L_UCHAR *pOutput, L_INT nWidth)
{
HANDLE ClrHandle /*Color Handle*/;
CONVERSION_PARAMS params /*conversion options*/;
L_UCHAR *input_buffer /* input buffer */,
*output_buffer; /* output buffer */
L_INT height , width/* the number of pixels to convert */;
/*
Conversion with options.
The conversion will be done with the options specified in the params variable
*/
/* set the params size */
params.uStructSize = sizeof(CONVERSION_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 */
L_ClrInit(&ClrHandle,
CCS_CMYK,
CCS_RGB,
NULL);
/* convert the image buffer */
L_ClrConvert(ClrHandle, /* conversion handle */
input_buffer, /* input buffer */
output_buffer, /* 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 */
L_ClrSetConversionParams(ClrHandle, ¶ms);
/* convert the image buffer */
L_ClrConvert(ClrHandle, /* conversion handle */
input_buffer, /* input buffer */
output_buffer, /* output buffer */
width, /*pixels width*/
height, /*pixels height*/
0, /* 0 bytes align*/
0); /*0 bytes align*/
/* free the conversion */
L_ClrFree (ClrHandle);
/* save the image */
/*...*/
free(params.pWpoint);
free(params.pCmykParams);
}