GrayScaleExt method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

int __fastcall GrayScaleExt (int RedFact, int GreenFact, int BlueFact);

Delphi Syntax

Function GrayScaleExt (RedFact: Integer; GreenFact: Integer; BlueFact: Integer): Integer;

Overview

Refer to Examining and Altering Bitmaps

Remarks

Converts any bitmap to a grayscale bitmap without changing its resolution.

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 method 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 method supports 12 and 16-bit grayscale images and 48 and 64-bit color images. Support for 12 and 16-bit grayscale images and 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:

GrayScale method, IsGrayScale property, ConvertToColoredGray method, BalanceColors method, SwapColors method

Topics:

Raster Images: Doing Color Expansion or Reduction