L_ClrInit

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

L_LTCLR_API L_INT L_ClrInit(pClrHandle, nSrcFormat, nDstFormat, pParams)

L_HANDLE *pClrHandle;

/* pointer to a color conversion handle */

L_INT nSrcFormat;

/* format of the input data */

L_INT nDstFormat;

/* format of the output data */

LPCONVERSION_PARAMS pParams;

/* pointer to a structure */

Initializes the color conversion engine.

Parameter

Description

pClrHandle

Pointer to a color conversion handle. This handle is needed in the conversion process and for setting the process options.

nSrcFormat

Format of the source data. Possible values are:

 

Value

Meaning

 

CCS_RGB

[0x00] Color space is RGB.

 

CCS_YUV

[0x01] Color space is YUV.

 

CCS_CMYK

[0x02] Color space is CMYK.

 

CCS_HSV

[0x03] Color space is HSV.

 

CCS_HLS

[0x04] Color space is HLS.

 

CCS_YIQ

[0x05] Color space is YIQ.

 

CCS_CMY

[0x06] Color space is CMY.

 

CCS_LAB

[0x07] Color space is CIELAB.

 

CCS_XYZ

[0x08] Color space is CIEXYZ.

 

CCS_YCCK

[0x0B] Color space is YCCK.

 

CCS_YCCK

[0x0B] Color space is YCCK.

 

CCS_BGR

[0x0C] Color space is BGR.

 

CCS_UYVY

[0x0E] Color space is UYVY.

 

CCS_YUY2

[0x09] Color space is YUY2.

 

CCS_YVU9

[0x0A] Color space is YVU9.

 

CCS_YCC

[0x0F] Color space is YCC.

nDstFormat

Format of the output data. Possible values are:

 

Value

Meaning

 

CCS_RGB

[0x00] Color space is RGB.

 

CCS_YUV

[0x01] Color space is YUV.

 

CCS_CMYK

[0x02] Color space is CMYK.

 

CCS_HSV

[0x03] Color space is HSV.

 

CCS_HLS

[0x04] Color space is HLS.

 

CCS_YIQ

[0x05] Color space is YIQ.

 

CCS_CMY

[0x06] Color space is CMY.

 

CCS_LAB

[0x07] Color space is CIELAB.

 

CCS_XYZ

[0x08] Color space is CIEXYZ.

 

CCS_BGR

[0x0C] Color space is BGR.

 

CCS_UYVY

[0x0E] Color space is UYVY.

 

CCS_YUY2

[0x09] Color space is YUY2.

 

CCS_YVU9

[0x0A] Color space is YVU9.

 

CCS_YCC

[0x0F] Color space is YCC.

pParams

Pointer to a CONVERSION_PARAMS structure that contains the conversion properties used in the initialization.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

L_ClrInit must be called before calling any other LEADTOOLS Color Space toolkit functions in case of indirect conversion.

When the handle to the color conversion is no longer needed, it should be freed by calling L_ClrFree. For every call to L_ClrInit there must be a call to L_ClrFree.

If pParams is NULL, the default built in conversion is assumed, and any subsequent calls to L_ClrSetConversionParams will only affect CMYK conversion parameters.

When you choose the conversion method, be sure not to combine the Profiles option (USE_ICC) with the Custom Profiles option (USE_CUSTOM_ICC), or the Emulation Tables method (USE_ET) with the custom Emulation Tables method (USE_CUSTOM_ET).

Supports conversion using ICC Devicelink profiles with option (USE_CUSTOM_ICC) and using it as input profile.

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:

L_ClrConvert, L_ClrFree

Topics:

Initializing a Color Conversion Handle

 

Color Conversion C DLL Function Groups

Example

L_INT ClrInitExample(
   L_UCHAR* pInput,
   L_INT nWidth,
   L_INT nHeight)
{
   L_INT nRet;
   /*Color Handle*/
   HANDLE ClrHandle;
   /*Simple conversion without any options(NULL).
     The conversion will be done with built-in options as the default option */
   /* initialize the color conversion */
   nRet = L_ClrInit(&ClrHandle,
      CCS_CMYK,
      CCS_RGB,
      NULL);
   if(nRet != SUCCESS)
      return nRet;
   /* convert the image buffer */
   nRet = L_ClrConvert(ClrHandle, /* conversion handle */
      pInput,     /* input buffer */
      pInput,     /* 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);
   return nRet;
}