Available in the LEADTOOLS Imaging toolkit. |
DocCleanBitmap example for Visual Basic
Dim nRet As Integer
'Smooth
'This example smooths all nicks and bumps up to 2 pixels in length
'Long bumps/nicks are treated before short bumps/nicks
'A LEAD region is updated to show all the changes
'The Smooth Event is used to display information about bump or nick
LEAD1.DocCleanSuccess = SUCCESS_REMOVE
nRet = LEAD1.Smooth(2, SMOOTH_SINGLE_REGION Or
SMOOTH_LEAD_REGION Or SMOOTH_FAVOR_LONG)
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_Smooth(ByVal nBumpOrNick As Long, ByVal nStartRow As Long, ByVal nStartCol As Long, ByVal nLength As Long, ByVal uHorV As Long)
Dim szType As String
Dim szHorV As String
If (nBumpOrNick = SMOOTH_BUMP) Then
szType = "Bump"
Else
szType = "Nick"
End If
If (uHorV = SMOOTH_HORIZONTAL_ELEMENT) Then
szHorV = "Horz."
Else
szHorV = "Vert."
End If
Debug.Print "Found " & szType & " at " & CStr(nStartRow) & "," & CStr(nStartCol) & " Length=" & CStr(nLength) & " - " & szHorV
End Sub