zoukankan      html  css  js  c++  java
  • [修复] 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

  • 相关阅读:
    【AngularJS】学习资料
    Anaconda环境安装
    ORM表之间高级设计
    drf序列化和反序列化
    安装与使用django-restframework
    django-restframework
    顶象滑块验证码
    Restful接口规范
    Web API接口
    BBS配置
  • 原文地址:https://www.cnblogs.com/onechen/p/5319631.html
Copyright © 2011-2022 走看看