Enum PathVerb
One drawing command of a Path; the comment on each says how many points it takes.
public enum PathVerb : byte
Fields
Close = 4Closes the contour with a line back to its start; takes no point.
Cubic = 3A cubic Bézier curve: two control points and the end point.
Line = 1A straight line to one point.
Move = 0Starts a contour at one point.
Quad = 2A quadratic Bézier curve: one control point and the end point.
Examples
// A path is built once and never changes, so it can be drawn many times and from many threads.
Path heart = new PathBuilder()
.MoveTo(150, 60)
.CubicTo(150, 30, 100, 20, 90, 60)
.CubicTo(80, 100, 130, 130, 150, 160)
.CubicTo(170, 130, 220, 100, 210, 60)
.CubicTo(200, 20, 150, 30, 150, 60)
.Close()
.ToPath();
canvas.FillPath(heart, Rgba8.Red);
// SVG's arc command, and the even-odd rule: an inner contour becomes a hole.
Path frame = new PathBuilder()
.AddRect(new RectF(10, 10, 60, 60))
.AddCircle(new Vector2(40, 40), 20)
.MoveTo(10, 120)
.ArcTo(radii: new Vector2(30, 20), rotationDegrees: 0, largeArc: false, clockwise: true, end: new Vector2(70, 120))
.Close()
.ToPath(FillRule.EvenOdd);
canvas.FillPath(frame, Rgba8.Black);
bool hit = heart.Contains(new Vector2(150, 100)); // hit testing on the curves themselves
RectF box = heart.TightBounds; // curves measured at their extremes