I want to blit 32bit image (PNG with alpha channel) over 32bit Bitmap (or Bitmap32).
I don't know how to tell function to blend image instead of bliting it. Like using AlphaBlend instead of BitBlt, I need to make this function to blend image instead of simple blit.
This is my example:
ABitmap is type of TBitmap32 (GR32), but the same result is with regular TBitmap with 32bit palette.
ABitmap.SetSize(GetWidth, GetHeight);
SetStretchBltMode(ABitmap.Handle, COLORONCOLOR);//HALFTONE);
ABitmap.Clear($FFFFFFFF); { Here I try to erase background with white color, so that new image is blit over white surface }
StretchDIBits(
ABitmap.Handle,
0, 0,
GetWidth, GetHeight,
0, 0,
GetWidth, GetHeight,
FreeImage_GetBits(Dib),
FreeImage_GetInfo(Dib)^,
DIB_RGB_COLORS,
SRCCOPY); // --- SRCAND etc. produce not good results
FreeImage_GetBits and FreeImage_GetInfo are FreeImage library functions that point to the start of bit array and point to the structure.
What ever I do StretchDBit doesn't allow blending.