Smooth example for Delphi
var
RasterProc: LEADRasterProcess;
//Create the RasterProcess object and UnlockSupport
procedure TForm1.Button1Click(Sender: TObject);
begin
//.....
RasterProc:= CreateComObject(CLASS_LEADRasterProcess) as LEADRasterProcess;
LEADRasterView1.Raster.UnlockSupport (L_SUPPORT_DOCUMENT, ‘TestKey’);
LEADEventSink1.Connect (RasterProc, _LEADRasterProcessEvents);
//.....
end;
//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
procedure TForm1.Button2Click(Sender: TObject);
var
nRet: Integer;
begin
RasterProc.EnableDocCleanEvents:= True;
RasterProc.DocCleanSuccess:= SUCCESS_REMOVE;
nRet:= RasterProc.Smooth (LEADRasterView1.Raster, 2, SMOOTH_SINGLE_REGION Or SMOOTH_LEAD_REGION Or SMOOTH_FAVOR_LONG);
if (nRet = 0) then
LEADRasterView1.RgnFrameType:= RGNFRAME_COLOR;
end;
procedure TForm1. LEADEventSink1Invoke(Sender: TObject; DispID: Integer;
const IID: TGUID; LocaleID: Integer; Flags: Word; Params: tagDISPPARAMS;
varResult, ExcepInfo, ArgErr: Pointer);
var
nBumpOrNick: Longint;
fStartRow: Single;
fStartCol: Single;
fLength: Single;
uHorV: Longint;
sOutput : String;
sType : String;
sHorV: String;
szTemp : array[0..255]of Char;
begin
case (DispID) of
LEADRASTERPROCESSEVENTS_SMOOTH:
begin
nBumpOrNick:= OleVariant(Params.rgvarg^[4]);
fStartRow:= OleVariant(Params.rgvarg^[3]);
fStartCol:= OleVariant(Params.rgvarg^[2]);
fLength:= OleVariant(Params.rgvarg^[1]);
uHorV:= OleVariant(Params.rgvarg^[0]);;
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 %f,%f Length %f - %s',
[sType,fStartRow,fStartCol,fLength,sHorV]);
OutputDebugString(StrPCopy(szTemp,sOutput));
end;
end;
end;