I have a written a class which is able to display animated GIF files with Direct 2d as in this example from MSDN:
The GIF which I display is a continuously growing/shrinking not filled blue circle. All other pixels are White / the Background is White.
Unlike the example posted I create a CWnd, without Caption and Border, with the size of the GIF, with a ID2D1RenderTarget filling the whole CWnd and place it above the Content of my MainFrame.
Since I never used Direct2d before I assumed I can simply apply SetLayerdWindow() on my CWnd to reach my goal of only displaying the blue Circle.
SetLayeredWindowAttributes(RGB(255,255,255), 204, LWA_ALPHA | LWA_COLORKEY);
This should result in a CWnd with no White Pixels + 80% Transparency. Unfortunately the resulting Window is 80% transparent but none of the WhitePixels where removed/ the white pixels are still drawn.
Why does LWA_COLORKEY not work in this case? And how can I achieve that either my CWnd or ID2D1HwndRenderTarget will draw white as fully transparent?!
Note:
Besides that I've tried just for fun to draw a fully transparent background with the ID2D1HwndRenderTarget like:
m_pHwndRT->Clear(D2D1::ColorF(D2D1::ColorF::White, 0.0f));
With Microsoft stating: "The alpha value for the color to be constructed. An alpha channel value ranges from 0.0 to 1.0, where 0.0 represents a fully transparent color and 1.0 represents a fully opaque color. The default value is 1.0."
Which results in a fully white opaque window... Which made me wonder if this whole Transparency stuff is working at all