LBitmap::GrayScaleExt

#include "ltwrappr.h"

virtual L_INT LBitmap::GrayScaleExt(RedFact, GreenFact, BlueFact, uFlags = 0)

L_INT RedFact;

the red factor

L_INT GreenFact;

the green factor

L_INT BlueFact;

the blue factor

L_UINT32 uFlags;

flags

Converts any Bitmap to a gray scale bitmap without changing its resolution.

Parameter

Description

RedFact

Value that represents the percentage or weight given to the red value of each pixel in the bitmap. Possible values are 0 to 1000.

GreenFact

Value that represents the percentage or weight given to the green value of each pixel in the bitmap. Possible values are 0 to 1000.

BlueFact

Value that represents the percentage or weight given to the blue value of each pixel in the bitmap. Possible values are 0 to 1000.

uFlags

Reserved for future use. Must be 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The summation (RedFact + GreenFact + BlueFact) must equal 1000. (Internally, the values are divided by 1000.)

For each pixel in the bitmap the red, green and blue values are modified by the RedFact, GreenFact and BlueFact parameters, respectively. This allows the user to give more weight to one color, essentially enhancing that color, before the pixel is converted to grayscale.

For example, if this function is called with the RedFact set to 500, the GreenFact set to 250 and the BlueFact set to 250, the red value of each pixel will get 50% of the weight when determining the grayscale value. The green value will get 25% of the weight and the blue value will get 25% of the weight when determining the grayscale value. This highlights or enhances the red in the bitmap, prior to conversion to grayscale.

This function supports 48 and 64-bit color images.

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

Required DLLs and Libraries

LTDIS
LTFIL
LTIMGCLR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

LBitmapBase::GrayScale, LBitmapBase::IsGrayScale, LBitmap::ConvertToColoredGray, LBitmap::BalanceColors, LBitmap::SwapColors, Class Members

Topics:

Raster Image Functions: Doing Color Expansion or Reduction

 

Grayscale Images

 

Color Halftones and Halftone Images

 

Raster Image Functions: Working with Color Halftones, Halftones, and Grayscale Images

Example

L_INT LBitmap__GrayScaleExtExample(LBitmap & Bitmap, L_TCHAR * szFileName) 
{ 
   L_INT nRet; 
 
   nRet =Bitmap.Load(szFileName); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   nRet =Bitmap.GrayScaleExt(100, 300, 600); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 20.0.2020.4.5
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help