Oilify example for C++ Builder

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.

LEADRasterProcess * pRasterProc= NULL;

void __fastcall TForm1::Button1Click(TObject *Sender)
{
     CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&pRasterProc);
   //.....
   LEADEventSink1->Connect (pRasterProc, DIID__LEADRasterProcessEvents);
   pRasterProc->EnableProgressEvent = True;
   pRasterProc->Oilify (LEADRasterView1->Raster, 10);
   LEADRasterView1->ForceRepaint ();
}
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
   if(pRasterProc)
      pRasterProc->Release();
}

void __fastcall TForm1::Button2Click(TObject *Sender)
{
     CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&pRasterProc);
   //.....
   LEADEventSink1->Connect (pRasterProc, DIID__LEADRasterProcessEvents);
   pRasterProc->EnableProgressEvent = True;
   pRasterProc->Oilify (LEADRasterView1->Raster, 10);
   LEADRasterView1->ForceRepaint ();
}

void __fastcall TForm1:: LEADEventSink1Invoke(TObject *Sender, int DispID,
      const TGUID &IID, int LocaleID, WORD Flags, tagDISPPARAMS &Params,
      Pointer varResult, Pointer ExcepInfo, Pointer ArgErr)
{
   switch (DispID)
   {
        case LEADRASTERPROCESSEVENTS_PROGRESSSTATUS:
      {
         int iPercent= (OleVariant)(Params.rgvarg[0]);
          Caption= IntToStr(iPercent);
      }
      break;
   }
}