LBitmap::GrayScaleToDuotone

#include "ltwrappr.h"

virtual L_INT LBitmap::GrayScaleToDuotone (pNewColor, crColor, uFlags)

Converts the grayscale bitmap into a colored one by mixing or replacing the original values of the pixels with new colors.

Parameters

LPRGBQUAD pNewColor

Pointer to an RGBQUAD structure that specifies an array of colors that will be mixed with the original gray values. If this parameter is set to NULL, the crColor parameter must contain a valid color. Pass NULL when you want the function to create the array of colors, two colors when replacing both colors in a binary image, or 256 colors when using a custom array of colors.

COLORREF crColor

An RGB color that will be used to create an array of colors internally. This parameter is used when the pNewColor structure is set to NULL. This parameter is ignored if the pNewColor value is something other than NULL.

L_UINT uFlags

Flag that indicates whether colors will be mixed or replaced.  Possible values are:

Value Meaning
DT_MIX [0x0000] Mix the old colors with the new ones
DT_REPLACE [0x0001] Replace the old colors with the new ones

Returns

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

Comments

This function was designed for use with grayscale bitmaps. If the bitmap being used is not grayscale, this function only affects those pixels or areas of the bitmap where Red=Green=Blue.

This function transforms the 8-bit grayscale bitmaps into colored 8-bit bitmaps (Palette) meanwhile the 12-bit and 16-bit grayscale bitmaps are transformed into a 48-bit colored bitmap.

Monotone conversion is possible by setting uFlags to DT_REPLACE, which clears the palette.

This function gives you the option of having the toolkit generate the array of colors to use or creating the array of colors to use yourself.

To have the toolkit generate the array of colors:

Pass the color to use for generating the array of gradient colors in the crColor parameter.

To use a user-defined array of colors:

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example loads a bitmap and converts it to a Duotone.

L_INT LBitmap__GrayScaleToDuotoneExample(LAnimationWindow * LAniWnd)  
{ 
   L_INT nRet; 
   COLORREF crColor;                  /* New Color */ 
 
  /* Change the bitmap to grayscale bitmap */ 
   nRet =LAniWnd->GrayScale ( 8); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   /* The new color is Red */ 
   crColor = RGB(255, 0, 0);  
 
   /* Apply duotone conversion*/ 
   nRet =LAniWnd->GrayScaleToDuotone(NULL, crColor,  DT_REPLACE); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 

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

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