BlendInvertedMask

function BlendInvertedMask(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. Where ever the mask is fully opaque (alpha = 255), the background image will be erased; and where ever the mask is fully translucent, the background will be preserved.

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, BlendInvertedMask);
img.SaveToFile('./lenna_erasing.png');
img.Free;
    
Before:
After:

See Also

TImage32.CopyBlend, BlendMask