2021年11月17日 星期三

delphi DIB embarcadero delphi graphics TBitmap Vcl.Graphics.GetDIB Device Independent Bitmaps BitBlt CreateCompatibleDC SelectObject CreateCompatib GetMapMode CreateCompatibleBitmap CreateDIBSection

  BitBlt CreateCompatibleDC SelectObject CreateCompatib GetMapMode  CreateCompatibleBitmap CreateDIBSection

Drawing Transparent Bitmaps

http://delphi.cjcsoft.net//viewthread.php?tid=45232

Title: Drawing Transparent Bitmaps

Question: How to draw a transparent bitmap
 
   hdcTemp := CreateCompatibleDC(dc);
   SelectObject(hdcTemp, hBmp);   // Select the bitmap

   GetObject(hBmp, sizeof(BITMAP), @bm);
   ptSize.x := bm.bmWidth;            // Get width of bitmap
   ptSize.y := bm.bmHeight;           // Get height of bitmap
   DPtoLP(hdcTemp, ptSize, 1);        // Convert from device
                                      // to logical points

   // Create some DCs to hold temporary data.
   hdcBack   := CreateCompatibleDC(dc);
   hdcObject := CreateCompatibleDC(dc);
   hdcMem    := CreateCompatibleDC(dc);
   hdcSave   := CreateCompatibleDC(dc);

   // Create a bitmap for each DC. DCs are required for a number of
   // GDI functions.

   // Monochrome DC
   bmAndBack   := CreateBitmap(ptSize.x, ptSize.y, 1, 1, nil);

   // Monochrome DC
   bmAndObject := CreateBitmap(ptSize.x, ptSize.y, 1, 1, nil);

   bmAndMem    := CreateCompatibleBitmap(dc, ptSize.x, ptSize.y);
   bmSave      := CreateCompatibleBitmap(dc, ptSize.x, ptSize.y);

   // Each DC must select a bitmap object to store pixel data.
   bmBackOld   := SelectObject(hdcBack, bmAndBack);
   bmObjectOld := SelectObject(hdcObject, bmAndObject);
   bmMemOld    := SelectObject(hdcMem, bmAndMem);
   bmSaveOld   := SelectObject(hdcSave, bmSave);

   // Set proper mapping mode.
   SetMapMode(hdcTemp, GetMapMode(dc));

https://programmerall.com/article/6686314819/

    Add('SRCCOPY    ');
    Add('SRCPAINT   ');
    Add('SRCAND     ');
    Add('SRCINVERT  ');
    Add('SRCERASE   ');
    Add('NOTSRCCOPY ');
    Add('NOTSRCERASE');
    Add('MERGECOPY  ');
    Add('MERGEPAINT ');
    Add('PATCOPY    ');
    Add('PATPAINT   ');
    Add('PATINVERT  ');
    Add('DSTINVERT  ');
    Add('BLACKNESS  ');
    Add('WHITENESS  ');

delphi  DIB  embarcadero delphi graphics  TBitmap Vcl.Graphics.GetDIB Device Independent Bitmaps
  https://docs.microsoft.com/zh-tw/windows/win32/gdi/capturing-an-image

http://blog.livedoor.jp/junki560/archives/21910595.html

沒有留言: