BlendMask

function BlendMask(bgColor, mask: TColor32): TColor32;


A callback function that can be passed as a parameter to the TImage32.CopyBlend method.
This function uses the mask to either preserve or remove the background image. Whereever the mask is fully opaque (alpha = 255), the background image will be preserved; and whereever the mask is fully translucent, the background will be erased.

uses Img32, Img32.Fmt.PNG;
...
img := TImage32.Create;
img.LoadFromFile('./lenna.png');
img2 := TImage32.Create;
img2.LoadFromFile('./green_blur.png');
img.CopyBlend(img2, img2.Bounds, 
  img.Bounds, BlendMask);
img.SaveToFile('./lenna_fading.png');
img.Free;
    
Before:
After:

See Also

TImage32.CopyBlend, BlendBlueChannel, BlendInvertedMask