DDB example for C++ Builder

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.

   HDC MyDC;
   long int MyDDB;
   long int MyPalette;
   RasterCopyConstants MyFlags;
   LEADRasterProcess* pRasterProc= NULL;

     CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&pRasterProc);

   Cursor= crHourGlass;
   MyFlags= (RasterCopyConstants)(COPY_EMPTY + COPY_DDB + COPY_PALETTE);
   LEADRasterView1->Raster->Copy (MyFlags);
   if (LEADRasterView2->Raster->Paste (PASTE_ISREADY) == 0)
       ShowMessage ("Invalid data on the clipboard");
   else
       LEADRasterView2->Raster->Paste ((RasterPasteConstants)0);

   pRasterProc->Reverse (LEADRasterView2->Raster);
   MyDC= (HDC)LEADRasterView2->GetClientDC ();
   MyDDB= LEADRasterView2->Raster->GetDDB ((long)MyDC);
   MyPalette= LEADRasterView2->GetPalette ((long)MyDC);
   LEADRasterView1->Raster->SetDDB ((long)MyDC, (long)MyDDB, (long)MyPalette);
   LEADRasterView1->ForceRepaint ();
   LEADRasterView2->ReleaseClientDC ();
   pRasterProc-> Release( );
   Cursor= crDefault;