Blt () to create a layer effect. Does not work. Am I using the wrong boolean function or something else?

I have one window that is drawn by various objects to create a multi-level effect (think that one of the objects draws one compass and the other draws grid lines, the other draws an altimeter, etc.). Thus, each object has a bitmap with black memory to which it refers. When I call this function Draw Draw objects, the memory bitmap is split into the application window. The bitmaps of the memory are all black to start, and the object draws on it. Black is transparent, so it is masked. The result is an overlay effect.

So, I used OR as my boolean function in the blt () function, and it worked. But I noticed that if the previous layer was painted white, then the layer that is drawn on top of it looks as if it is below the previous layer. White (ish) colors are the only ones where this effect occurs. All other colors are colored correctly (i.e. the Layer looks as if it were drawn on top of the previous one, etc.). Has anyone seen this phenomenon?

+3
source share
4 answers

. BitBlt , , , , OR, . TransparentBlt. , .

+2

, GDI, , BitBlt, ? ORing ? , BitBlt HDC, .

, ? , OR . ,

a | b == b | a

(a | b) | c == a | (b | c)

, , . , .

, , , , , GDI.

+1

BitBlt OR? AlphaBlend(), .

0

, , : ( ), .

Do it manually, you need to make a monochrome mask from the overlay bitmap, with white in the transparent parts and black in the opaque parts. And a mask with a destination, then OR color data from your original overlay.

screen AND mask OR overlay

And if this is for full-screen material, you might want to make the composition in a bitmap off-screen to avoid flickering.

Peter Ruderman's suggestion to use TransparentBlt is probably a good one, although I have never tried it myself.

0
source

Source: https://habr.com/ru/post/1710011/


All Articles