Link to home
Start Free TrialLog in
Avatar of PMH4514
PMH4514

asked on

Device Context / BitBlt / TransparentBlt and assembling scenes

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?

thanks
-Paul
ASKER CERTIFIED SOLUTION
Avatar of NawalKishore1976
NawalKishore1976

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NawalKishore1976
NawalKishore1976

Avatar of PMH4514

ASKER

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.