PathGeometry class
A path consisting of move, line, bezier, and close commands. Coordinates are in device-independent pixels (DIPs) in the local coordinate space.
public sealed class PathGeometry : GeometryPublic Members
Section titled “Public Members”| name | description |
|---|---|
| PathGeometry() | The default constructor. |
| static FromCircle(…) | Creates a closed circle path with the given center and radius. |
| static FromEllipse(…) | Creates a closed ellipse path fitted inside bounds. (2 methods) |
| static FromRect(…) | Creates a closed rectangular path. (2 methods) |
| static FromRoundedRect(…) | Creates a closed rounded-rectangle path with equal corner radii. (5 methods) |
| static Parse(…) | Parses SVG path data into a frozen PathGeometry. A leading F0 sets FillRule to EvenOdd and F1 to NonZero, as in XAML path markup; without it the rule is NonZero. A string argument binds here via implicit conversion to ReadOnlySpan. |
| Commands { get; } | Gets the list of path commands. |
| Count { get; } | Gets the number of commands in the path. |
| FillRule { get; set; } | Gets or sets the fill rule used when this path is filled without an explicit rule. Defaults to NonZero. |
| IsEmpty { get; } | Returns true when the path contains no commands. |
| AddPath(…) | Appends all commands from other to the end of this path. The FillRule of this path is not changed. |
| Arc(…) | Adds an axis-aligned elliptical arc centred at (cx, cy) with radii rx/ry, sweeping from startAngle to endAngle (radians, CCW positive). Internally converted to cubic Bézier curves. |
| ArcTo(…) | Adds a circular arc from the current point to (x2, y2) via the control point (x1, y1) with the given radius. This is a canvas-style tangential arc; it draws the arc of the circle of the given radius that is tangent to both the incoming direction (from the previous point to the corner) and the outgoing direction (to the end point). Internally converted to cubic Bézier curves. |
| BezierTo(…) | Adds a cubic Bézier curve. c1 and c2 are control points; (x, y) is the end point. |
| Clear() | Removes all commands from the path. |
| Close() | Closes the current sub-path with a straight line back to the starting point. |
| GetBounds() | Returns the conservative axis-aligned bounding box of this path. For cubic Bézier curves, control points are included (the result may be slightly larger than the tight bounds). |
| override GetPathGeometry() | |
| LineTo(…) | Adds a straight line to the given point. (2 methods) |
| MoveTo(…) | Starts a new sub-path at the given point. (2 methods) |
| QuadTo(…) | Adds a quadratic Bézier curve, eagerly converting to a cubic Bézier. cpx/cpy is the quadratic control point; (x, y) is the end point. |
| Reset() | Clears all commands, resetting the path for reuse without reallocating. |
| Reverse() | Returns a new PathGeometry with every sub-path reversed (visiting the same points in opposite winding order). |
| SvgArcTo(…) | Appends an SVG-style arc (as in the ‘A’/‘a’ path command), converting it to one or more cubic Bézier curves using the standard endpoint-to-center parameterisation. |
| Transform(…) | Returns a new PathGeometry with every command’s coordinates transformed by matrix. Cubic Béziers are affine-invariant, so transforming the control points is exact. Use this to bake a stretch/scale matrix into the geometry when subsequent draws need to be transform-independent - e.g. so that Stroke thickness (which under MewUI’s Model D scales with the active context transform) stays in element-DIP regardless of the bake. Returns this if the matrix is the identity. Cheap; consider caching at the call site if invoked per-frame on a hot path. |
See Also
Section titled “See Also”- class Geometry
- namespace Aprillz.MewUI.Rendering