DocCleanBitmap example for Delphi
procedure TForm1.Button2Click(Sender: TObject);
var
nRet : Integer;
begin
{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}
LEADImage1.DocCleanSuccess := SUCCESS_REMOVE;
nRet := LEADImage1.Smooth (2, SMOOTH_SINGLE_REGION Or
SMOOTH_LEAD_REGION Or SMOOTH_FAVOR_LONG);
If (nRet = SUCCESS) Then
begin
LEADImage1.FreeRgn;
LEADImage2.Bitmap := LEADImage1.DocCleanBitmap; {copy the result so we can get the rgn handle}
LEADImage1.SetRgnHandle (LEADImage2.GetRgnHandle, 0, 0, L_RGN_SET);
LEADImage2.Bitmap := 0; {no longer need copy}
LEADImage1. DocCleanBitmap := 0; {no longer need rgn either}
LEADImage1.RgnFrameType := ftAnimated;
end ;
end;
procedure TForm1.LEADImage1Smooth (Sender: TObject; nBumpOrNick, nStartRow,
nStartCol, nLength, uHorV: Integer);
var
sOutput : String;
sType : String;
sHorV : String;
szTemp : array[0..255]of Char;
begin
if (nBumpOrNick = SMOOTH_BUMP) then
sType := 'Bump'
else
sType := 'Nick';
if (uHorV = SMOOTH_HORIZONTAL_ELEMENT) then
sHorV := 'Horz.'
else
sHorV := 'Vert.';
sOutput := Format('Fount %s at %d,%d Length %d - %s',
[sType,nStartCol,nStartCol,nLength,sHorV]);
OutputDebugString(StrPCopy(szTemp,sOutput));
end;