|
|
Donner
Embeddable browser-grade SVG2 engine
|
Mutable builder for constructing immutable Path objects. More...
#include "donner/base/Path.h"
Public Member Functions | |
| Path | build () |
| Build the immutable Path. The builder is reset after this call. | |
Path construction | |
| PathBuilder & | moveTo (const Vector2d &point) |
Start a new subpath at point. | |
| PathBuilder & | lineTo (const Vector2d &point) |
Line from the current point to point. | |
| PathBuilder & | quadTo (const Vector2d &control, const Vector2d &end) |
Quadratic Bézier from the current point through control to end. | |
| PathBuilder & | curveTo (const Vector2d &c1, const Vector2d &c2, const Vector2d &end) |
Cubic Bézier from the current point through c1, c2 to end. | |
| PathBuilder & | arcTo (const Vector2d &radius, double rotationRadians, bool largeArc, bool sweep, const Vector2d &end) |
Elliptical arc from the current point to end. | |
| PathBuilder & | closePath () |
| Close the current subpath with a straight line back to the last moveTo point. | |
Shape helpers | |
| PathBuilder & | addRect (const Box2d &rect) |
| Add an axis-aligned rectangle. | |
| PathBuilder & | addRoundedRect (const Box2d &rect, double rx, double ry) |
Add a rounded rectangle with corner radii rx and ry. | |
| PathBuilder & | addEllipse (const Box2d &bounds) |
Add an ellipse inscribed in bounds. | |
| PathBuilder & | addCircle (const Vector2d ¢er, double radius) |
Add a circle with center center and radius radius. | |
| PathBuilder & | addPath (const Path &path) |
Append all commands from path. | |
State | |
| Vector2d | currentPoint () const |
| Returns the current point (end point of the last command), or (0,0) if empty. | |
| bool | empty () const |
| Returns true if no commands have been added. | |
Mutable builder for constructing immutable Path objects.
Usage:
| PathBuilder & donner::PathBuilder::arcTo | ( | const Vector2d & | radius, |
| double | rotationRadians, | ||
| bool | largeArc, | ||
| bool | sweep, | ||
| const Vector2d & | end ) |
Elliptical arc from the current point to end.
The arc is decomposed into cubic Bézier curves internally.
| radius | Ellipse radius (before rotation). |
| rotationRadians | X-axis rotation of the ellipse in radians. |
| largeArc | True for arc length >= 180 degrees. |
| sweep | True for positive-angle arc direction. |
| end | End point of the arc. |