BlendToAlpha

function BlendToAlpha(bgColor, fgColor: TColor32): TColor32;


A callback function that's passed to the TImage32.CopyBlend method.

Like BlendToOpaque, this function also blend merges images. However, unlike BlendToOpaque, this callback function will combine images that both contain partial transparency. (While this function could also be used to blend merge images onto fully opaque backgrounds, the BlendToOpaque callback function is recommended there simply because it's a little faster.)

uses Img32, Img32.Fmt.PNG;
...
img := TImage32.Create;
img.LoadFromFile('green_circle_blurred.png');
img2 := TImage32.Create;
img2.LoadFromFile('beetle.png');
img.CopyBlend(img2, img2.Bounds, 
  img.Bounds, BlendToAlpha);
img.SaveToFile('beetle_on_green.png');
img.Free;
img2.Free;
    
Before:
After:

See Also

TImage32.CopyBlend, BlendToOpaque