ArithmeticDIB

#include "BIFILTER.H"

 

HDIB CALLBACK ArithmeticDIB( OPERATION  oper,
HDIB               hSrcDIB1,
HDIB               hSrcDIB2
int                     iShowProgress
HWND             hParent)

Description

This function makes an arithmetic operation on two device independent bitmaps. The result is put to a newly created DIB and the source DIBs are unmodified. It works with 1, 4, 8 or 24 bits/pixel. In case of 24 bits/pixel, the arithmetic operation is made separately on the R, G, B channels. In case of 4 or 8 bits/pixel, the source DIBs must contain grayscale images and the palette values in the source DIBs must be monotone increasing. The two source DIBs must be the same size and the same bits/pixel resolution.

Parameters

OPERATION

oper

Specify the operation. (See below)

HDIB

hSrcDIB1

First source DIB

HDIB

hSrcDIB2

Second source DIB

int

iShowProgress

This parameter specifies the progressbar and the preview dialog displaying.

Available values:

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

DISPLAY_PROGRESS (1) - The progressbar will display during red eye removal procedure.

DISPAY_DIALOG (2)   -     The preview dialog will display before removing red eye. This dialog shows the part of the selected area of the image before and after the conversion.

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

IMPORTANT: The preview dialog only displays if BiDlgs.dll is installed.

HWND

hParent

Handler of the parent window.

 

Possible values of the oper parameter:

 

0                              OPER_ADD                  PixelResult = PixelSource1       +              PixelSource2

1                              OPER_SUB                   PixelResult = PixelSource1       -               PixelSource2

2                              OPER_MUL                 PixelResult = PixelSource1       *              PixelSource2

3                              OPER_DIV                   PixelResult = PixelSource1       /               PixelSource2

4                              OPER_AND                  PixelResult = PixelSource1       &             PixelSource2

5                              OPER_NAND               PixelResult = ~(PixelSource1   &             PixelSource2)

6                              OPER_OR                     PixelResult = PixelSource1       |               PixelSource2

7                              OPER_NOR                  PixelResult = ~(PixelSource1   |               PixelSource2)

8                              OPER_XOR                  PixelResult = PixelSource1       ^              PixelSource2

9                              OPER_MIN                  PixelResult = MIN      (PixelSource1,      PixelSource2)

10                           OPER_MAX                 PixelResult = MAX    (PixelSource1,      PixelSource2)

Return values

Handle of the newly created DIB on success or NULL on failure.

Programming notes

If the ‘PixelResult’ overflows or underflows, then the maximum or minimum pixel value is used instead of the result. Minimum pixel value is always zero. Maximum pixel values are: 1 bits/pixel: 1,   4 bits/pixel: 15,   8 bits/pixel: 255,   24 bits/pixel: 255 for each channel. There are three channels on 24 bits/pixel (R, G, B).

Requirements

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

Library :    Use BIFilter.lib.

DLLs :       BIFilter.dll.