- 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.