Combine example for Delphi

This example copies the LEADRasterView1 bitmap to LEADRasterView2, trims and filters the copied image, and combines the filtered image with the original LEADRasterView1 bitmap image. Trimming LEADRasterView2 lets you see the difference between filtered and nonfiltered regions.

var
   sRet: Smallint;
   SrcLeft: Single;
   SrcTop : Single;
   DstLeft: Single;
   DstTop: Single;
   DstWidth: Single;
   DstHeight: Single;
   fTrimLeft: Single;
   fTrimTop:Single;
   fTrimWidth:Single;
   fTrimHeight:Single;

   RasterProc: LEADRasterProcess;
begin
   RasterProc:= CreateComObject (CLASS_LEADRasterProcess ) as LEADRasterProcess;

   Cursor:= crHourglass;
   LEADRasterView2.Raster.RefBitmap := False;
   LEADRasterView2.Raster.Bitmap := LEADRasterView1.Raster.Bitmap;
   fTrimLeft:= (LEADRasterView2.Raster.BitmapWidth * 0.2);
   fTrimTop := (LEADRasterView2.Raster.BitmapHeight * 0.2);
   fTrimWidth := (LEADRasterView2.Raster.BitmapWidth * 0.6);
   fTrimHeight := (LEADRasterView2.Raster.BitmapHeight * 0.6);
   RasterProc.Trim (LEADRasterView2.Raster, fTrimLeft, fTrimTop, fTrimWidth, fTrimHeight);
   RasterProc.SpatialFilter (LEADRasterView2.Raster, FLT_LINESEG_LTOR);
   DstLeft := fTrimLeft;
   DstTop := fTrimTop;
   DstWidth := fTrimWidth;
   DstHeight := fTrimHeight;
   SrcLeft:= 0;
   SrcTop := 0;
   RasterProc.Combine (LEADRasterView1.Raster, DstLeft, DstTop,
                               DstWidth, DstHeight,
                               LEADRasterView2.Raster,
                               SrcLeft, SrcTop, CB_OP_ADD);
   LEADRasterView1.ForceRepaint (sRet);
   Cursor:= crDefault;
end;