typedef struct _INVERTEDTEXT
{
L_UINT uStructSize;
L_UINT uFlags;
L_INT iMinInvertWidth;
L_INT iMinInvertHeight;
L_INT iMinBlackPercent;
L_INT iMaxBlackPercent;
pBITMAPHANDLE pBitmapRegion;
L_UINT uBitmapStructSize;
HRGN hRgn;
} INVERTEDTEXT, *pINVERTEDTEXT;
The INVERTEDTEXT structure provides information used by LBitmap::InvertedText to find and modify inverted text.
Member |
Description |
uStructSize |
Size of this structure in bytes. Use the sizeof() macro 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 LBitmap::InvertedText, if the LBitmap::InvertedTextCallback Callback member function returns SUCCESS_REMOVE, the inverted text is corrected and is added to an internal single region. If the callback returns SUCCESS_NOREMOVE, the inverted text is not corrected and is not added to the single region. When LBitmap::InvertedText returns, either pBitmapRegion or hRgn will reference a region that contains all the corrected, 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 corrected inverted text. If INVERTEDTEXT_LEAD_REGION is not set, hRgn is updated with a Windows region that contains all the corrected 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 LBitmap::InvertedText returns, pBitmapRegion is updated with a shallow copy of pBitmap that also contains a region with all the corrected 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 LBitmap::InvertedText 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 |
LBitmap::InvertedTextCallback Callback member function 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 corrected inverted text by combining the regions received by the callback member function, if the callback member function returns SUCCESS_REMOVE. The regions can be combined using a logical OR operator. Combining all regions received when the callback member 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 LBitmap::InvertedText. When the region received by the callback member 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 behaviors of the inverted text removal process. |
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 LBitmap::InvertedText 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 LBitmapRgn::Free() when it is no longer needed. Refer to the LBitmap::InvertedText example to see how pBitmapRegion is used and freed. |
uBitmapStructSize |
Size of the structure pointed to by pBitmapRegion. Use sizeof(BITMAPHANDLE). |
hRgn |
Handle to a windows region. When LBitmap::InvertedText 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 API DeleteObject() when the region is no longer needed. |