#include "BIIMAGE.H"
HDIB CALLBACK ReplaceColor( HDIB HDib,
RGBTRIPLE rgb,
S_REP pLimit,
int hue,
int saturation,
int intensity,
int iShowProgress,
HWND hParent)
Description
This function will replaces the specified color pixels of the image. This function works for only 24 bit per pixel images.
Examples

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.
Parameters
|
HDIB |
hDIB |
Handle of the source DIB. |
|
RGBTRIPLE |
rgb |
This parameter specifies the color of pixels to modify. |
|
S_REP |
pLimit |
This structure contains information about the intervallum of RGB components to modify. |
|
int |
hue |
Value of hue [-180 - 180]. |
|
int |
saturation |
Value of saturation [-255 - 255]. |
|
int |
intensity |
Value of intensity [-255 - 255]. |
|
int |
iShowProgress |
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 BiDlgs.dll installed. |
|
HWND |
hParent |
Handler of the parent window to display preview dialog. |
Return values
The handle of the new DIB or NULL if an error occurred. The GetLastColorConvertError function will return the error code.
Programming notes
The function will not free the input DIB.
// struct for ReplaceColor
typedef struct _S_REP
{
BYTE intRed;
BYTE intGreen;
BYTE intBlue;
}S_REP;
typedef S_REP far * LPS_REP;
For example:
rgb.rgbtBlue = 100;
rgb.rgbtGreen = 120;
rgb.rgbtRed = 80;
pLimit.intRed = pLimit.intBlue = pLimit.intGreen = 20;
In this case the pixels in the intervallum see below will be modified:
80 <= blue <= 120
100 <= green <= 140
60 <= red <= 100