Archived

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

Transparent Bitmaps

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

Can someone tell me how to make a .bmp background transaprent with Windows(API)? I don''t want to use DirectX or OpenGL, I just want to know how to do it using the GDI. Thanx

Share this post


Link to post
Share on other sites
The way to do it is with two bitmaps, the actual image, and mask that defines the transparent area.

In the actual image, transparent areas will be black (you can also use black in opaque areas, it''ll still work.) In the mask, white areas will be opaque, and black areas will be transparent.

Firstly, use BitBlt to blit the mask to the DC, using the SRCOR operator. Then, BitBlt the image to the DC using the SRCAND operator.

If you have access to the MSDN, that''ll tell you about BitBlt, and a bit more detail about using masks. The online MSDN doesn''t appear to have BitBlt in it, but that may just be me failing to use search properly.

''Nuff said. I''ll enjoy watching you live, demon.

Share this post


Link to post
Share on other sites
The API was extended on windows 98R2 with the library msimg32.dll, that contains the functions "TransparentBlt()" and "AlphaBlend()".
I''m not sure about how to use this functions, but if u''r using Delphi, check the library FastLib at http://gfody.com, it uses these functions on unit FastDib.pas.

Share this post


Link to post
Share on other sites