DTWAIN_IsDIBBlank

Top  Previous  Next

The DTWAIN_IsDIBBlank function checks if a Device Independent Bitmap (DIB) represents a blank page.

 

LONG DTWAIN_IsDIBBlank (

HANDLE

hDib,

DTWAIN_FLOAT

threshold );

 

Parameters

hDib

Handle to a Device Independent Bitmap.

 

threshold

   Sets the percentage of white pixels to black pixels to determine if a page is blank.

 

Return Values

If the DIB is blank, the return value is 1.  If the DIB is not blank, the return value is 0. If there is an error, the return value is DTWAIN_ERR_INVALIDBMP.

 

Comments

The DTWAIN_IsDibBlank will determine if a Device Independent Bitmap (DIB) is blank by determining the ratio of white pixels to dark pixels in the bitmap.  The hDib is a handle to a DIB.  The hDib can be any valid DIB handle that your application may be processing.  This includes the DIB's that are returned from functions such as DTWAIN_AcquireNative, or it could possibly be a DIB that your own code may have generated or is using.

 

The threshold value is a percentage value that is used.  The percentage denotes the ratio of the number of white pixels to dark pixels.  For example:

 

HANDLE hDib;

....

DTWAIN_IsDIBBlank( hDib, 98.5);

 

This call to DTWAIN_IsDIBBlank uses a threshold value of 98.5.  This means that the bitmap must consist of at least 98.5% white pixels to be considered blank.

 

For languages that have difficulties with DTWAIN_FLOAT parameters, the alternate function that can be used as a replacement for DTWAIN_IsDIBBlank is DTWAIN_IsDIBBlankString.

 

Prerequisite Function Call(s)

DTWAIN_SysInitialize

 

See Also

Blank Page Detection