Redistributes the RGB values of the specified bitmap, using the values stored in the specified structures.
#include "ltwrappr.h"
virtual L_INT LBitmap::BalanceColors(pRedFact, pGreenFact, pBlueFact, uFlags = 0)
Pointer to a BALANCING structure that contains the values to use for redistributing the bitmap's red values.
Pointer to a BALANCING structure that contains the values to use for redistributing the bitmap's green values.
Pointer to a BALANCING structure that contains the values to use for redistributing the bitmap's blue values.
Reserved for future use. Must be 0.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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 - After
View additional platform support for this Balance Colors function.
Win32, x64.
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 Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document