case uMsg
of
WM_CREATE:
begin
// Bitmap(s) aufbereiten /////////////////////////////////////////////
// RGB Bitmap laden
RGBBmp := LoadImage(hInstance, '
RGB', IMAGE_BITMAP, 0, 0, 0);
RGBBmpDC := CreateCompatibleDC(0);
SelectObject(RGBBmpDC, RGBBmp);
GetObject(RGBBmp, sizeof(BITMAP), @BmpInfo);
CreateBitmap32(BmpInfo.bmWidth, BmpInfo.bmHeight);
BitBlt(BmpDC, 0, 0, BmpInfo.bmWidth, BmpInfo.bmHeight, RGBBmpDC, 0, 0, SRCCOPY);
// noch 'n Close Button malen
DrawFrameControl(BmpDC,
_RECT(0, 0, 16, 16), DFC_CAPTION, DFCS_CAPTIONCLOSE);
DeleteObject(RGBBmp);
DeleteDC(RGBBmpDC);
// Mask Bitmap laden
MskBmp := LoadImage(hInstance, '
MASK', IMAGE_BITMAP, 0, 0, 0);
MskBmpDC := CreateCompatibleDC(0);
SelectObject(MskBmpDC, MskBmp);
// noch 'n Alphawert für den Closebutton erzeugen
Brush := CreateSolidBrush($00FFFFFF);
FillRect(MskBmpDC, _RECT(0, 0, 16, 16), Brush);
DeleteObject(Brush);
// RGB und Alpha -Bitmap kombinieren
for y := 0
to BmpInfo.bmHeight - 1
do
for x := 0
to BmpInfo.bmWidth - 1
do
begin
// "Get Pixel form Pointer"
rgba := pRGBA(INTEGER(bits) + (x + y * BmpInfo.bmWidth) * 4);
//
PixColor := GetPixel(MskBmpDC, x, y);
rgba.alpha :=
(GetRValue(PixColor) +
GetGValue(PixColor) +
GetBValue(PixColor))
div 3;
end;
DeleteObject(MskBmp);
DeleteDC(MskBmpDC);
////////////////////////////////////////////////////////////////////////
// einen Button zum Schliessen erstellen (welcher auf dem Bitmap ist)
//...
end;
WM_DESTROY:
// ...