LColor::ConvertDirect

Summary

Converts image data in a buffer from one color conversion model to another directly using built in algorithms.

Syntax

#include "ltwrappr.h"

static L_INT LColor::ConvertDirect(nSrcFormat, nDstFormat, pSrcBuf, pDstBuf, nWidth, nHeight, nInAlign, nOutAlign)

Parameters

L_INT nSrcFormat

Format of the source data. Possible values are:

Value Meaning
CCS_RGB [0x00] Color conversion is RGB.
CCS_YUV [0x01] Color conversion is YUV.
CCS_CMYK [0x02] Color conversion is CMYK.
CCS_HSV [0x03] Color conversion is HSV.
CCS_HLS [0x04] Color conversion is HLS.
CCS_YIQ [0x05] Color conversion is YIQ.
CCS_CMY [0x06] Color conversion is CMY.
CCS_LAB [0x07] Color conversion is CIELAB.
CCS_XYZ [0x08] Color conversion is CIEXYZ.
CCS_YCCK [0x0B] Color conversion is YCCK.
CCS_BGR [0x0C] Color conversion is BGR.
CCS_UYVY [0x0E] Color conversion is UYVY.
CCS_YUY2 [0x09] Color conversion is YUY2.
CCS_YVU9 [0x0A] Color conversion is YVU9.
CCS_Y41P [0x0D] Color conversion is Y41P.
CCS_IHS [0x80] Color conversion is IHS.
CCS_ARGB4 [0x90] Color conversion is ARGB4.
CCS_YCC [0x0F] Color conversion is YCC.

L_INT nDstFormat

Format of the output data. Possible values are:

Value Meaning
CCS_RGB [0x00] Color conversion is RGB.
CCS_YUV [0x01] Color conversion is YUV.
CCS_CMYK [0x02] Color conversion is CMYK.
CCS_HSV [0x03] Color conversion is HSV.
CCS_HLS [0x04] Color conversion is HLS.
CCS_YIQ [0x05] Color conversion is YIQ.
CCS_CMY [0x06] Color conversion is CMY.
CCS_LAB [0x07] Color conversion is CIELAB.
CCS_XYZ [0x08] Color conversion is CIEXYZ.
CCS_YCCK [0x0B] Color conversion is YCCK.
CCS_BGR [0x0C] Color conversion is BGR.
CCS_UYVY [0x0E] Color conversion is UYVY.
CCS_YUY2 [0x09] Color conversion is YUY2.
CCS_YVU9 [0x0A] Color conversion is YVU9.
CCS_Y41P [0x0D] Color conversion is Y41P.
CCS_IHS [0x80] Color conversion is IHS.
CCS_ARGB4 [0x90] Color conversion is ARGB4.
CCS_YCC [0x0F] Color conversion is YCC.

L_UCHAR * pSrcBuf

Pointer to the buffer that references the input data.

L_UCHAR * pDstBuf

Pointer to the buffer to be updated with the converted data.

L_INT nWidth

Width of pixels to be processed.

L_INT nHeight

Height of pixels to be processed.

L_INT nInAlign

Each scanline in the input buffer is a multiple of nInAlign bytes.

L_INT nOutAlign

Each scanline in the output buffer is a multiple of nOutAlign bytes.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

Converting from any color space to YCCK color space is currently not supported.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT LColor_ConvertDirectExample() 
{ 
   L_INT nRet;  
   LColor lClr; 
   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())); 
   LBuffer Output(sizeof(L_UCHAR) * (LeadBitmap.GetMemSize())); 
 
   LeadBitmap.GetRowCol(&Input, 0, 0); 
 
   L_UCHAR* pInput = (L_UCHAR*)(Input.Lock());     /*input buffer*/ 
   L_UCHAR* pOutput= (L_UCHAR*)(Output.Lock());    /*output buffer*/ 
   L_INT nWidth = LeadBitmap.GetWidth();           /*pixels width*/ 
   L_INT nHeight = LeadBitmap.GetHeight();         /*pixels height*/ 
 
   /* direct conversion using built in options */ 
   nRet = lClr.ConvertDirect(CCS_CMYK, CCS_RGB, pInput, pOutput, nWidth, nHeight, 0, 0); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   //free bitmap  
   if(LeadBitmap.IsAllocated())   
      LeadBitmap.Free(); 
 
   return SUCCESS; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Color Conversion C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.