LBitmap::BalanceColors

Summary

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

Syntax

#include "ltwrappr.h"

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

Parameters

BALANCING * pRedFact

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

BALANCING * pGreenFact

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

BALANCING * pBlueFact

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

L_UINT32 uFlags

Reserved for future use. Must be 0.

Returns

Value Meaning
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.

Balance Colors Function - Before

Balance Colors Function - Before

Balance Colors Function - After

Balance Colors Function - After

View additional platform support for this Balance Colors function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

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 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

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