gdiplus: Blend in the background colour.

Vincent Povirk madewokherd at gmail.com
Tue Oct 28 10:58:14 CDT 2014


> +    return ((b     + ((BYTE)bkgnd         * (255 - alpha) + 127) / 255) |

What's the purpose of adding 127 here?

>          stat = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead|ImageLockModeUserInputBuf,
>              PixelFormat32bppPARGB, &lockeddata);
>
> +        if (background & 0xffffff)
> +        {
> +            DWORD *ptr;
> +            UINT i;
> +            for (ptr = (DWORD*)bits, i = 0; i < width * height; ptr++, i++)
> +            {
> +                if ((*ptr & 0xff000000) == 0xff000000) continue;
> +                *ptr = blend_argb_no_bkgnd_alpha(*ptr, background);
> +            }
> +        }

I guess it wouldn't hurt anything, but it doesn't make much sense to
do this if LockBits fails.



More information about the wine-devel mailing list