Device Context / BitBlt / TransparentBlt and assembling scenes
Posted on 2005-04-21
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?