#include "BIFILTER.H"

HANDLE CALLBACK FilterGradient( HANDLE HDIB,

int iMode,

int iShowProgress,

HWND hParent)

**Description**

This function will filtered the image with the Gradient filter. This function works for only monochrome, 8 bit per bixel and 24 bit per pixel images.

**Examples**

The original 210 x 180 pixel image and the Gradient filtered image with a vertical Prewitt operator.

**Parameters**

HDIB |
hDIB |
Handle of the DIB to filter. |

Int |
iMode |
This parameter specifies the filter matrix and it’s direction. Available values:
There are the following 7 filters available:
And there are the following 8 directions available:
Any filter matrix can be referred as a number or a defined constant.
The number : Number of filter a matrix = 10 * (number of the filter type) + (number of direction).
The defined constant : GRADIENT_<DIRECTION>_<FILTER TYPE>
For example: The East-directed Sobel filter can be referred as a number 52 (5*10+2 = 52) or as a defined constant GRADIENT_EAST_SOBEL.
See Programming notes below. |

int |
iShowProgress |
This parameter specifies the displaying of the progressbar and the preview dialog. Available values:
IMPORTANT: The preview dialog will only display, if there is BiDlgs.dll installed. |

HWND |
hParent |
Handler of the parent window. |

**Return values**

The handle of the new filtered DIB or NULL if an error occurred.

**Programming notes**

The function will not free the input DIB.

Here are the matrices of the defined gradient spatiel filters for West and North directions. To get the filter matrices to all other directions, just rotate the filter elements around the origin of the matrix (the center element).

Matrix of the Isotropic WEST filter:

_{}

Matrix of the Isotropic NORTH filter:

_{}

Matrix of the Kirsch WEST filter:

_{}

Matrix of the Kirsch NORTH filter:

_{}

Matrix of the Pixel Difference WEST filter:

_{}

Matrix of the Pixel Difference NORTH filter:

_{}

Matrix of the Prewit WEST filter:

_{}

Matrix of the Prewit NORTH filter:

_{}

Matrix of the Separated Pixel Difference WEST filter:

_{}

Matrix of the Separated Pixel Difference NORTH filter:

_{}

Matrix of the Sobel WEST filter:

_{}

Matrix of the Sobel NORTH filter:

_{}

Matrix of the Roberts WEST filter:

_{}

Matrix of the Roberts NORTH filter:

_{}

**Requirements**

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

Library : Use BIFilter.lib.

DLLs : BIFilter.dll, BiDlgs.dll.