Trim example for Delphi

This example trims one-tenth from the bitmap and repaints the image.

var
   NewLeft, NewTop, NewWidth, NewHeight, ViewWidth, ViewHeight: Single;
   RasterProc: LEADRasterProcess;
   sRet: Smallint;
begin
   RasterProc:= CreateComObject(CLASS_LEADRasterProcess) as LEADRasterProcess;
   NewLeft:= LEADRasterView1.Raster.BitmapWidth * 0.1;
   NewTop:= LEADRasterView1.Raster.BitmapHeight * 0.1;
   NewWidth := LEADRasterView1.Raster.BitmapWidth * 0.8;
   NewHeight:= LEADRasterView1.Raster.BitmapHeight * 0.8;
   RasterProc.Trim ( LEADRasterView1.Raster, NewLeft, NewTop, NewWidth, NewHeight );
   //Set variables for the position and size of the display rectangle.
   ViewWidth:= LEADRasterView1.ScaleWidth;
   ViewHeight:= LEADRasterView1.ScaleHeight;
   //Set the image display size to match the LEAD control
   LEADRasterView1.SetDstRect (0, 0, ViewWidth, ViewHeight, sRet);
   LEADRasterView1.SetDstClipRect (0, 0, ViewWidth, ViewHeight, sRet);
   LEADRasterView1.ForceRepaint (sRet);
end;