ImageEn, unit iexLayers

TIEPolylineLayer.SetPoints

TIEPolylineLayer.SetPoints


Declaration

// Point array overloads
procedure SetPoints(Points: array of TPoint; PointBase: TIEPointBase = iepbRange); overload;
procedure SetPoints(Points: array of TPoint; ClosePolyline: Boolean; PointBase: TIEPointBase = iepbRange); overload;

// Shape fill overload
procedure SetPoints(Shape: TIEShape; ClosePolyline: Boolean = True); overload;

// Arc overload
procedure SetPoints(StartAngle, SweepAngle: Double; PtCount: Integer = 0); overload;


Description

Set the points of the polyline.
Each point of the polyline is represented by an x and y value in the range 0 to 1000. Where (0, 0) is the top-left pixel of the layer and (1000, 1000) is the bottom-right.
If you use the Shape overload, the point array will be filled with a TIEShape.
PolylineClosed will be set to ClosePolyline.


Example

// Draw a triangle polygon
With TIEPolylineLayer( ImageEnView1.CurrentLayer ) do
begin
  ClearAllPoints();
  AddPoint( 500, 0 );
  AddPoint( 1000, 1000 );
  AddPoint( 0, 1000 );
  PolylineClosed := True;
end;
ImageEnView1.Update();

// Which is the same as..
var
  shapePoints: array of TPoint;
begin
  SetLength( shapePoints, 3 );
  shapePoints[0] := Point( 500, 0 );
  shapePoints[1] := Point( 1000, 1000 );
  shapePoints[2] := Point( 0, 1000 );
  TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( shapePoints, True );
  ImageEnView1.Update();
end;

// Which is the same as...
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( [ Point(500, 0), Point(1000, 1000), Point(0, 1000) ], True );
ImageEnView1.Update();

// Which is the same as...
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesTriangle, True );
ImageEnView1.Update();



// If PolylineClosed is not enabled, we get a polyline, instead of a polygon
TIEPolylineLayer( ImageEnView1.CurrentLayer ).PolylineClosed := False;
ImageEnView1.Update();



// Fill points with Star shape
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesStar5, True );



// Fill points with Explosion shape
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesExplosion, True );



// Fill points with Arrow shape
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesShootingArrowSW, True );



// Fill points with Lightning shape
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( iesLightningLeft, True );



// Fill layer with arc from 270 (6 o'clock) anti-clockwise to 180 (9 o'clock)
StartAngle := 270;
EndAngle := 90;
SweepAngle := EndAngle - StartAngle + 360;
if SweepAngle >= 360 then
  SweepAngle := SweepAngle - 360;
TIEPolylineLayer( ImageEnVect1.CurrentLayer).SetPoints( StartAngle, SweepAngle );


See Also

- Points
- AddPoint
- SetPoint
- RemovePoint