Does GDI supports semi-transparency?

Posted on 2009-04-18
Last Modified: 2013-11-20
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)?

Question by:netformx
    LVL 86

    Accepted Solution

    >>Does GDI supports semi-transparency (real-time alpha blending)?

    Yes. The API you need is 'SetLayeredWindowAttributes()' ( See e.g. ("Transparency without Source Code") ("Making any application transparent in Windows 2000/XP")

    Author Comment

    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.
    LVL 86

    Expert Comment

    If your focus is transparent bitmaps or regions, you might be better off with ("Drawing Transparent Bitmap with ease with on the fly masks in MFC") or a ready-made control like ("CLayeredBitmapCtrl")

    Author Comment

    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.


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now