GammaCorrection

#include "BIImage.H"

 

HDIB CALLBACK GammaCorrection( HDIB     HDib,
int           iRed,
int           iGreen,
int           iBlue,
int           iShowProgress,
HWND  hParent)

Description

This function will compute gamma correcton on the input DIB. The input DIB must be 24 bit per pixel. Gamma correction of an image means non-linear scaling of the pixel values. The factor of the scaling can be specified separately to the three color channel. Gamma correction is processed to the red channel by the following equation (and similarly to the other channels):

Examples

gammacorrbefore                                                     gammacorrafter

The original 460 x 555 pixel color image and the gamma corrected image with 130 valued factor for all color channels.

Parameters

HDIB

hDIB

Handle of the DIB to filter.

int

iRed

The gamma-factor of the red channel. See the description and examples above for further information and a possible value.

int

iBlue

The gamma-factor of the blue channel. See the description and examples above for further information and a possible value.

int

iGreen

The gamma-factor of the green channel. See the description and examples above for further information and a possible value.

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. If the iShowProgress parameter is FALSE, this parameter will be ignored.

Return values

The handle of the new converted DIB or NULL if an error occurred. If any error occurs the GetLastColorConvertError function will be retrieves the error code.

Programming notes

The function will not free the input DIB.

Requirements

Header :     Declared in BIImage.h; include BIImage.h.

Library :    Use BIImage.lib.

DLLs :       BiImage.dll.