0

Hi, I tried creating multiple bitmaps on top of each other but cant seem to get the result i want: currently i have one bitmap that is the background and another bitmap that is supposed to be an animal and will be on top of the background.

this is my WM_PAINT

case WM_PAINT:
		{
            BITMAP bm;
			PAINTSTRUCT ps;

			HDC hdc = BeginPaint(hwnd, &ps);

			HDC hdcMem = CreateCompatibleDC(hdc);
			HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmGround);

			GetObject(g_hbmGround, sizeof(bm), &bm);

			BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, MERGECOPY);


            GetObject(g_hbmRed, sizeof(bm), &bm);

			BitBlt(hdc, 20,20, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCPAINT);

			SelectObject(hdcMem, hbmOld);
			DeleteDC(hdcMem);

        }
		break;

i attach a screeny as my current result.

Attachments weardsquare.jpg 92.96 KB
2
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by h3llpunk
0

Try SRCCOPY in your first BitBlt. Look into other modes if that doesn't do what you want. Also check out TransparentBlt which allows you to have a transparent rgb color.

0

Still havent been able to solve it:S checked out all possibilities is it even possible to do this?

0

Still havent been able to solve it. Is it even possible to do this?

There must be a way to do it.
What exactly are you trying to do.
What exactly is it doing wrong.

0

Got the bug fixed after a hour of trying different ways to form it

the problem was that bitblt selected the same object g_hbmGround twice and i had one the size of my screen resolution and one 20 by 20 hence the little green square in my thumbnail.

The following fix did it : after painting the background which is g_hbmGround i had to do select a new object into my hdcMem by using SelectObject(hdcmem, g_hbmRed);
and now its fully working=)
hope this helps people who encounter the same problem as me

This question has already been answered. Start a new discussion instead.
Please be thoughtful and detailed and be sure to adhere to our posting rules.