[PATCH 2/2] comctl32/toolbar: Correctly draw disabled toolbar button which contains 32 bpp bitmap with alpha channel.
Ziqing Hui
zhui at codeweavers.com
Wed Mar 4 04:28:42 CST 2020
No, I didn't check it. I don't know this flag before. I'll give it a try.
On 3/4/20 6:04 PM, Nikolay Sivov wrote:
> On 3/4/20 12:42 PM, Ziqing Hui wrote:
>
>> + 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?
>
More information about the wine-devel
mailing list