<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    On 3/4/20 12:42 PM, Ziqing Hui wrote:<br>
    <br>
    <blockquote type="cite">
      <pre style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; overflow-wrap: break-word; white-space: pre-wrap;">+    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;
+    }
+</pre>
    </blockquote>
    I think it's possible ILS_SATURATE should be used for that. Have you
    checked rendering on Windows with this flag?<br>
  </body>
</html>