问题:使用 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) dobeginif (CurIndex >= Length(Points) - 1) and BreakAtEnd and (Points[0] <> Points[Length(Points) - 1]) then {--->删除这行 Break;} {+++>新增代码}// 修复曲线最后一点断线的问题 by Aone (2016/03/25)beginPieceDirVec := (DestPos - SrcPos).Normalize;ThickPerp := TPointF.Create(-PieceDirVec.Y, PieceDirVec.X) * FHalfThickness;InsertVertex(DestPos - ThickPerp, FStrokeColor);InsertVertex(DestPos + ThickPerp, FStrokeColor);if PrevVerticesPlaced thenbeginInsertIndex(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