Show/Hide Toolbars

RiverSoftAVG Products Help

TRSPathData represents a series of connected curves and lines.

noteNote

Unlike the Delphi TPathData class, TRSPathData works with both FMX and VCL and may be drawn to either libraries' TCanvas. The TRSPathData class provides much more robust parsing of data strings than TPathData to fulfill the SVG specification for paths. Finally, there are many additional methods in TRSPathData compared to TPathData (for example, AddPolygon).

Use TRSPathData to build graphic shapes by connecting a series of curves and lines. TRSPathData can be drawn and filled on objects that have a TCanvas as a component. For VCL, call the    DrawPath and    FillPath methods. The TVclCanvasHelper also implements DrawPath and FillPath methods for VCL TCanvas.

TRSPathData maintains the coordinates of geometric shapes in world coordinate space in an array of RSGraphics.TRSPathPoint. Each saved point has a specific type, to identify the primitive shape it is defining. Complex shapes of a TRSPathData are composed of a sequence of primitive shapes like lines and curves. To access the array of TRSPathPoint, use Count and Points.

A TRSPathData can be initialized by setting the Data property, or by adding explicitly each new shape. TRSPathData has defined a way to add shapes explicitly. See the TRSPathData functions.
 
When a TRSPathData is constructed, each new added shape is appended to the end of the TRSPathData, by default. The start point of the new shape is the end point of the previous shape. To customize the start point of a new element to be added, use the MoveTo or MoveToRel method.
 

Namespace: RSGraphics

public property

Distances

Returns the distance to every point in the path

noteNote

It is recommended to     Flatten the path before calling this property.

published property

FillMode

Specifies how to fill areas that are formed when the path intersects itself.

noteNote

This property is ignored in FMX.

published property

FormatStr

Defines a floating point format string for writing out the path points.

Use the FormatStr property to control the size of the Data string.

public property

OnChanged

Occurs when the path data has changed.

Write an OnChanged event handler to respond to path changes.

public property

Points[Integer]

Specifies the points from the current TRSPathData and their types.

Points gets the point and its type, specified by the index in the array of points of the TRSPathData. Use Points to access the internal array of TRSPathPoint of the TRSPathData.
 

public property

Polygons

Returns the polygons (array of points) that make up the path.

noteNote

It is recommended to     Flatten the path before calling this property.

protected property

UpdateCount

Tracks the number of times   BeginUpdate has been called without a corresponding   EndUpdate call.

Top

CurveTo adds the control points and the end point of the curve to the Points array. The added points are of type ppCurveTo.

To move the start point of the curve, call the     MoveTo or     MoveToRel method before calling CurveTo.

To find the end point of the TRSPathData, call the     LastPoint method.

public method

CurveToRel(TRSPoint,TRSPoint,TRSPoint)

Appends a curve to the current TRSPathData.

The curve is defined by 4 points that depend on the last point of the current TRSPathData.

The start point of the curve is the end point of the TRSPathData.

The ControlPoint1 and ControlPoint2 parameters' coordinates specify the distances to the end point of the current TRSPathData, on each axis, for each of the two control points of the curve.

The EndPoint parameter's coordinates specify the distances to the end point of the current TRSPathData, on each axis, for the end point of the curve.

CurveToRel adds the control points and the end point of the curve to the Points array. The coordinates for each added point are equal to the sum between the coordinates of the last point and the coordinates of the corresponding point specified by the parameters. The added points are of type ppCurveTo.

To move the start point of the curve, call the     MoveTo or     MoveToRel method before calling CurveToRel.

To find the end point of the TRSPathData, call the     LastPoint method.

protected method

DefineProperties(TFiler)

Sets the virtual properties for reading and writing the path data stream.

DefineProperties overrides TPersistent.DefineProperties for reading and writing path data from or to a TStream object, respectively.

It creates a virtual property, Path, that can be treated as a property to read from or write data to the TRSPathData object. It first calls the TPersistent.DefineProperties inherited method.

protected method

DrawPath(TCanvas,Boolean,Single)

Overloaded. Draws or Fills the path to the canvas.

public method

DrawPath(TCanvas,Single)

Overloaded.  Draws a path on the current TCanvas.

DrawPath draw a TRSPathData, with the current Stroke or Pen.

If the path is empty, DrawPath does nothing. In this case, DrawPath does not raise any errors.

public method

EndUpdate

Reenables OnChanged events after BeginUpdate has been called.

BeginUpdate and     EndUpdate work to defer OnChanged events while a path is being modified. Use the BeginUpdate method to defer OnChanged events until an equal number of EndUpdate methods have been called.

public method

FillPath(TCanvas,Single)

Overloaded.  Fills a path on the current TCanvas.

FillPath fills a TRSPathData, with the current Stroke or Pen.

If the path is empty, FillPath does nothing. In this case, FillPath does not raise any errors.

public method

FitToRect(TRSRect)

Translates and scales the current TRSPathData to fit a specified rectangle area.
 

public method

Flatten(Single)

Converts each curve in the current TRSPathData into a sequence of connected line segments.

The Flatness parameter specifies the maximum permitted error between the curve and its flattened approximation. By default, it is 0.25. Reducing the flatness value will increase the number of line segments in the approximation.

public method

FlattenToPolygon(TRSPolygon,Single)

Converts the current TRSPathData into a sequence of connected line segments and returns the sequence as a TRSPolygon.

The Polygon parameter is the return variable. It is the result of the conversion.

Flatness is an optional parameter that specifies the maximum permitted error between the curve and its flattened approximation. By default, it is 0.25. Reducing the flatness value will increase the number of line segments in the approximation.

public method

GetBounds

Returns the bounding rectangle of the current TRSPathData. When the path is drawn, the rectangle returned by GetBounds is not affected by the thickness and style of the pen stroke.
 

public method

GetLength

Returns the length of the path.

noteNote

It is recommended to     Flatten the path before calling this method.

public method

HLineTo(Single)

Appends a line to the current TRSPathData.

The line is defined by the end point of the TRSPathData and a point that depends on the specified parameter.

HLineTo adds the specified point to the     Points array. The end point of the line is moved horizontally from the last point of the TPathData to the point with the x-coordinate equal to X. The added point is of type ppLineTo.

To move the start point of the line, call     MoveTo or     MoveToRel before calling HLineTo.

To find the last point of the TRSPathData, call the     LastPoint method.

public method

HLineToRel(Single)

Appends a line to the current TRSPathData.

The line is defined by the end point of the TRSPathData and a point that depends on the specified parameter.

HLineToRel adds the specified point to the     Points array. The The end point of the line is moved horizontally by a distance equal to X to the end point of the TRSPathData. The added point is of type ppLineTo.

To move the start point of the line, call     MoveTo or     MoveToRel before calling HLineToRel.

To find the last point of the TRSPathData, call the     LastPoint method.

public method

IsEmpty

Return true if there are no points in the path

public method

LastPoint

Returns the end point of the current TRSPathData. LastPoint returns a TRSPoint.

public method

LineTo(TRSPoint)

Appends a line to the current TRSPathData.

The line is defined by the end point of the TRSPathData and a specified point.

To move the start point of the line, call     MoveTo or     MoveToRel before calling LineTo.

LineTo adds P to Points . The added point is of type ppLineTo.

To find the last point of the TRSPathData, call the     LastPoint method.
 

public method

LineToRel(TRSPoint)

Appends a line to the current TRSPathData.

The line is defined by the end point of the TPathData and a point that depends on the point specified by the parameter.

To move the start point of the line, call     MoveTo or     MoveToRel before calling LineToRel.

LineToRel adds P to     Points . Its coordinates are equal to the sum between the coordinates of the last point and the coordinates of P. The added point is of type ppLineTo.

To find the last point of the TRSPathData, call the     LastPoint method.
 

public method

MoveTo(TRSPoint)

Adds a specified point to the end of the current TRSPathData.

Use MoveTo to customize the start point for a new element to be added to the current TRSPathData.

MoveTo adds the specified point to the     Points array. The added point is of type ppMoveTo.

When a TRSPathData is drawn on a canvas, a MoveTo point and the previous point are not visibly connected (no line is drawn between them).

To find the last point of the TRSPathData, call the     LastPoint method.
 

public method

MoveToRel(TRSPoint)

Adds a specified point to the end of the current TRSPathData.

Use MoveToRel to customize the start point for a new element to be added to the current TRSPathData.

MoveToRel adds the specified point to the     Points array. Its coordinates are equal to the sum between the coordinates of the last point and the coordinates of P. The added point is of type ppMoveTo.

When a TRSPathData is drawn on a canvas, a MoveToRel point and the previous point are not visibly connected (no line is drawn between them).

To find the last point of the TRSPathData, call the     LastPoint method.

public method

PointInPath(Single,Single)

Overloaded. Returns true if the point specified by X and Y is inside the path

public method

PointInPath(TRSPoint)

Overloaded. Returns true if the specified point is inside the path

public method

PointInPathOutline(Single,Single,Single)

Overloaded. Returns true if the point specified by X and Y is inside the path outline (i.e., the stroke of the path). The StrokeWidth specifies the width of the path outline.

public method

PointInPathOutline(TRSPoint,Single)

Overloaded. Returns true if the specified point is inside the path outline (i.e., the stroke of the path). The StrokeWidth specifies the width of the path outline.

public method

QuadCurveTo(TRSPoint,TRSPoint)

Appends a curve to the current TRSPathData.

The curve is defined by 4 points:

A start point--the last point of the TPathData.

Control point

An end point, specified by the EndPoint parameter.

QuaveCurveTo adds the control points and the end point of the curve to the Points array. The added points are of type ppCurveTo.

To move the start point of the curve, call the     MoveTo or     MoveToRel method before calling QuadCurveTo.

To find the end point of the TRSPathData, call the     LastPoint method.

protected method

ReadPath(TStream)

Reads TRSPathData from the virtual property Path (created by DefineProperties) when streaming from the TStream Stream.

public method

Scale(Single,Single)

Scales the current TRSPathData.
 

public method

SmoothCurveTo(TRSPoint,TRSPoint)

Appends a smooth curve to the current TRSPathData.

The smooth curve is defined by 4 points:

A start point--the last point of the TPathData.
 

Two control points. If Points has more than two items, the first control point coincides with the start point of the curve, otherwise it is equal to the second control point. The Control2 parameter specifies the second control point.
 

An end point, specified by the EndPoint parameter.
 

SmoothCurveTo adds the control points and the end point of the curve to the Points array. The added points are of type ppCurveTo.

To move the start point of the curve, call the     MoveTo or     MoveToRel method before calling SmoothCurveTo.

To find the end point of the TRSPathData, call the     LastPoint method.
 

public method

SmoothCurveToRel(TRSPoint,TRSPoint)

Appends a smooth curve to the current TRSPathData.

The smooth curve is defined by 4 points that depend on the last point of the current TRSPathData.

The start point of the curve is the end point of the TRSPathData.

If Points has more than 2 items, the first control point coincides with the start point, otherwise it is equal to the second control point.

The ControlPoint2 parameter's coordinates specify the distances to the last point of the current TRSPathData, on each axis, for the second control point of the curve.

The EndPoint parameter's coordinates specify the distances to the last point of the current TRSPathData, on each axis, for the end point of the curve.

SmoothCurveToRel adds the control points and the end point of the curve to the Points array. The coordinates for each point are equal to the sum between the coordinates of the last point of the current TRSPathData and the coordinates of the corresponding points specified by the parameters. The added points are of type ppCurveTo.

To move the start point of the curve, call the     MoveTo or     MoveToRel method before calling SmoothCurveToRel.

To find the end point of the TRSPathData, call the     LastPoint method.

public method

SplitDataByLength(Integer,String)

Returns the string representation of the path data. The string representation is split every Len characters using the specified delimiter.

SplitDataByLength returns a string that can be multiple lines of no more than Len length.

public method

ToPolygons

Converts the path data into an array of polygons.

noteNote

It is recommended that     Flatten is called before calling ToPolygons

public method

Translate(Single,Single)

Translates the current TRSPathData.

Translate moves the current TRSPathData for a specified distance on each axis.
 

public method

VLineTo(Single)

Appends a line to the current TRSPathData.

The line is defined by the end point of the TRSPathData and a point that depends on the specified parameter.

VLineTo adds the specified point to the     Points array. The end point of the line is moved vertically from the last point of the TPathData to the point with the y-coordinate equal to Y. The added point is of type ppLineTo.

To move the start point of the line, call     MoveTo or     MoveToRel before calling VLineTo.

To find the last point of the TRSPathData, call the     LastPoint method.

public method

VLineToRel(Single)

Appends a line to the current TRSPathData.

The line is defined by the end point of the TRSPathData and a point that depends on the specified parameter.

VLineToRel adds the specified point to the     Points array. The The end point of the line is moved vertically by a distance equal to Y to the end point of the TRSPathData. The added point is of type ppLineTo.

To move the start point of the line, call     MoveTo or     MoveToRel before calling VLineToRel.

To find the last point of the TRSPathData, call the     LastPoint method.

protected method

WritePath(TStream)

Writes TRSPathData to the virtual property Path (created by DefineProperties) when streaming to the TStream Stream.

Top

RiverSoftAVG Products Help © 1996-2016 Thomas G. Grubb