VectSharp 2.5.0
A light library for C# vector graphics
Loading...
Searching...
No Matches
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 QuadraticBezierTo (Point control, Point endPoint)
 Trace a quadratic Bezier curve from the current point to a destination point, with a single control point. The current point is updated to the end point of the Bezier curve. More...
 
GraphicsPath QuadraticBezierTo (double controlX, double controlY, double endPointX, double endPointY)
 Trace a quadratic Bezier curve from the current point to a destination point, with a single control point. 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...
 
GraphicsPath AddPath (GraphicsPath path)
 Adds another GraphicsPath to the current GraphicsPath. 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...
 
GraphicsPath Discretise (double resolution)
 Discretises a GraphicsPath, replacing curve segments with series of line segments that approximate them and ensuring that all line segments are shorter than the specified resolution . More...
 
GraphicsPath Flatten (double flatness)
 Flattens a GraphicsPath, replacing curve segments with series of line segments that approximate them, ensuring the specified maximum deviation from the original path. More...
 
IEnumerable< List< Point > > GetPoints ()
 Gets a collection of the end points of all the segments in the GraphicsPath, divided by figure. More...
 
IEnumerable< GraphicsPathGetFigures ()
 Gets a collection of all the figures in the GraphicsPath, returned as individual GraphicsPaths. 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...
 
GraphicsPath Reverse ()
 Reverses the GraphicsPath. More...
 
GraphicsPath GetStroke (double lineWidth=1, LineCaps lineCap=LineCaps.Butt, LineJoins lineJoin=LineJoins.Miter)
 Returns a GraphicsPath representing the stroke of the current GraphicsPath. More...
 
bool ContainsPoint (Point point, FillRule fillRule)
 Determines whether the specified point falls within the current GraphicsPath. 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 27 of file GraphicsPath.cs.

Member Function Documentation

◆ AddPath()

GraphicsPath VectSharp.GraphicsPath.AddPath ( GraphicsPath  path)

Adds another GraphicsPath to the current GraphicsPath.

Parameters
pathThe existing GraphicsPath that should be added to the current GraphicsPath.
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 1209 of file GraphicsPath.cs.

◆ 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 1177 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 357 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 370 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 475 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 623 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 125 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 102 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 340 of file GraphicsPath.cs.

◆ ContainsPoint()

bool VectSharp.GraphicsPath.ContainsPoint ( Point  point,
FillRule  fillRule 
)

Determines whether the specified point falls within the current GraphicsPath.

Parameters
pointThe Point being analysed.
fillRuleThe rule to use to determine whether a point is inside or outside of a the GraphicsPath.
Returns
true if the point is inside the GraphicsPath, or false if it is outside. If the point lies exactly on the GraphicsPath (or very close to it), the result may be either true or false, depending on numerical approximations.

Definition at line 3591 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 284 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 260 of file GraphicsPath.cs.

◆ Discretise()

GraphicsPath VectSharp.GraphicsPath.Discretise ( double  resolution)

Discretises a GraphicsPath, replacing curve segments with series of line segments that approximate them and ensuring that all line segments are shorter than the specified resolution .

Parameters
resolutionThe maximum length (in absolute units) of line segments in the resulting GraphicsPath.
Returns
A GraphicsPath composed only of linear segments that are shorter than resolution and approximate the current GraphicsPath.

Definition at line 1963 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 141 of file GraphicsPath.cs.

◆ Flatten()

GraphicsPath VectSharp.GraphicsPath.Flatten ( double  flatness)

Flattens a GraphicsPath, replacing curve segments with series of line segments that approximate them, ensuring the specified maximum deviation from the original path.

Parameters
flatnessThe maximum deviation from the original path.
Returns
A GraphicsPath composed only of linear segments that approximates the current GraphicsPath.

Definition at line 1993 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 3031 of file GraphicsPath.cs.

◆ GetFigures()

IEnumerable< GraphicsPath > VectSharp.GraphicsPath.GetFigures ( )

Gets a collection of all the figures in the GraphicsPath, returned as individual GraphicsPaths.

Returns
A collection of all the figures in the GraphicsPath, returned as individual GraphicsPaths.

Definition at line 2089 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 2132 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 1887 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 1898 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 1303 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 1293 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 2046 of file GraphicsPath.cs.

◆ GetStroke()

GraphicsPath VectSharp.GraphicsPath.GetStroke ( double  lineWidth = 1,
LineCaps  lineCap = LineCaps.Butt,
LineJoins  lineJoin = LineJoins.Miter 
)

Returns a GraphicsPath representing the stroke of the current GraphicsPath.

Parameters
lineWidthThe thickness of the stroke.
lineCapThe line cap used in the stroke.
lineJoinThe line join used in the stroke.
Returns
A GraphicsPath representing the stroke of the current GraphicsPath.

Definition at line 3437 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 1600 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 1590 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 1909 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 87 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 65 of file GraphicsPath.cs.

◆ MeasureLength()

double VectSharp.GraphicsPath.MeasureLength ( )

Measures the length of the GraphicsPath.

Returns
The length of the GraphicsPath

Definition at line 1221 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 54 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 40 of file GraphicsPath.cs.

◆ QuadraticBezierTo() [1/2]

GraphicsPath VectSharp.GraphicsPath.QuadraticBezierTo ( double  controlX,
double  controlY,
double  endPointX,
double  endPointY 
)

Trace a quadratic Bezier curve from the current point to a destination point, with a single control point. The current point is updated to the end point of the Bezier curve.

Parameters
controlXThe horizontal coordinate of the control point.
controlYThe vertical coordinate of the 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 330 of file GraphicsPath.cs.

◆ QuadraticBezierTo() [2/2]

GraphicsPath VectSharp.GraphicsPath.QuadraticBezierTo ( Point  control,
Point  endPoint 
)

Trace a quadratic Bezier curve from the current point to a destination point, with a single control point. The current point is updated to the end point of the Bezier curve.

Parameters
controlThe control point.
endPointThe destination point.
Returns
The GraphicsPath, to allow for chained calls.

Definition at line 297 of file GraphicsPath.cs.

◆ Reverse()

GraphicsPath VectSharp.GraphicsPath.Reverse ( )

Reverses the GraphicsPath.

Returns
The reversed GraphicsPath.

Definition at line 3328 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 3012 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 2225 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 32 of file GraphicsPath.cs.


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