Device Context / BitBlt / TransparentBlt and assembling scenes

Posted on 2005-04-21
Last Modified: 2013-11-20
My scenario is like this.  I have a stream of 1000x1000 bitmaps coming in from hardware.  I created a class COverlay that implements its own memory DC, and there are several derived COverlay's, each one knows how to draw itself.

I've done it like this because the overlays don't need to be redrawn frame-by-frame, so I draw them once into their memory DC, and then when I need to apply the overlay to the stream of frames, I can just Blt the overlay to the frame.

Not quite so simple.  Let me describe the problem.  If I create a memory surface and fill it with black, and then proceed to draw my overlay material into that, I can't just do a BitBlt onto the frame surface, using SRCCOPY because then all I see is a black frame with the overlay drawing.

My inclination is to fill the background of my memory surface with an odd color that isn't used elsewhere, and then do a transparent blt. I think that would work but I can't help but think there is a more appropriate way.   Is there a dwRop flag that I'm missing?   My need is simple, allow me to maintain a memory DC that has infrequently changed drawings in it, and overlay that DC transparently onto an incoming stream of bitmaps. That being said, Is TransparentBlt the answer or something more suitable?

Question by:PMH4514
    LVL 3

    Accepted Solution

    LVL 3

    Expert Comment


    Author Comment

    interesting. they both have ways of drawing transparent images w/o TransparentBlit()

    is TransparentBlt() inefficient?

    I currently fill my mem DC with a globally defined transparency colorref, draw over top that, and then TransparentBlt() my mem DC (the affected region within it at least) to the composite DC.

    it seems to work ok, but it's just a *bit* sluggish

    of course I am dealing with two 15fps streams of 1000x1000 32bit images into which I'm overlaying composits, this I'm sure is creating a performance hit (time to look at higher end video cards!) - which is why I'm looking for ways to optimize.

    those codeproject links are both interesting, but not very useful in that they basically do what I'm doing.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
    Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
    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.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    734 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

    17 Experts available now in Live!

    Get 1:1 Help Now