| |
|
|
Georg Teles | an speedy Possibility, a monochrome / Black-weiße mask a Bildhandle to create - example enclosed
Download
View source
DEF CreateBitmap(5)!"GDI32","CreateBitmap"
DEF CreateCompatibleDC(1)!"GDI32","CreateCompatibleDC"
DEF SelectObject(2)!"GDI32","SelectObject"
DEF SetBkColor(2)!"GDI32","SetBkColor"
DEF BitBlt(9)!"GDI32","BitBlt"
DEF DeleteDC(1)!"GDI32","DeleteDC"
Proc Mask
Parameters hPic&, dx&, dy&, col&
Declare Mask&, dcPic&, dcMask&
mask& = CreateBitmap(dx&, dy&, 1, 1, 0)' monochrome Bitmap produce
dcPic& = CreateCompatibleDC(0)
dcMask& = CreateCompatibleDC(0)
SelectObject(dcPic&, hPic&)
SelectObject(dcMask&, Mask&)
SetBkColor(dcPic&, col&)' colour, The as Transparent behanldet go should
BitBlt(dcMask&, 0, 0, dx&, dy&, dcPic&, 0, 0, $00CC0020)' $00CC0020 = SRCCOPY
SelectObject(dcMask&,Mask&)
DeleteDC(dcPic&)
DeleteDC(dcMask&)
Return Mask&
ENDPROC
CLS RGB(100,100,100)
Declare bmp24bit&, mask24&
Declare bmp32bit&, mask32&
bmp24bit& = Create("HPIC",-1,"icon24bit.bmp")
bmp32bit& = Create("HPIC",-1,"icon32bit.bmp")
mask24& = Mask(bmp24bit&,%BmpX,%BmpY,RGB(255,0,0))' with 24 bit Bitmaps can defined colour chosen go, The transparent his should
mask32& = Mask(bmp32bit&,%BmpX,%BmpY,RGB(0,0,0))' with 32 bit Bitmaps with Alpha Channel is the transparente colour Black
DrawPic bmp24bit&,0,0;0
DrawPic mask24&,0,32;0
DrawPic bmp32bit&,32,0;0
DrawPic mask32&,32,32;0
WaitInput
DeleteObject bmp24bit&
DeleteObject bmp32bit&
DeleteObject mask24&
DeleteObject mask32&
|
|
|
| |
|
|