LBitmap::BalanceColors

#include "ltwrappr.h"

virtual L_INT LBitmap::BalanceColors(pRedFact, pGreenFact, pBlueFact, uFlags = 0)

BALANCING * pRedFact;

pointer to a structure

BALANCING * pGreenFact;

pointer to a structure

BALANCING * pBlueFact;

pointer to a structure

L_UINT32 uFlags;

flags

Redistributes the RGB values of the specified bitmap, using the values stored in the specified structures.

Parameter

Description

pRedFact

Pointer to a BALANCING structure that contains the values to use for redistributing the bitmap's red values.

pGreenFact

Pointer to a BALANCING structure that contains the values to use for redistributing the bitmap's green values.

pBlueFact

Pointer to a BALANCING structure that contains the values to use for redistributing the bitmap's blue values.

uFlags

Reserved for future use. Must be 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

For each pixel in the class object's bitmap, the red value is modified using the values pointed to by pRedFact. This generates an intermediate red value, an intermediate green value and an intermediate blue value.

For each pixel in the class object's bitmap the green value is modified using the values pointed to by pGreenFact. This generates an intermediate red value, an intermediate green value and an intermediate blue value.

For each pixel in the class object's bitmap the blue value is modified using the values pointed to by pBlueFact. This generates an intermediate red value, an intermediate green value and an intermediate blue value.

The intermediate red values are added to generate the new red value for the pixel. The intermediate green values are added to generate the new green value for the pixel and the intermediate blue values are added to generate the new blue value for the pixel. This triplet forms the new RGB value for the pixel.

The BALANCING structure has three members of type L_DOUBLE: toRed, toGreen and toBlue. The value of each member must be within the range 0.0 to 1.0.

This function supports 48 and 64-bit color images. Support for 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

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:

LBitmap::AdjustTint. LBitmap::ColorHalfTone, LBitmap::SwapColors, LBitmap::ConvertToColoredGray, LBitmapBase::GrayScale, LBitmap::GrayScaleExt, LBitmapBase::IsGrayScale

Topics:

Correcting Colors

 

Raster Image Functions: Modifying Intensity Values

 

Raster Image Functions: Correcting Colors

Example

L_INT LBitmap__BalanceColorsExample(LBitmap & Bitmap, L_TCHAR * szFileName) 
{ 
   L_INT nRet; 
   BALANCING RedFactor, GreenFactor, BlueFactor; 
 
   RedFactor.uStructSize=sizeof(BALANCING); 
   RedFactor.toRed = 0.25; 
   RedFactor.toGreen = 0.25; 
   RedFactor.toBlue = 0.5; 
 
   GreenFactor.uStructSize=sizeof(BALANCING); 
   GreenFactor.toRed = 0.3; 
   GreenFactor.toGreen = 0.3; 
   GreenFactor.toBlue = 0.4; 
 
   BlueFactor.uStructSize=sizeof(BALANCING); 
   BlueFactor.toRed = 0.1; 
   BlueFactor.toGreen = 0.3; 
   BlueFactor.toBlue = 0.6; 
 
   nRet =Bitmap.Load(szFileName); 
   if(nRet !=SUCCESS) 
      return nRet; 
    
   nRet =Bitmap.BalanceColors(&RedFactor, &GreenFactor, &BlueFactor); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 20.0.2019.3.12
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help