张志峰的博客

水滴石川,积少成多。

导航

delphi Image处理

Posted on 2017-11-08 18:10  ╰★张志峰★╮  阅读(561)  评论(0编辑  收藏  举报

procedure ImageDrawText(ATextEdo: IGGCCADTextEDO);
var
oImageBitmap: TBitmap;
x1,x2,y1,y2: double;
begin
// 加载图片
oImageBitmap := TBitmap.Create;
try
oImageBitmap.LoadFromFile(FImageDeviceFile);
x1 := FImageDeviceBox.StartPt.X;
y1 := FImageDeviceBox.StartPt.Y;
x2 := ATextEdo.MarkPoint.X;
y2 := ATextEdo.MarkPoint.Y;
oImageBitmap.Width := oImageBitmap.Width + Round(ATextEdo.Width/FScale_X);
oImageBitmap.Height := oImageBitmap.Height + Round(ATextEdo.Height/FScale_Y);
oImageBitmap.Canvas.TextOut(Round(ATextEdo.Width/FScale_X), Round(ATextEdo.Height/FScale_Y), ATextEdo.Text);
oImageBitmap.SaveToFile(FImageDeviceFile);
finally
oImageBitmap.Free;
end;
end;