function CopyBlend(src: TImage32; srcRec, dstRec: TRect; blendFunc: TBlendFunction = nil): Boolean;
This function copies part or all of another image into the specified destination (dstRec).
When no blend function is provided, the contents of srcRec will simply overwrite whatever's in dstRec. However if srcRec and dstRec aren't the same size, then the srcRec image will be stretched to fit dstRec. (A blend function isn't needed when 'src' is fully opaque.)
When 'src' contains some transparency, then a blend routine is required to properly merge the two images. The library provides several predefined blend routines which will cover just about all blending requirements. Nevertheless, the library user can also use their own custom blend routines (using the TBlendFunction template). The 3 main predefined blend functions are - BlendToAlpha, BlendToOpaque & BlendMask.
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;
uses Img32, Img32.Fmt.PNG; ... img := TImage32.Create; img.LoadFromFile('lenna.png'); img2 := TImage32.Create; img.LoadFromFile('green_circle_blurred.png'); img.CopyBlend(img2, img2.Bounds, img.Bounds, BlendMask); img.SaveToFile('lenna_masked.png'); img.Free; img2.Free;
BlendMask, BlendToAlpha, BlendToOpaque, TBlendFunction
Copyright ©2010-2023 Angus Johnson - Image32 4.8 - Help file built on 17 Jan 2025