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

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT LColor_InitializeExample() 
{ 
   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); 
   if(nRet !=SUCCESS) 
      return nRet; 
   LBitmapBase LeadBitmap;   /* Bitmap handle to hold the loaded image. */ 
   /* Load the bitmap, keeping the bits per pixel of the file */ 
   nRet = LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), 0, ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
   LBuffer Input(sizeof(L_UCHAR) * (LeadBitmap.GetMemSize())); 
   LeadBitmap.GetRowCol(&Input, 0, 0); 
   L_UCHAR* pInput = (L_UCHAR*)(Input.Lock());     /*input buffer*/ 
   L_INT nWidth = LeadBitmap.GetWidth();           /*pixels width*/ 
   L_INT nHeight = LeadBitmap.GetHeight();         /*pixels height*/ 
   /* convert the image buffer */ 
   nRet = clr.Convert(pInput, pInput, nWidth, nHeight, 0, 0); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* free the conversion */ 
   nRet = clr.Free (); 
   if(nRet !=SUCCESS) 
      return nRet; 
   //free bitmap 
   if(LeadBitmap.IsAllocated()) 
      LeadBitmap.Free(); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Color Conversion C++ Class Library Help