Jump to content
  • Advertisement

Archived

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

gerbenvanderlubbe

50% transparent image

This topic is 5599 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

I have to images. One buffer and one image I want to put on the buffer. This image must be put on the buffer with ±50% transperency, so that you can "look through" it. How can I do this? I got the two DCs of the pictures and stuff. I tried to do it manually with Set/GetPixel, but that was way to slow! BitBlt with SRCPAINT wasn''t what I was expecting either. so how can I do it? Preferably that it''s customisable for example that I can change it to 40% tranperency. Thanks

Share this post


Link to post
Share on other sites
Advertisement
What API are you using? Under plain vanilla GDI it will be slow no matter what. Under DirectDraw you can make it a bit faster but only to a point (most of the cpu power will be spent doing just one image). What you need is to use hardware acceleration (OpenGL/Direct3D) to do the blending for you. The only question is if you want this for realtime effects or for file processing. If it''s for file processing (you are taking 2 images, combining them, and then saving the result) you should remove the graphics API part completely, and instead load the images into regular arrays where you can quickly access and blend the values.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
to extend VolkerG''s suggestion, and if you need ''95 support, you might want to look into the DrawDIB api calls which bypass GDI altogether. you can also use DIB bitmaps and manipulate the "pixels" directly. there''s quite a bit of code available via the ''net for this type of thing if you care to google around for a bit. codeguru and codeproject both have fairly large sets of C++ code for download.

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!