News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

AlphaBlend Bitmap

Started by ragdog, December 23, 2016, 01:58:07 AM

Previous topic - Next topic

ragdog

Good day.

I try to make  a costum control  to draw a Bitmap on it all works fine.
Now wish i the bitmap is Transparent ,i google a little and found the AlphaBlend function.

All works fine but i start my programm draw a text fom backround program on the bitmap why?

I can move the window to other position but the text
"
320,240,ebx
tr[esi]).bmWidth,(BITMAP ptr[esi]).bmHeight"

Is freez on this control  ::)

 




ControlWndProc PROC PRIVATE hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

.if uMsg == WM_DESTROY
invoke DeleteObject,hMemDC_
invoke DeleteObject,hSplash
.elseif uMsg == WM_CREATE
                   invoke GfxProc,hWnd



bf BLENDFUNCTION <?>
.code
GfxProc proc hWnd:HWND
mov esi,rv(GetDC,hWnd)
mov hDC_ ,esi
mov ebx,rv(CreateCompatibleDC,esi)
lea esi,offset Bitmap_
invoke CreateCompatibleBitmap,ebx,(BITMAP ptr[esi]).bmWidth,(BITMAP ptr[esi]).bmHeight
invoke SelectObject,ebx,eax
invoke DeleteObject,eax

mov hMemDC_,ebx
invoke SelectObject,hMemDC_,hSplash

;Alpha blending bitmap over background
mov bf.AlphaFormat, 0
mov bf.BlendFlags, 0
mov bf.BlendOp, AC_SRC_OVER
mov bf.SourceConstantAlpha, 100
mov ebx, bf
invoke  AlphaBlend,hDC_, 0,0, 320,240, hMemDC_, 0,0, 320,240,ebx
;invoke BitBlt,hDC_,NULL ,NULL ,(BITMAP ptr[esi]).bmWidth,(BITMAP ptr[esi]).bmHeight,hMemDC_,NULL ,NULL ,SRCCOPY

invoke ReleaseDC,hWnd,hDC_



Greets,