I'm creating a window with WS_EX_LAYERED
and setting a color key to it using SetLayeredWindowAttributes()
. I can verify that this color key indeed creates a transparent patch in the window by drawing a simple rect using FillRect()
inside the window. This doesn't work however when I'm drawing in the window using DirectDraw. I'm creating an IDirectDrawSurface7
on the window and I'm Blt()
ing some pixels to it. some of the pixels are colored with the color key, but I don't see them as transparent, they just appear in the color key.
Is there something inherent in DirectDraw surface that conflicts with layered window color keying?
When i'm setting an alpha value using SetLayeredWindowAttributes()
, that seem to work fine with the DirectDraw surface and it does indeed appear translucent.
I don't know if you've seen this but this paragraph from the article posted below looks kinda 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 its that last sentence that is the problem here. The source is a partial of a book on google books. You can read it with some code detail 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 talk about a little about it, 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 it helps a little bit. Cheers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With