L_ClrConvertToBitmap

Summary

Converts image data in a buffer from one color conversion model to RGB\BGR, and sets it as a LEAD bitmap.

Syntax

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

L_LTCLR_API L_INT L_ClrConvertToBitmap(ClrHandle, pSrcBuf, pBitmap, uStructSize, nWidth, nHeight, nInAlign, nOutAlign)

Parameters

L_HANDLE ClrHandle

Handle to an existing color conversion. This handle is obtained by calling the L_ClrInit function.

L_UCHAR * pSrcBuf

Pointer to the buffer holding the input data.

pBITMAPHANDLE pBitmap

Pointer to the buffer that will hold the converted data bitmap.

L_UINT uStructSize

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

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

Conversion is done by setting the active method value specified in the CONVERSION_PARAMS structure when calling L_ClrInit. To change the active method, use L_ClrSetConversionParams. 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.

Platforms

Win32, x64.

Required DLLs and Libraries

See Also

Functions

Topics

Example

This example converts a CMYK bitmap buffer into RGB bitmap.

L_INT ClrConvertToBitmapExample( 
   L_UCHAR* pInput, 
   pBITMAPHANDLE pBitmap, 
   L_INT nWidth, 
   L_INT nHeight) 
{ 
   L_INT nRet; 
 
   /* Color Handle */ 
   HANDLE ClrHandle = NULL; 
 
   /* initialize the color conversion */ 
   nRet = L_ClrInit(&ClrHandle, CCS_CMYK, CCS_RGB, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* convert the image buffer */ 
   nRet = L_ClrConvertToBitmap(ClrHandle, pInput, pBitmap, sizeof(BITMAPHANDLE), nWidth, nHeight, 0, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* free the conversion */ 
   nRet = L_ClrFree(ClrHandle); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 

Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

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