DIB example for Delphi

This example copies the LEADRasterView1.Raster bitmap to the clipboard as a DIB. It pastes the DIB into LEADRasterView2 and reverses the image. It then gets a DIB from LEADRasterView2, sets the same DIB to LEADRasterView1, and repaints.

var
   sRet: Smallint;
   MyDib: Longint;
   MyFlags:RasterCopyConstants;
   RasterProc: LEADRasterProcess;
begin
   RasterProc:= CreateComObject (CLASS_LEADRasterProcess ) as LEADRasterProcess;

   Cursor:= crHourglass;
   MyFlags:= COPY_EMPTY + COPY_DIB + COPY_PALETTE;
   LEADRasterView1.Raster.Copy (MyFlags);
   if (LEADRasterView2.Raster.Paste (PASTE_ISREADY) = 0) then
      ShowMessage ('Invalid data on the clipboard')
   else
      LEADRasterView2.Raster.Paste (0);

   RasterProc.Reverse (LEADRasterView2.Raster);
   MyDib:= LEADRasterView2.Raster.GetDIB;
   LEADRasterView1.Raster.SetDIB (MyDib);
   LEADRasterView1.ForceRepaint (sRet);
   Cursor:= crDefault;
end;