Does GDI supports semi-transparency?

I'm using visual c++ 2005 with MFC.

I would like to draw a shape, a bitmap etc in half transparancy, i.e. in such a way that we should still be able to see whatever is beneath the shape.
Does GDI supports semi-transparency (real-time alpha blending)?

Thanks,
netformxAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
>>Does GDI supports semi-transparency (real-time alpha blending)?

Yes. The API you need is 'SetLayeredWindowAttributes()' (http://msdn.microsoft.com/en-us/library/ms633540(VS.85).aspx). See e.g.

http://www.codeproject.com/KB/winsdk/trans.aspx ("Transparency without Source Code")
http://www.codeproject.com/KB/dialog/wintrans1.aspx ("Making any application transparent in Windows 2000/XP")
0
 
netformxAuthor Commented:
Not sure this is what I was looking for.
How would you suggest to draw a semi-transparnt shape on top of other opaque shapes?
Should I create a differnt window for the semi-transparent shape and then use API function SetLayeredWindowAttributes?

Thanks in advance.
0
 
jkrCommented:
If your focus is transparent bitmaps or regions, you might be better off with http://www.codeproject.com/KB/graphics/transbitmapmask.aspx ("Drawing Transparent Bitmap with ease with on the fly masks in MFC") or a ready-made control like http://www.codeproject.com/KB/static/LayeredBitmapCtrl1.aspx ("CLayeredBitmapCtrl")
0
 
netformxAuthor Commented:
Hi,
both examples refer to full-transparency (i.e. bitmaps that are partialy opaque and partialy fully-transparent using a 1/0 mask).
I know this is feasible but my question refers to semi-transparency. See attached example.
Thanks

SemiTransparent.JPG
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.