DirectDraw + Color color window key?

I create a window with WS_EX_LAYERED and set a color key for it using SetLayeredWindowAttributes() . I can verify that this color key really creates a transparent patch in the window by drawing a simple rectangle using FillRect() inside the window. However, this does not work when I draw a window using DirectDraw. I create an IDirectDrawSurface7 in a window and I Blt() add a few pixels to it. some pixels are colored with a color key, but I do not see them transparent, they just appear in the color key.

Is there anything inherent in the DirectDraw surface that conflicts with the layered color keyboard of the window?
When I set the alpha value with SetLayeredWindowAttributes() , it looks like it works fine with the DirectDraw surface, and it really looks translucent.

+5
source share
1 answer

I don’t know if you saw this, but this paragraph from the article published below looks something like what you are looking for.

The hWnd is the window handle of a window with a WS_EX_LAYERED style flag. The dwFlags parameter can have one or both of LWA_COLORKEY and LWA_ALPHA. If a LWA_COLORKEY flag is used, the crKey parameter is the transparent color key. If a LWA_ALPHA flag is used, the bAlpha parameter is the constat source alpha value. **Only top-level windows can be layered windows.**

I think this last sentence is a problem here. The source is part of a book on Google books. You can read it with sample code examples found here:

http://books.google.com/books?id=-O92IIF1Bj4C&pg=PA720&lpg=PA720&dq=WS_EX_LAYERED+%2B+DirectDraw+color+key&source=bl&ots=SyWKE3aimb&sig=DXbshrEk2tN17h7CtWdMmAkHlAo&hl=en&sa=X&ei=7_JcVKSyFMukNrumgMgB&ved=0CCkQ6AEwAg#v=onepage&q=WS_EX_LAYERED % 20% 2B% 20DirectDraw% 20color% 20key & f = false

I will also include the following links that tell a little about him, although not in nearly the same amount of detail:

http://web.cs.wpi.edu/~matt/courses/cs563/talks/cbyrd/pres3.html

http://msdn.microsoft.com/en-us/library/windows/hardware/ff567254(v=vs.85).aspx

I don’t know if this will answer your question, but I hope this helps a little. Greetings.

+2
source

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


All Articles