Available in the LEADTOOLS Imaging toolkit. |
InvertedText example for Visual Basic
Dim nRet As Integer
'InvertedText
'This example finds all inverted text regions greater than 5 inches in width and 1/2 inch in height
'and inverts the text so that it appears normal
'The InvertedText Event is used to display additional information about the inverted text regions
'A LEAD region is updated to show all of the changes
LEAD1.DocCleanSuccess = SUCCESS_REMOVE
nRet = LEAD1.InvertedText(INVERTEDTEXT_SINGLE_REGION Or INVERTEDTEXT_LEAD_REGION Or INVERTEDTEXT_USE_DPI, 5000, 500, 70, 95)
If (nRet = 0) Then
LEAD1.FreeRgn
LEAD2.Bitmap = LEAD1.DocCleanBitmap 'copy the result so we can get the rgn handle
LEAD1.SetRgnHandle LEAD2.GetRgnHandle, 0, 0, L_RGN_SET
LEAD2.Bitmap = 0 'no longer need copy
LEAD1.DocCleanBitmap = 0 'no longer need rgn either
LEAD1.RgnFrameType = RGNFRAME_COLOR
End If
Private Sub LEAD1_InvertedText(ByVal hRgn As Stdole.OLE_HANDLE, ByVal fBoundingRectLeft As Single, ByVal fBoundingRectTop As Single, ByVal fBoundingRectWidth As Single, ByVal fBoundingRectHeight As Single, ByVal iWhiteCount As Long, ByVal iBlackCount As Long)
Debug.Print "Inverted at " & CStr(fBoundingRectLeft) & "," & CStr(fBoundingRectTop) & "," & CStr(fBoundingRectWidth) & "," & CStr(fBoundingRectHeight) & " WhiteCount=" & CStr(iWhiteCount) & " BlackCount=" & CStr(iBlackCount)
End Sub