VectSharp  2.2.1
A light library for C# vector graphics
VectSharp.GraphicsPath Class Reference

Represents a graphics path that can be filled or stroked. More...

Public Member Functions

GraphicsPath MoveTo (Point p)
 Move the current point without tracing a segment from the previous point. More...
 
GraphicsPath MoveTo (double x, double y)
 Move the current point without tracing a segment from the previous point. More...
 
GraphicsPath LineTo (Point p)
 Move the current point and trace a segment from the previous point. More...
 
GraphicsPath LineTo (double x, double y)
 Move the current point and trace a segment from the previous point. More...
 
GraphicsPath Arc (Point center, double radius, double startAngle, double endAngle)
 Trace an arc segment from a circle with the specified center and radius , starting at startAngle and ending at endAngle . The current point is updated to the end point of the arc. More...
 
GraphicsPath Arc (double centerX, double centerY, double radius, double startAngle, double endAngle)
 Trace an arc segment from a circle with the specified center and radius , starting at startAngle and ending at endAngle . The current point is updated to the end point of the arc. More...
 
GraphicsPath EllipticalArc (double radiusX, double radiusY, double axisAngle, bool largeArc, bool sweepClockwise, Point endPoint)
 Trace an arc from an ellipse with the specified radii, rotated by axisAngle with respect to the x-axis, starting at the current point and ending at the endPoint . More...
 
GraphicsPath CubicBezierTo (Point control1, Point control2, Point endPoint)
 Trace a cubic Bezier curve from the current point to a destination point, with two control points. The current point is updated to the end point of the Bezier curve. More...
 
GraphicsPath CubicBezierTo (double control1X, double control1Y, double control2X, double control2Y, double endPointX, double endPointY)
 Trace a cubic Bezier curve from the current point to a destination point, with two control points. The current point is updated to the end point of the Bezier curve. More...
 
GraphicsPath Close ()
 Trace a segment from the current point to the start point of the figure and flag the figure as closed. More...
 
GraphicsPath AddText (double originX, double originY, string text, Font font, TextBaselines textBaseline=TextBaselines.Top)
 Add the contour of a text string to the current path. More...
 
GraphicsPath AddText (Point origin, string text, Font font, TextBaselines textBaseline=TextBaselines.Top)
 Add the contour of a text string to the current path. More...
 
GraphicsPath AddTextOnPath (GraphicsPath path, string text, Font font, double reference=0, TextAnchors anchor=TextAnchors.Left, TextBaselines textBaseline=TextBaselines.Top)
 Add the contour of a text string flowing along a GraphicsPath to the current path. More...
 
GraphicsPath AddTextUnderline (Point origin, string text, Font font, TextBaselines textBaseline=TextBaselines.Top)
 Add the contour of the underline of the specified text string to the current path. More...
 
GraphicsPath AddSmoothSpline (params Point[] points)
 Adds a smooth spline composed of cubic bezier segments that pass through the specified points. More...
 
double MeasureLength ()
 Measures the length of the GraphicsPath. More...
 
Point GetPointAtRelative (double position)
 Gets the point at the relative position specified on the GraphicsPath. More...
 
Point GetPointAtAbsolute (double length)
 Gets the point at the absolute position specified on the GraphicsPath. More...
 
Point GetTangentAtRelative (double position)
 Gets the tangent to the point at the relative position specified on the GraphicsPath. More...
 
Point GetTangentAtAbsolute (double length)
 Gets the tangent to the point at the absolute position specified on the GraphicsPath. More...
 
Point GetNormalAtAbsolute (double length)
 Gets the normal to the point at the absolute position specified on the GraphicsPath. More...
 
Point GetNormalAtRelative (double position)
 Gets the normal to the point at the relative position specified on the GraphicsPath. More...
 
GraphicsPath Linearise (double resolution)
 Linearises a GraphicsPath, replacing curve segments with series of line segments that approximate them. More...
 
IEnumerable< List< Point > > GetPoints ()
 Gets a collection of the end points of all the segments in the GraphicsPath, divided by figure. More...
 
IEnumerable< List< Point > > GetLinearisationPointsNormals (double resolution)
 Gets a collection of the tangents at the end point of the segments in which the GraphicsPath would be linearised, divided by figure. More...
 
IEnumerable< GraphicsPathTriangulate (double resolution, bool clockwise)
 Divides a GraphicsPath into triangles. More...
 
GraphicsPath Transform (Func< Point, Point > transformationFunction)
 Transforms all of the Points in the GraphicsPath with an arbitrary transformation function. More...
 
Rectangle GetBounds ()
 Compute the rectangular bounds of the path. More...
 

Properties

List< SegmentSegments = new List<Segment>() [get, set]
 The segments that make up the path. More...
 

Detailed Description

Represents a graphics path that can be filled or stroked.

Definition at line 28 of file GraphicsPath.cs.

Member Function Documentation

◆ AddSmoothSpline()

GraphicsPath VectSharp.GraphicsPath.AddSmoothSpline ( params Point[]  points)

Adds a smooth spline composed of cubic bezier segments that pass through the specified points.

Parameters
pointsThe points through which the spline should pass.
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 1123 of file GraphicsPath.cs.

◆ AddText() [1/2]

GraphicsPath VectSharp.GraphicsPath.AddText ( double  originX,
double  originY,
string  text,
Font  font,
TextBaselines  textBaseline = TextBaselines.Top 
)

Add the contour of a text string to the current path.

Parameters
originXThe horizontal coordinate of the text origin.
originYThe vertical coordinate of the text origin. See textBaseline .
textThe string to draw.
fontThe font with which to draw the text.
textBaselineThe text baseline (determines what originY represents).

///

Returns
The GraphicsPath, to allow for chained calls.

Definition at line 312 of file GraphicsPath.cs.

◆ AddText() [2/2]

GraphicsPath VectSharp.GraphicsPath.AddText ( Point  origin,
string  text,
Font  font,
TextBaselines  textBaseline = TextBaselines.Top 
)

Add the contour of a text string to the current path.

Parameters
originThe text origin. See textBaseline .
textThe string to draw.
fontThe font with which to draw the text.
textBaselineThe text baseline (determines what the vertical component of origin represents).
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 325 of file GraphicsPath.cs.

◆ AddTextOnPath()

GraphicsPath VectSharp.GraphicsPath.AddTextOnPath ( GraphicsPath  path,
string  text,
Font  font,
double  reference = 0,
TextAnchors  anchor = TextAnchors.Left,
TextBaselines  textBaseline = TextBaselines.Top 
)

Add the contour of a text string flowing along a GraphicsPath to the current path.

Parameters
pathThe GraphicsPath along which the text will flow.
textThe string to draw.
fontThe font with which to draw the text.
referenceThe (relative) starting point on the path starting from which the text should be drawn (0 is the start of the path, 1 is the end of the path).
anchorThe anchor in the text string that will correspond to the point specified by the reference .
textBaselineThe text baseline (determines which the position of the text in relation to the path .
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 427 of file GraphicsPath.cs.

◆ AddTextUnderline()

GraphicsPath VectSharp.GraphicsPath.AddTextUnderline ( Point  origin,
string  text,
Font  font,
TextBaselines  textBaseline = TextBaselines.Top 
)

Add the contour of the underline of the specified text string to the current path.

Parameters
originThe text origin. See textBaseline .
textThe string whose underline will be drawn.
fontThe font with which to draw the text.
textBaselineThe text baseline (determines what the vertical component of origin represents).
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 572 of file GraphicsPath.cs.

◆ Arc() [1/2]

GraphicsPath VectSharp.GraphicsPath.Arc ( double  centerX,
double  centerY,
double  radius,
double  startAngle,
double  endAngle 
)

Trace an arc segment from a circle with the specified center and radius , starting at startAngle and ending at endAngle . The current point is updated to the end point of the arc.

Parameters
centerXThe horizontal coordinate of the center of the arc.
centerYThe vertical coordinate of the center of the arc.
radiusThe radius of the arc.
startAngleThe start angle (in radians) of the arc.
endAngleThe end angle (in radians) of the arc.
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 126 of file GraphicsPath.cs.

◆ Arc() [2/2]

GraphicsPath VectSharp.GraphicsPath.Arc ( Point  center,
double  radius,
double  startAngle,
double  endAngle 
)

Trace an arc segment from a circle with the specified center and radius , starting at startAngle and ending at endAngle . The current point is updated to the end point of the arc.

Parameters
centerThe center of the arc.
radiusThe radius of the arc.
startAngleThe start angle (in radians) of the arc.
endAngleThe end angle (in radians) of the arc.
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 103 of file GraphicsPath.cs.

◆ Close()

GraphicsPath VectSharp.GraphicsPath.Close ( )

Trace a segment from the current point to the start point of the figure and flag the figure as closed.

Returns
The GraphicsPath, to allow for chained calls.

Definition at line 295 of file GraphicsPath.cs.

◆ CubicBezierTo() [1/2]

GraphicsPath VectSharp.GraphicsPath.CubicBezierTo ( double  control1X,
double  control1Y,
double  control2X,
double  control2Y,
double  endPointX,
double  endPointY 
)

Trace a cubic Bezier curve from the current point to a destination point, with two control points. The current point is updated to the end point of the Bezier curve.

Parameters
control1XThe horizontal coordinate of the first control point.
control1YThe vertical coordinate of the first control point.
control2XThe horizontal coordinate of the second control point.
control2YThe vertical coordinate of the second control point.
endPointXThe horizontal coordinate of the destination point.
endPointYThe vertical coordinate of the destination point.
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 285 of file GraphicsPath.cs.

◆ CubicBezierTo() [2/2]

GraphicsPath VectSharp.GraphicsPath.CubicBezierTo ( Point  control1,
Point  control2,
Point  endPoint 
)

Trace a cubic Bezier curve from the current point to a destination point, with two control points. The current point is updated to the end point of the Bezier curve.

Parameters
control1The first control point.
control2The second control point.
endPointThe destination point.
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 261 of file GraphicsPath.cs.

◆ EllipticalArc()

GraphicsPath VectSharp.GraphicsPath.EllipticalArc ( double  radiusX,
double  radiusY,
double  axisAngle,
bool  largeArc,
bool  sweepClockwise,
Point  endPoint 
)

Trace an arc from an ellipse with the specified radii, rotated by axisAngle with respect to the x-axis, starting at the current point and ending at the endPoint .

Parameters
radiusXThe horizontal radius of the ellipse.
radiusYThe vertical radius of the ellipse.
axisAngleThe angle of the horizontal axis of the ellipse with respect to the horizontal axis.
largeArcDetermines whether the large or the small arc is drawn.
sweepClockwiseDetermines whether the clockwise or anticlockwise arc is drawn.
endPointThe end point of the arc.
Returns

Definition at line 142 of file GraphicsPath.cs.

◆ GetBounds()

Rectangle VectSharp.GraphicsPath.GetBounds ( )

Compute the rectangular bounds of the path.

Returns
The smallest Rectangle that contains the path.

Definition at line 2929 of file GraphicsPath.cs.

◆ GetLinearisationPointsNormals()

IEnumerable<List<Point> > VectSharp.GraphicsPath.GetLinearisationPointsNormals ( double  resolution)

Gets a collection of the tangents at the end point of the segments in which the GraphicsPath would be linearised, divided by figure.

Parameters
resolutionThe absolute length between successive samples in curve segments.
Returns
A collection of the tangents at the end point of the segments in which the GraphicsPath would be linearised, divided by figure.

Definition at line 1917 of file GraphicsPath.cs.

◆ GetNormalAtAbsolute()

Point VectSharp.GraphicsPath.GetNormalAtAbsolute ( double  length)

Gets the normal to the point at the absolute position specified on the GraphicsPath.

Parameters
lengthThe distance to the point from the start of the GraphicsPath.
Returns
The normal to the point at the specified position.

Definition at line 1822 of file GraphicsPath.cs.

◆ GetNormalAtRelative()

Point VectSharp.GraphicsPath.GetNormalAtRelative ( double  position)

Gets the normal to the point at the relative position specified on the GraphicsPath.

Parameters
positionThe position on the GraphicsPath (0 is the start of the path, 1 is the end of the path).
Returns
The normal to the point at the specified position.

Definition at line 1833 of file GraphicsPath.cs.

◆ GetPointAtAbsolute()

Point VectSharp.GraphicsPath.GetPointAtAbsolute ( double  length)

Gets the point at the absolute position specified on the GraphicsPath.

Parameters
lengthThe distance to the point from the start of the GraphicsPath.
Returns
The point at the specified position.

Definition at line 1238 of file GraphicsPath.cs.

◆ GetPointAtRelative()

Point VectSharp.GraphicsPath.GetPointAtRelative ( double  position)

Gets the point at the relative position specified on the GraphicsPath.

Parameters
positionThe position on the GraphicsPath (0 is the start of the path, 1 is the end of the path).
Returns
The point at the specified position.

Definition at line 1228 of file GraphicsPath.cs.

◆ GetPoints()

IEnumerable<List<Point> > VectSharp.GraphicsPath.GetPoints ( )

Gets a collection of the end points of all the segments in the GraphicsPath, divided by figure.

Returns
A collection of the end points of all the segments in the GraphicsPath, divided by figure.

Definition at line 1872 of file GraphicsPath.cs.

◆ GetTangentAtAbsolute()

Point VectSharp.GraphicsPath.GetTangentAtAbsolute ( double  length)

Gets the tangent to the point at the absolute position specified on the GraphicsPath.

Parameters
lengthThe distance to the point from the start of the GraphicsPath.
Returns
The tangent to the point at the specified position.

Definition at line 1535 of file GraphicsPath.cs.

◆ GetTangentAtRelative()

Point VectSharp.GraphicsPath.GetTangentAtRelative ( double  position)

Gets the tangent to the point at the relative position specified on the GraphicsPath.

Parameters
positionThe position on the GraphicsPath (0 is the start of the path, 1 is the end of the path).
Returns
The tangent to the point at the specified position.

Definition at line 1525 of file GraphicsPath.cs.

◆ Linearise()

GraphicsPath VectSharp.GraphicsPath.Linearise ( double  resolution)

Linearises a GraphicsPath, replacing curve segments with series of line segments that approximate them.

Parameters
resolutionThe absolute length between successive samples in curve segments.
Returns
A GraphicsPath composed only of linear segments that approximates the current GraphicsPath.

Definition at line 1844 of file GraphicsPath.cs.

◆ LineTo() [1/2]

GraphicsPath VectSharp.GraphicsPath.LineTo ( double  x,
double  y 
)

Move the current point and trace a segment from the previous point.

Parameters
xThe horizontal coordinate of the new point.
yThe vertical coordinate of the new point.
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 88 of file GraphicsPath.cs.

◆ LineTo() [2/2]

GraphicsPath VectSharp.GraphicsPath.LineTo ( Point  p)

Move the current point and trace a segment from the previous point.

Parameters
pThe new point.
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 66 of file GraphicsPath.cs.

◆ MeasureLength()

double VectSharp.GraphicsPath.MeasureLength ( )

Measures the length of the GraphicsPath.

Returns
The length of the GraphicsPath

Definition at line 1156 of file GraphicsPath.cs.

◆ MoveTo() [1/2]

GraphicsPath VectSharp.GraphicsPath.MoveTo ( double  x,
double  y 
)

Move the current point without tracing a segment from the previous point.

Parameters
xThe horizontal coordinate of the new point.
yThe vertical coordinate of the new point.
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 55 of file GraphicsPath.cs.

◆ MoveTo() [2/2]

GraphicsPath VectSharp.GraphicsPath.MoveTo ( Point  p)

Move the current point without tracing a segment from the previous point.

Parameters
pThe new point.
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 41 of file GraphicsPath.cs.

◆ Transform()

GraphicsPath VectSharp.GraphicsPath.Transform ( Func< Point, Point transformationFunction)

Transforms all of the Points in the GraphicsPath with an arbitrary transformation function.

Parameters
transformationFunctionAn arbitrary transformation function.
Returns
A new GraphicsPath in which all points have been replaced using the transformationFunction .

Definition at line 2910 of file GraphicsPath.cs.

◆ Triangulate()

IEnumerable<GraphicsPath> VectSharp.GraphicsPath.Triangulate ( double  resolution,
bool  clockwise 
)

Divides a GraphicsPath into triangles.

Parameters
resolutionThe resolution that will be used to linearise curve segments in the GraphicsPath.
clockwiseIf this is true, the triangles will have their vertices in a clockwise order, otherwise they will be in anticlockwise order.
Returns
A collection of distinct GraphicsPaths, each representing one triangle.

Definition at line 2010 of file GraphicsPath.cs.

Property Documentation

◆ Segments

List<Segment> VectSharp.GraphicsPath.Segments = new List<Segment>()
getset

The segments that make up the path.

Definition at line 33 of file GraphicsPath.cs.


The documentation for this class was generated from the following file: