LColor::Initialize

#include "ltwrappr.h"

L_INT LColor::Initialize(nSrcFormat, nDstFormat, pParams);

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

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_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.

 

CCS_Y41P

[0x0D] Color space is Y41P.

 

CCS_IHS

[0x80] Color space is IHS.

 

CCS_ARGB4

[0x90] Color space is ARGB4444.

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_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.

 

CCS_Y41P

[0x0D] Color space is Y41P.

 

CCS_IHS

[0x80] Color space is IHS.

 

CCS_ARGB4

[0x90] Color space is ARGB4444.

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

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

When the color conversion class object is no longer needed, it should be freed by calling LColor::Free. For every call to LColor::Initialize there must be a call to LColor::Free.

If pParams is NULL, the default built in conversion is assumed, and any subsequent calls to LColor::SetConversionParams 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).

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, Class Members

Topics:

Initializing a Color Conversion class object

 

Raster Image Functions: Color Conversion

Example

L_VOID ConvertCMYKToRGB(L_UCHAR * pInput, L_UCHAR *pOutput, L_INT nWidth, L_INT nHeight)
{
   L_INT nRet = 0 ; 
   LColor clr /*Color Conversion class object*/;
   /* Simple conversion without any options(NULL). The conversion will be done with built-in options as the default option*/
   /* initialize the color conversion object*/
   nRet = clr.Initialize(CCS_CMYK,CCS_RGB,NULL); 
   /* convert the image buffer */
   nRet = clr.Convert (pInput, /* input buffer */
      pInput, /* output buffer */
      nWidth, /*pixels width*/
      nHeight, /*pixels height*/
      0, /* 0 bytes align*/
      0); /*0 bytes align*/
   /* free the conversion */
   nRet = clr.Free ();
}