ReplaceColor Method

Description         This method is to replace the hue, saturation and intensity of pixels in a specific color range. This method will replaces the specified color pixels of the image. This method works for only 24 bit per pixel images.

Examples

color                                                           replace

The original 900 x 1300 sized color image and the color replaced image with red = 198, green = 236, blue = 72, intRed = 50, intGreen  = 50 and intBlue =  50 parameter values.

Syntax                 RetVal = [BIIMAGE.]ReplaceColor hDib red green blue intRed intGreen intBlue hue saturation intensity iShowProgress hWnd

Returns               RetVal                    LONGLONG The handle of new DIB, 0 if an error occurred.

Remarks             hDib                       LONGLONG Handle of the source image.

                            red                          Long                Value of red component [0 - 255].

                            green                      Long                Value of green component [0 - 255].

                            blue                         Long                Value of blue component [0 - 255].

                            intRed                    Long                Value of red intervallum. See below.

                            intGreen                 Long                Value of geen intervallum. See below.

                            intBlue                    Long                Value of blue intervallum. See below.

                            hue                          short                Value of hue [-180 - 180].

                            saturation               short                Value of saturation [-255 - 255].

                            intensity                  short                Value of intensity [-255 - 255].

                            iShowProgress       Long                This parameter specifies the displaying of the progressbar and the preview dialog.

Available values:

DISPLAY_NONE (0) - The progressbar and the preview dialog will not display before filtering.

DISPLAY_PROGRESS (1) - The progressbar will display during filtering procedure.

DISPLAY_DIALOG (2) - The preview dialog will display before filtering. This dialog shows the part of the image before and after filtering.

DISPLAY_BOTH (3) - The progressbar and the preview dialog will display.

IMPORTANT: The preview dialog will only display, if there is BIDlgs32.dll installed.

                            hParent                  LONGLONG Handler of the parent window to display preview dialog.

 

The method will not free the input DIB.

 

For example:

blue = 100;

green = 120;

red = 80;

 

intRed = intBlue = intGreen = 20;

 

In this case the pixels in the intervallum see below will be modified:

80 <= blue <= 120

100 <= green <= 140

60 <= red <= 100

See Also