BalanceColors method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

int BalanceColors(const COLORBALANCING &RedFact, const COLORBALANCING &GreenFact, const COLORBALANCING &BlueFact);

Delphi Syntax

Function BalanceColors ( RedFact: COLORBALANCING; GreenFact: COLORBALANCING; BlueFact: COLORBALANCING ): L_INT;

Overview

Refer to Examining and Altering Bitmaps.

Remarks

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

For each pixel in the bitmap, the red value is modified using the values of RedFact. This generates an intermediate red value, an intermediate green value and an intermediate blue value.

For each pixel in the bitmap the green value is modified using the values of GreenFact. This generates an intermediate red value, an intermediate green value and an intermediate blue value.

For each pixel in the bitmap the blue value is modified using the values of BlueFact. 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 COLORBALANCING Record (structure) has three components of type double: toRed, toGreen and toBlue. The possible values of each member must be within the range: 0.0 – 1.0.

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

This method 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 method.

See Also

Elements:

ConvertToColoredGray method, GrayScale method, GrayScaleExt method, IsGrayScale property

Topics:

Raster Images: Doing Color Expansion or Reduction