 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Bizarro I post too much
Reputation: 0
Joined: 01 May 2007 Posts: 2648
|
Posted: Tue Apr 29, 2008 12:49 pm Post subject: [c++] how to load png in dialog |
|
|
i have sucessfully loaded a bmp in my c++ dialog. but the problem is that its background is white in contrast to my pure black dialog background. i was wondering if there is anyway to make the bmp background to transparent.
or if its possible to load a png instead ( which contains transparent background)
here is what i did to load the bmp, anyone know how i can do the same to png for transparent effect?
Code: |
HBITMAP Pic = NULL;
Pic = LoadBitmap(GetModuleHandle("pcomdebug"),MAKEINTRESOURCE(IDB_BALL));
// load the pic from the resource bmp in IDB_BALL
|
Code: |
case WM_PAINT:
{
BITMAP bm;
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, Pic);
GetObject(Pic, sizeof(bm), &bm);
BitBlt(hdc, 5, 40, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
// draw the bmp with specific size and coordinates
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
EndPaint(hWnd, &ps);
}
break;
|
tx for any help
_________________
w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils
Last edited by Bizarro on Tue Apr 29, 2008 2:37 pm; edited 1 time in total |
|
Back to top |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Tue Apr 29, 2008 1:53 pm Post subject: |
|
|
I don't know exactly but I think you have to create a mask image or something, and then change the following line:
BitBlt(hdc, 5, 40, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
SRCCOPY should be something like SRCAND.
That's all I know
|
|
Back to top |
|
 |
Bizarro I post too much
Reputation: 0
Joined: 01 May 2007 Posts: 2648
|
Posted: Tue Apr 29, 2008 2:03 pm Post subject: |
|
|
its alright, my friend just helped me made a bmp with black background.
it fits perfectly
but if anyone can show me a way to load png, it would be great
________
Machine
Last edited by Bizarro on Tue Feb 01, 2011 11:59 am; edited 1 time in total |
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Apr 29, 2008 2:47 pm Post subject: |
|
|
Why are you doing all that extra work on WM_PAINT over and over?
Load / create it once then just blit it form the offscreen buffer.
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|