DDB example for Delphi
This example copies the LEADRasterView1.Raster bitmap to the clipboard as a DDB. It pastes the DDB into LEADRasterView2.Raster and reverses the image. It then gets a DDB from LEADRasterView2, sets the same DDB to LEADRasterView, and repaints.
var
MyDC: HDC;
sRet: Smallint;
nRet: Integer;
MyDDB: Longint;
MyPalette: Longint;
MyFlags: RasterCopyConstants;
RasterProc: LEADRasterProcess;
begin
RasterProc:= CreateComObject (CLASS_LEADRasterProcess ) as LEADRasterProcess;
Cursor:= crHourglass;
MyFlags:= COPY_EMPTY + COPY_DDB + 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);
MyDC:= LEADRasterView2.GetClientDC (nRet);
MyDDB:= LEADRasterView2.Raster.GetDDB (MyDC);
MyPalette:= LEADRasterView2.GetPalette (MyDC, nRet);
LEADRasterView1.Raster.SetDDB (MyDC, MyDDB, MyPalette);
LEADRasterView1.ForceRepaint (sRet);
LEADRasterView2.ReleaseClientDC (sRet);
Cursor:= crDefault;
end;