Nick Gammon said:
Twisol said:
Did you look at what it does? It just uses two modes of BitBlt, first applying the trasparency mask and then the image itself. It said it has no built-in, widely-compatible support as a segue for how to do it properly yourself. And I think it might simplify your implementation, too.
The current code does exactly that:
// Build mask based on transparent colour at location 0, 0
dcTrans.BitBlt (0, 0, iWidth, iHeight, &bmDC, 0, 0, SRCCOPY);
// Do the work
dc.BitBlt (0, 0, iWidth, iHeight, &bmDC, 0, 0, SRCINVERT);
dc.BitBlt (0, 0, iWidth, iHeight, &dcTrans, 0, 0, SRCAND);
dc.BitBlt (0, 0, iWidth, iHeight, &bmDC, 0, 0, SRCINVERT);
However, as he says "One bitmap specifies the image - and all the "transparent" areas are set to black. The other bitmap is monochrome / black and white.".
That is, this is a on/off sort of transparency, the exact thing that is now implemented. Not a 0-255 levels of transparency.
The issue was that your implementation is difficult, so I found another. Does the other implementation make it any easier? It seems like it only needs two blits.
Also, I was talking about WindowMergeImageAlpha; why is your code snippet taken from Draw/TranslateImage? :S
Nick Gammon said: There is no transparency colour in this particular case. The WindowTranslateImage uses a grayscale image to control the transparency with 256 levels of transparency. That is the thing you have to rotate.
The full transparency color, I meant. Fully see-through. Otherwise the space created around the rotation (since I need a bigger canvas) would be visible when it's merged into the target. |