+ has_alpha = FALSE;
+ if (bmp.bmBitsPixel == 32)
+ {
+ for (pixel = bits; pixel < bits + cx * cy; pixel++)
+ {
+ if ((*pixel >> 24) != 0)
+ {
+ has_alpha = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (has_alpha)
+ {
+ /* gray the src image */
+ for (pixel = bits; pixel < bits + cx * cy; pixel++)
+ {
+ DWORD alpha = (*pixel >> 24) & 0x000000ff;
+ DWORD red = (*pixel >> 16) & 0x000000ff;
+ DWORD green = (*pixel >> 8) & 0x000000ff;
+ DWORD blue = (*pixel) & 0x000000ff;
+ DWORD gray = (red * 299 + green * 587 + blue * 114) / 1000;
+ gray = gray * alpha / 0xff;
+ *pixel = ((alpha << 24) | (gray << 16) | (gray << 8) | gray);
+ }
+ bf.BlendOp = AC_SRC_OVER;
+ bf.BlendFlags = 0;
+ bf.SourceConstantAlpha = 0xff;
+ bf.AlphaFormat = AC_SRC_ALPHA;
+ GdiAlphaBlend(hdc, x, y, cx, cy, hdcImage, 0, 0, cx, cy, bf);
+ goto done;
+ }
+
I think it's possible ILS_SATURATE should be used for that. Have you
checked rendering on Windows with this flag?