delphi 如何将TPath数据保存为`.jpg`图像

dphi5xsq  于 9个月前  发布在  其他
关注(0)|答案(1)|浏览(80)

我是新的 Delphi .我需要一个帮助来完成我的代码.我只是画了一个路径.现在我想保存到Android本地存储作为图像格式.这是我的代码

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Single);
begin
if ssLeft in Shift then
    Path1.Data.MoveTo(PointF(X,Y) - Path1.BoundsRect.TopLeft);
end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Single);
begin
 if ssLeft in Shift then
    Path1.Data.LineTo(PointF(X,Y) - Path1.BoundsRect.TopLeft);
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  //save code goes here
end;

字符串

wdebmtf2

wdebmtf21#

唯一对我有用的方法:

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  Path1.MakeScreenshot.SaveToFile('image.jpg'); // Save code
end;

字符串
以下选项均无效:

Path1.Canvas.Bitmap.SaveToFile('image.jpg'); // Results in AV
Path1.Canvas.Bitmap.Canvas.Bitmap.SaveToFile('image.jpg'); // Also results in AV

相关问题