ImageEn, unit iexLayers

TIEPolylineLayer


Declaration

TIEPolylineLayer = class(TIELayer);


Description

TImageEnView supports multiple layers, allowing the creation of a single image from multiple source images (which can be resized, rotated, moved, etc).
TIEPolylineLayer is a descendent of TIELayer that displays a line formed from multiple points. It can also be closed to display a polygon.



You can easily add curved lines to polyline layers:



You can create polyline layers with code using LayersAdd or by user action by setting MouseInteractLayers:

Item Description
mlClickCreatePolylineLayers Click multiple points to create a polyline layer
mlDrawCreatePolylineLayers Click and drag to freehand draw a polyline layer
mlEditLayerPoints Click and drag points to move them. Click on the polyline to add a point, Alt key to convert a point to a curve, Ctrl+click or delete key to remove a point
mlCreatePolylineLayers Drag the area of a polyline layer (must use code to add points)
* Auto-closing of the polyline layer is controlled by LayersAutoClosePolylines.

Review the Layer Documentation for a full description of layer support.


Demos

Demo Description Demo Project Folder Compiled Demo
Line Layer Editing Creating and point editing line, poly-line and angle layers \Demos\LayerEditing\Layers_Lines\Layers.dpr   
All Layer Editing Usage of image, shape, text and line layers \Demos\LayerEditing\Layers_AllTypes\Layers.dpr   
Magic Fill to Polygon Creates a polygon (closed TIEPolylineLayer) by performing a magic selection on an image (matching color range) \Demos\LayerEditing\MagicFillToPolygon\Magic2Polygon.dpr   


Examples

// 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();




// Allow users to create and edit a polygon
ImageEnView1.LayersAutoClosePolylines := iecmAlways;
ImageEnView1.MouseInteractLayers := [ mlClickCreatePolylineLayers, mlEditLayerPoints ];

// Allow users to freehand draw a polyline
ImageEnView1.MouseInteractLayers := [ mlDrawCreatePolylineLayers, mlEditLayerPoints ];

// Allow users to create and edit a polyline
ImageEnView1.LayersAutoClosePolylines := iecmManual;
ImageEnView1.MouseInteractLayers := [ mlClickCreatePolylineLayers, mlEditLayerPoints ];




Hold Alt to convert a line to a curve...




Methods and Properties

General
Public Method  Assign
Public Method  ConvertToImageLayer
Public Method  CopyToBitmap
Public Property  DrawingInfo
Public Property  DrawOuter
Public Method  DrawToCanvas
Public Method  GetProperties
Public Property  Guid
Public Property  GroupIndex
Public Property  Hint
Public Property  IsMask
Public Property  Kind
Public Property  LayerIndex
Public Property  Locked
Public Property  MaskInverted
Public Property  Modified
Public Property  Name
Public Property  Selectable
Public Property  Selected
Public Method  SetProperties
Public Method  Swap
Public Method  SupportsFeature
Public Property  Tag
Public Property  URL
Public Property  UserData
Public Property  UserDataLen
Public Property  Visible
Public Property  VisibleBox

Polygon Points
Public Method  AddCurvePoints
Public Method  AddPoint
Public Method  ClearAllPoints
Public Method  GetPointEx
Public Method  InsertCurvePoints
Public Method  InsertPoint
Public Property  PolylineClosed
Public Property  Points
Public Property  PointCount
Public Method  RemovePoint
Public Method  SetPoint
Public Method  SetPoints
Public Method  SimplifyPolygon
Public Method  SmoothJaggedEdges

Style
Public Property  AntiAlias
Public Property  AlphaEdgeFeathering
Public Property  Cropped
Public Property  FillColor
Public Property  FillColor2
Public Property  FillGradient
Public Property  FillOpacity
Public Property  Flip
Public Property  InnerGlow
Public Property  LineColor
Public Property  LineWidth
Public Property  Opacity
Public Property  Operation
Public Property  Rotate
Public Property  SoftShadow

Size and Position
Public Property  AspectRatioLocked
Public Property  AutoSize
Public Method  CalculateArea
Public Method  CalculateCentroid
Public Method  CalculateLength
Public Property  ClientAreaBox
Public Method  ConvXBmp2Scr
Public Method  ConvXScr2Bmp
Public Method  ConvYBmp2Scr
Public Method  ConvYScr2Bmp
Public Property  Height
Public Property  PosX
Public Property  PosY
Public Method  PreferredAspectRatio
Public Method  RestoreAspectRatio
Public Property  Width

 Unique to TIEPolylineLayer



See Also

- LayersAdd
- LayersInsert
- TIELayerKind
- MouseInteractLayers