Graphics Question
Hey guys. I''m making a tiled RPG thingy and have a problem with transparent bitmaps.
I went to a site and found a technique for doing this that bitblt''s three times, once with SRCINVERT, then SRCAND (the mask), then SRCINVERT again.
The problem is that the transparent bits of the tile have a darker tinge to them. They have a tint, like the windows in limousines. Only a little but it''s noticeable. I have tried to solve the problem but come up trumps. Any ideas?
PS: Here''s the code I use.
//--------------------------------------------
dcMem.SelectObject(&m_bmpBitmapGrass4);
// Create the mask bitmap
CBitmap bitmapTrans;
int nWidth = 32;
int nHeight = 32;
bitmapTrans.CreateBitmap(nWidth, nHeight, 1, 1, NULL);
dcTrans.SelectObject(&bitmapTrans);
dcMem.SetBkColor(RGB (0,0,0));
dcTrans.BitBlt(0, 0, nWidth, nHeight, &dcMem, 0, 0, SRCCOPY);
dc.BitBlt(bm.bmWidth*9, bm.bmHeight*7, bm.bmWidth, bm.bmHeight, &dcMem, 0, 0, SRCINVERT);
dc.BitBlt(bm.bmWidth*9, bm.bmHeight*7, bm.bmWidth, bm.bmHeight, &dcTrans, 0, 0, SRCAND);
dc.BitBlt(bm.bmWidth*9, bm.bmHeight*7, bm.bmWidth, bm.bmHeight, &dcMem, 0, 0, SRCINVERT);
//-----------------------------------------------------
You probably shouldn''t be using the GDI to do your graphics. Also, if that is MFC you''re using, that will only make it slower. Learn DirectX or OpenGL, they''ll make your graphics remarkably faster
.
Sorry that I couldn''t answer your question though.
http://www.gdarchive.net/druidgames/
![](wink.gif)
Sorry that I couldn''t answer your question though.
http://www.gdarchive.net/druidgames/
I know, I know, I really should learn direct x. I tried when I was using Visual Basic, but all the source code I looked at was very intimidating. Anyway, I intend to learn it after I complete this project. For an RPG the slowness of the GDI doesn''t really matter that much.
PS: How do you make those little faces come up in the message, oh that is the height of coolness (I don''t get out much
)
PS: How do you make those little faces come up in the message, oh that is the height of coolness (I don''t get out much
![](smile.gif)
Well, if you take a look at http://nehe.gamedev.net, he has a remarkably easy to follow OpenGL tutorial series.
That''s what I mainly learned OpenGL from. Once you get the basics down, look at Lesson 21 to see how orthographic (i.e. 2D style) OpenGL is done.
Good luck
.
http://www.gdarchive.net/druidgames/
That''s what I mainly learned OpenGL from. Once you get the basics down, look at Lesson 21 to see how orthographic (i.e. 2D style) OpenGL is done.
Good luck
![](wink.gif)
http://www.gdarchive.net/druidgames/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement