var
Stream: TStream;
CanvasPage: TImagingCanvas;
Watermark: TSingleImage;
CanvasWater: TImagingCanvas;
R: TRect;
begin
Stream := TResourceStream.Create(HInstance, 'ImageWatermark', RT_RCDATA);
Watermark := TSingleImage.CreateFromStream(Stream);
Stream.Free;
CanvasWater := TImagingCanvas.CreateForImage(Watermark);
// Page.Image is a TSingleImage instance
CanvasPage := TImagingCanvas.CreateForImage(Page.Image);
if Page.Width > Page.Height then
R := Rect(Round(Page.Width * 0.6), 0, Page.Width, Page.Height)
else
R := Rect(Round(Page.Width * 0.45), 0, Page.Width, Page.Height);
R := ScaleRectToRect(Watermark.BoundsRect, R);
R := Rect(R.Left, Page.Height - (R.Bottom - R.Top), R.Right, Page.Height);
CanvasWater.StretchDrawAlpha(Watermark.BoundsRect, CanvasPage, R);
... save to file, free canvases etc.
var
img : timagedata;
img1 : timagedata;
img2 : timagedata;
img3 : timagedata;
begin
InitImage(Img);
InitImage(Img1);
InitImage(Img2);
loadimagefromfile(im1,img1);
loadimagefromfile(im2,img2);
newimage(214,384,ifDefault,img);
imaging.CopyRect(img1,0,0,img1.width,img1.Height,img,0,0);
imaging.CopyRect(img2,0,0,img2.width,img2.Height,img,0,192);
saveimagetofile(finalimage,img);
Page created in 0.032 seconds with 19 queries.