News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

TranparentBlit problem

Started by shaldan, December 19, 2005, 01:51:00 PM

Previous topic - Next topic

shaldan

I have problem with transparent blitting using GDI. I have the following code in WndProc (it is from Iczelion simplebitmap):


.if uMsg==WM_CREATE
      invoke LoadBitmap,hInstance,IDB_MAIN
      mov hBitmap,eax

   .elseif uMsg==WM_PAINT
      invoke BeginPaint,hWnd,addr ps
      mov hdc,eax
      invoke CreateCompatibleDC,hdc
      mov hMemDC,eax
      invoke SelectObject,hMemDC,hBitmap
      invoke GetClientRect,hWnd,addr rect
      invoke TransparentBlt,hdc,0,0,rect.right,rect.bottom,hMemDC,0,0,rect.right,rect.bottom,500h
      invoke DeleteDC,hMemDC
      invoke EndPaint,hWnd,addr ps


IDB_MAIN is a 8-bit bitmap {exactly I tried tweety78.bmp from Iczelion and then another bitmap for sure}
and 500h is for example just.

If I change to invoke BitBlt,hdc,0,0,rect.right,rect.bottom,hMemDC,0,0,SRCCOPY  everything works fine.
But with TransparentBlt bitmap does not show even if I try various keycolors.

Any idea ?

thanks

Human

sometimes to mix 2 pictures you need first do SRCAND with mask and SRCPAINT to OR one picture with other

zooba

Quote from: Human on December 19, 2005, 04:04:05 PM
sometimes to mix 2 pictures you need first do SRCAND with mask and SRCPAINT to OR one picture with other

The purpose of TransparentBlt is to automate that  :wink

Quote from: shaldan on December 19, 2005, 01:51:00 PM
...and 500h is for example...

I hope so :P I assume you've tried it as 0 (black) and 0FFFFFFh (white) and whatever the main background colour of your bitmap is. Are you getting a failed return value (eax = 0)?

shaldan

yeap .... eax is zero. And of course I tried various colors such 0h or 0FFFFFFh.
For start I simply have a picture with some background color and I want it to put just on white screen ofcourse without background.
I remember I tried it some time ago on another sceleton (this is from Iczelion) and it worked well. But of course I lost it :)).
And there were no need for explicitly ANDing or Oring (i hope :)) ... I guess the problem could be somewhere in some inicialization, but I really do not know.

zooba

Quote from: shaldan on December 20, 2005, 08:27:03 AM
yeap .... eax is zero.

That means it failed  :P Run through it with Ollydbg and see what the last error value is (Ollydbg automatically resolves the number that GetLastError gives you)

shaldan

hope i do it well, the error is: ERROR_MOD_NOT_FOUND 0000007E ...