Oilify example for Delphi

This example applies an oil-painting effect and repaints the image. The progress event is enabled because this Oilify method with a neighborhood of 10 is slow.

var
   RasterProc: LEADRasterProcess;

procedure TForm1.Button1Click(Sender: TObject);
var
   sRet: Smallint;
begin
   RasterProc:= CreateComObject(CLASS_LEADRasterProcess)as LEADRasterProcess;
   //.....
   LEADEventSink1.Connect (RasterProc, _LEADRasterProcessEvents);
   RasterProc.EnableProgressEvent:= True;
   RasterProc.Oilify (LEADRasterView1.Raster, 10);
   LEADRasterView1.ForceRepaint (sRet);
end;
procedure TForm1. LEADEventSink1Invoke(Sender: TObject; DispID: Integer;
  const IID: TGUID; LocaleID: Integer; Flags: Word; Params: tagDISPPARAMS;
  varResult, ExcepInfo, ArgErr: Pointer);
var
   iPercent: Integer;
begin
   case (DispID) of
      LEADRASTERPROCESSEVENTS_PROGRESSSTATUS:
      begin
         iPercent:= OleVariant(Params.rgvarg^[0]);
          Caption:= IntToStr(iPercent);
      end;
   end;
end;