INVERTEDTEXT

typedef struct tagINVERTEDTEXT 
{ 
   L_UINT uStructSize; 
   L_UINT uFlags; 
   L_INT iMinInvertWidth; 
   L_INT iMinInvertHeight; 
   L_INT iMinBlackPercent; 
   L_INT iMaxBlackPercent; 
   pBITMAPHANDLE  pBitmapRegion; 
   L_UINT uBitmapStructSize; 
   L_HRGN hRgn; 
} INVERTEDTEXT, *pINVERTEDTEXT; 

The INVERTEDTEXT structure provides information for the L_InvertedTextBitmap function to find and modify inverted text.

Members

uStructSize

Size of this structure in bytes, for versioning. Use the sizeof() operator to calculate this value.

uFlags

Flags that determine the behavior of the inverted text removal process. Flags may be combined using a bitwise OR (|). Possible values are:

Value Meaning
INVERTEDTEXT_SINGLE_REGION For each inverted text segment encountered by L_InvertedTextBitmap, if the INVERTEDTEXTCALLBACK function returns SUCCESS_REMOVE, the removed inverted text is added to an internal single region. If the callback returns SUCCESS_NOREMOVE, the inverted text is not added to the single region. When L_InvertedTextBitmap returns, either pBitmapRegion or hRgn will reference a region that contains all the removed inverted text. If INVERTEDTEXT_LEAD_REGION is also set, pBitmapRegion will be updated with a shallow copy of pBitmap that has a LEAD region that contains all the removed inverted text. If INVERTEDTEXT_LEAD_REGION is not set, hRgn is updated with a Windows region that contains all the removed inverted text. When the region (either LEAD or Windows) is no longer needed, it must be destroyed (either pBitmapRegion->pRgnInfo or hRgn).
INVERTEDTEXT_LEAD_REGION When L_InvertedTextBitmap returns, pBitmapRegion is updated with a shallow copy of pBitmap that also contains a region with all the removed inverted text. This flag must be used in conjunction with INVERTEDTEXT_SINGLE_REGION. To use this flag declare a variable of type BITMAPHANDLE and point pBitmapRegion to this variable. Set uFlags to INVERTEDTEXT_SINGLE_REGION | INVERTEDTEXT_LEAD_REGION. This variable will be updated when L_InvertedTextBitmap returns.
INVERTEDTEXT_IMAGE_UNCHANGED The original image is unchanged.
INVERTEDTEXT_USE_DPI The unit of measure for all fields of the INVERTEDTEXT structure is thousandths of an inch. Use the image's DPI to convert to pixels. This allows the processing of many images with different DPI. If this flag is not set, the unit of measure for all fields of the INVERTEDTEXT structure is pixels.
INVERTEDTEXT_CALLBACK_REGION INVERTEDTEXTCALLBACK receives a Windows region that contains the current inverted text to be removed. Setting this flag lets the user create his or her own composite of removed inverted text by combining the regions received by the callback function, if the callback function returns SUCCESS_REMOVE. The regions can be combined using a logical OR operator. Combining all regions received when the callback function returns SUCCESS_REMOVE results in a region identical to the region created when INVERTEDTEXT_SINGLE_REGION is set in uFlags. For an example, refer to L_InvertedTextBitmap. When the region received by the callback function is no longer needed, it must be destroyed using DeleteObject().
INVERTEDTEXT_USE_DIAGONALS Considers pixels that are diagonal to the inverted text as part of the inverted text.
INVERTEDTEXT_ALLFLAGS Use all flags, the value of this flag equals to:
(INVERTEDTEXT_USE_DPI         | 
 INVERTEDTEXT_SINGLE_REGION   | 
 INVERTEDTEXT_LEAD_REGION     | 
 INVERTEDTEXT_CALLBACK_REGION | 
 INVERTEDTEXT_IMAGE_UNCHANGED | 
 INVERTEDTEXT_USE_DIAGONALS) 

iMinInvertWidth

The minimum width of an area that is considered to be inverted text. If INVERTEDTEXT_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.

iMinInvertHeight

The minimum height of an area that is considered to be inverted text. If INVERTEDTEXT_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.

iMaxInvertWidth

The maximum width of an area that is considered to be inverted text. If INVERTEDTEXT_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.

iMaxInvertHeight

The maximum height of an area that is considered to be inverted text. If INVERTEDTEXT_USE_DPI is set in uFlags, units are in thousandths of an inch, otherwise units are in pixels.

iMinBlackPercent

The minimum percent of total pixels in an inverted text area that must be black. Areas with a lower percent of black pixels are not considered.

iMaxBlackPercent

The maximum percent of total pixels in an inverted text area that must be black. Areas with a higher percent of black pixels are not considered.

pBitmapRegion

Pointer to a variable of type BITMAPHANDLE. If INVERTEDTEXT_SINGLE_REGION | INVERTEDTEXT_LEAD_REGION have been set in uFlags, then when L_InvertedTextBitmap returns, this is updated with a shallow copy of pBitmap that also has a region that contains the removed inverted text. To use this, declare a variable of type BITMAPHANDLE and point pBitmapRegion to this variable. Set uFlags to (INVERTEDTEXT_SINGLE_REGION | INVERTEDTEXT_LEAD_REGION). It is the programmer's responsibility to free the region using L_FreeBitmapRgn when it is no longer needed. Refer to the L_InvertedTextBitmap example to see how pBitmapRegion is used and freed.

uBitmapStructSize

Size of the structure pointed to by pBitmapRegion, for versioning. Use sizeof(BITMAPHANDLE).

hRgn

Handle to a windows region. When L_InvertedTextBitmap returns, this is updated with a single windows region corresponding to all changes, only if INVERTEDTEXT_SINGLE_REGION has been set in uFlags and INVERTEDTEXT_LEAD_REGION has not been set. To use this, set the flags field to (INVERTEDTEXT_SINGLE_REGION). It is the programmer's responsibility to delete this region using the windows C API DeleteObject() when the region is no longer needed.

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help