设为首页 加入收藏

TOP

[修复] Firemonkey 使用 DrawPath 断线问题(Android & iOS 平台)
2017-10-10 12:06:29 】 浏览:2505
Tags:修复 Firemonkey 使用 DrawPath 断线 问题 Android iOS 平台

问题:使用 Canvas.DrawPath 绘制时,最后一点无法画到终点位置。(这个问题要在粗线才能察觉)

适用:Delphi 10 Seattle (或更早的版本) for Android & iOS

修复方法:

请将源码 FMX.StrokeBuilder.pas 复制到自己的工程目录里,再进行修改。

procedure TStrokeBuilder.BuildSolidPolygon(const Points: TPolygon; const Opacity: Single; BreakAtEnd: Boolean);

...略...

  while CurIndex < Length(Points) do
  begin
    if (CurIndex >= Length(Points) - 1) and BreakAtEnd and (Points[0] <> Points[Length(Points) - 1]) then
{--->删除这行 Break;}
{+++>新增代码}
    // 修复曲线最后一点断线的问题 by Aone (2016/03/25)
    begin
      PieceDirVec := (DestPos - SrcPos).Normalize;
      ThickPerp := TPointF.Create(-PieceDirVec.Y, PieceDirVec.X) * FHalfThickness;

      InsertVertex(DestPos - ThickPerp, FStrokeColor);
      InsertVertex(DestPos + ThickPerp, FStrokeColor);

      if PrevVerticesPlaced then
      begin
        InsertIndex(FCurrentVertex - 3);
        InsertIndex(FCurrentVertex - 1);
        InsertIndex(FCurrentVertex - 2);

        InsertIndex(FCurrentVertex - 2);
        InsertIndex(FCurrentVertex - 4);
        InsertIndex(FCurrentVertex - 3);
      end;

      Break;
    end;
{<+++}

...略...

end;

效果:

 

官方有人提交 QC 了: 

RSP-14309: [iOS & Android] Delphi 10.1 Berlin - drawing problems
https://quality.embarcadero.com/browse/RSP-14309

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇[函數] Firemonkey 各平台 ".. 下一篇Delphi_03_Delphi_Object_Pascal_..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目