function BlendToOpaque(bgColor, fgColor: TColor32): TColor32;
A callback function that can be passed as a parameter to the TImage32.CopyBlend method. This function blends a semi-transparent image onto an opaque background. (If the background image also has some transparency, then the BlendToAlpha callback function should be used.)
uses Img32, Img32.Fmt.PNG;
...
img := TImage32.Create;
img.LoadFromFile('fruit.png');
img2 := TImage32.Create;
img2.LoadFromFile('beetle.png');
img2.Resize(20,20);
img.CopyBlend(img2, img2.Bounds,
Rect(100,100,120,120), BlendToOpaque);
img.SaveToFile('beetle_on_fruit.png');
img.Free;
img2.Free;
After:
TImage32.CopyBlend, BlendToAlpha
Copyright ©2010-2023 Angus Johnson - Image32 4.8 - Help file built on 16 Apr 2025