Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Bitblt mania...

This topic is 6931 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all-- I originally posted this on the general programming board, and it''s not really directx, except in a distant way, but I usually get better results from people on this board, so here goes-- don''t flame me for bringing a winapi question over... I''m writing an editor for my game, and I let the player pull in bitmaps. I preview these bitmaps for them on a window using BeginPaint,BitBlt, and EndPaint, and it all works very snazzy. However, I have some graphics that need to be aligned onto another graphic, and the user gets to do that, too. I wanted to display a bitmap on the window background, and then a bitmap in front of it. I did it, and I get the ''original mission'' of graphics programmers-- I need to Blt that other bitmap transparently. Now, I''m requiring users to use bright white as their transparent color, so I just need some way to make BitBlt draw transparent. I''m aware of MaskBlt, but windows resists all my efforts to use it. Furthermore, I can''t very well ask the users to generate a mask for all the graphics they''re importing. What I want to do is get a bitmap from the user, make a mask from it, and get MaskBlt to work. I fiddled with GetDIBits and SetDIBits, but windows just gives me a generic error -- "Invalid Attribute," and I don''t know what I''m doing wrong. I also don''t want to think about it. I consider the WinAPI to be a convenience API and I don''t want to spend a week trying to get it to do what I used to be able to do from scratch in about fifteen minutes. So, does anyone, especially you, Bumba, have a ''plugin'' I could use? Or, barring a plugin, surely someone has some pre-directx code that they wrote trying to make a game in windows and being FORCED to use BitBlt or whatnot? Thanks in advance!

Share this post

Link to post
Share on other sites
hi GoodLife

Yes i have code to do just that but it is in ASM...
(as i do all my games work now)

I started my RTS game in GDI first and had to
do it manually....

I will walk u throught:

1.First i use BitBlt...no maskBlt
i use an scrcopy to get whats under on map in a memory
(offscreen haha didnt know DirectX at that time)
2.Then srcand with a mask witch has full white as background and full black where the picture will be
3.Last srcor with my picture with is on a full black background

This makes an GDI Colorkey for black i think
(there are also other combinations that may work
i just did it this way first...so..why change? )

Thats it...
of course u can figure out a way to make a mask from a picture cant u?
(maybe u can ask ur user to use paintshop pro to do it )
just kidding....no harm done i hope

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!