【问题标题】:Flip TPath shape data horizontally水平翻转 TPath 形状数据
【发布时间】:2020-07-29 21:30:30
【问题描述】:

如何翻转 TPath 形状组件数据?我已经从 SVG 图像中加载了路径数据,但是形状被翻转了,我想水平翻转它。

我尝试使用Canvas.CopyRec 方法,但我认为这是一种 VCL 方法。

var src, dest: TRect;
begin
  dest:=bounds(0, 0, image1.Picture.Width, image1.Picture.Height);
  //src:=rect(0, image1.Picture.Height-1, image1.Picture.Width-1, 0); // Vertical flip
  //src:=rect(image1.Picture.Width-1, 0, 0, image1.Picture.Height-1); // Horizontal 
  flip
  src:=rect(image1.Picture.Width-1, image1.Picture.Height-1, 0, 0); // Both flip
  image1.Picture.Bitmap.Canvas.CopyRect(dest, image1.Picture.Bitmap.Canvas, src);

我正在使用 Firemonkey 和 Delphi 10.3.2

【问题讨论】:

    标签: delphi firemonkey delphi-10.3-rio


    【解决方案1】:

    可以通过组件TPath的属性Scale.X中的负值来实现水平翻转的简单解决方案。

    Path1.Scale.X := -1; 
    

    对于垂直翻转使用path1.Scale.Y := -1;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-21
      • 1970-01-01
      相关资源
      最近更新 更多