LColor::ConvertToBitmap

#include "ltwrappr.h"

L_INT LColor::ConvertToBitmap(pSrcBuf, pBitmap, uStructSize, nWidth, nHeight, nInAlign, nOutAlign);

L_UCHAR * pSrcBuf;

pointer to the input buffer

LBitmapBase * pBitmap;

pointer to LBitmapBase class object

L_UINT uStructSize;

size, in bytes of pBitmap

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

Converts image data in a buffer from one color conversion model to RGB\BGR, and sets the converted data in a LBitmapBase class object.

Parameter

Description

pSrcBuf

Pointer to the buffer that references the input data.

pBitmap

Pointer to LBitmapBase class object that references the converted data.

uStructSize

Size in bytes, of the structure pointed to by pBitmap, for versioning. Use sizeof(BITMAPHANDLE).

nWidth

Width of pixels to be processed.

nHeight

Height of pixels to be processed.

nInAlign

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

nOutAlign

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

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Conversion is done by setting the nActiveMethod value of the CONVERSION_PARAMS structure when calling LColor::Initialize. To change the nActiveMethod value, use LColor::SetConversionParams. Only methods supported by the initialized converter should be specified.

The conversion is done if it was initialized with BGR or RGB Color Spaces as the destination.

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

Topics:

Conversion Process

 

Raster Image Functions: Color Conversion

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT LColor_ConvertToBitmapExample() 
{ 
   L_INT nRet; 
   LColor lClr; 
   LBitmapBase LeadBitmap;   /* Bitmap handle to hold the loaded image. */ 
   LBitmapBase OutBitmap; 
   /* 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*/ 
   /* direct conversion using built in options */ 
   nRet = lClr.ConvertToBitmap(pInput, &OutBitmap, sizeof(BITMAPHANDLE), nWidth, nHeight, 0, 0); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet = OutBitmap.Save (MAKE_IMAGE_PATH(TEXT("Result.BMP")), FILE_BMP, 24, 0, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   //free bitmap 
   if(LeadBitmap.IsAllocated()) 
      LeadBitmap.Free(); 
   if(OutBitmap.IsAllocated()) 
      OutBitmap.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