2
0
Johann ELSASS 2 жил өмнө
parent
commit
2d4c1f2a79

+ 1 - 0
lazpaintcontrols/lcvectororiginal.pas

@@ -2741,6 +2741,7 @@ var
   i: Integer;
 begin
   result := EmptyRectF;
+  if ACount = 0 then exit;
   if (AStartIndex < 0) or (AStartIndex+ACount > ShapeCount) then
     raise exception.Create(rsIndexOutOfBounds);
   for i := AStartIndex to AStartIndex+ACount-1 do

+ 23 - 0
lazpaintcontrols/lcvectorpolyshapes.pas

@@ -112,6 +112,8 @@ type
     constructor Create(AContainer: TVectorOriginal); override;
     procedure Clear;
     function AddPoint(const APoint: TPointF): integer; virtual;
+    procedure AddPointRange(const APoints: array of TPointF);
+    function GetPointRange: ArrayOfTPointF;
     function RemovePoint(AIndex: integer): boolean;
     procedure RemovePointRange(AFromIndex, AToIndexPlus1: integer);
     procedure InsertPoint(AIndex: integer; APoint: TPointF);
@@ -616,6 +618,7 @@ var
   i: Integer;
   m: TAffineMatrix;
 begin
+  result := nil;
   setlength(result, PointCount);
   m:= MatrixForPixelCentered(AMatrix);
   for i := 0 to PointCount-1 do
@@ -916,6 +919,26 @@ begin
   Points[result] := APoint;
 end;
 
+procedure TCustomPolypointShape.AddPointRange(const APoints: array of TPointF);
+var
+  i: Integer;
+begin
+  BeginUpdate(TCustomPolypointShapeDiff);
+  for i := 0 to high(APoints) do
+      AddPoint(APoints[i]);
+  EndUpdate;
+end;
+
+function TCustomPolypointShape.GetPointRange: ArrayOfTPointF;
+var
+  i: Integer;
+begin
+  result := nil;
+  SetLength(result, PointCount);
+  for i := 0 to PointCount-1 do
+      result[i] := Points[i];
+end;
+
 function TCustomPolypointShape.RemovePoint(AIndex: integer): boolean;
 begin
   if (AIndex < 0) or (AIndex >= PointCount) then exit(false);