rotate transparent bitmap
I made a pic previewer based on CZoomScrollWindowImpl (I modified the sample in message 11073). I even convinced it to paint alpha transparent bitmaps using AlphaBlend. Now I am working on simple clockwise rotation. It works, but not for transparency. Here's the main idea
1. start with a DIB
2. cretate GDI+ bitmap
3. rotate using RotateFlip
4. retrieve HBITMAP and continue painting with GDI (plain)
HBITMAP hStraight = <something>, bmTurned = 0;
Gdiplus::Bitmap gdibm(hStraight, 0);
gdibm.GetHBITMAP(Gdiplus::Color::Transparent, &bmTurn ed);
that works as expected for plain bitmaps. If I continue cycling the operation, feeding the resulting bitmap back to step 1, it keeps on turning 90 degrees.
If I try the above steps with a PARGB (premultiplied as needed by AlphaBlend), the transparency is lost. The bitmap turns but instead of transparency I get the black background.
I found a solution that creates a PixelFormat32bppPARGB gdi+ bitmap in step 2 as follows:
Gdiplus::Bitmap newBitmap(bmpInfo.bmWidth, bmpInfo.bmHeight, bmpInfo.bmWidthBytes, PixelFormat32bppPARGB, (BYTE*)bmpInfo.bmBits);
using this instead of the HBITMAP constructor, the rotation takes into account the alpha ch annel, and even paints ok, however if I keep on feeding the resulting turned bitmap to the procedure, instead of getting all turn angles (90, 180, 270, 360=0) it gets stuck in the cycle 90-180-90-180...
The 180 degree turned pic should turn into 270, but instead it goes to 90 degrees (!). Very weird
btw, it doesn't have to do anything with CZoomScrollWindowImpl, because I used a normal paint DC (not anisotropic) and it still has the same problems
what can be wrong?