|
tiny-skia-cpp
A C++20 2D rendering library (port of tiny-skia)
|
Incrementally builds a Path from move/line/quad/cubic/close operations. More...
#include <tiny_skia/PathBuilder.h>
Public Member Functions | |
| PathBuilder (std::size_t verbsCapacity, std::size_t pointsCapacity) | |
| Pre-allocates capacity for verbs and points. | |
| void | reserve (std::size_t additionalVerbs, std::size_t additionalPoints) |
| Reserves additional capacity. | |
| PathBuilder & | moveTo (float x, float y) |
| Begins a new sub-path at (x, y). | |
| PathBuilder & | lineTo (float x, float y) |
| Adds a line segment to (x, y). | |
| PathBuilder & | quadTo (float x1, float y1, float x, float y) |
| Adds a quadratic Bezier to (x, y) with control point (x1, y1). | |
| PathBuilder & | quadToPt (Point p1, Point p) |
| Adds a quadratic Bezier using Point arguments. | |
| PathBuilder & | cubicTo (float x1, float y1, float x2, float y2, float x, float y) |
| Adds a cubic Bezier to (x, y) with control points (x1,y1) and (x2,y2). | |
| PathBuilder & | cubicToPt (Point p1, Point p2, Point p) |
| Adds a cubic Bezier using Point arguments. | |
| PathBuilder & | conicTo (float x1, float y1, float x, float y, float weight) |
| Adds a conic (rational quadratic) segment, approximated as quadratics. | |
| PathBuilder & | conicPointsTo (Point pt1, Point pt2, float weight) |
| Adds a conic segment using Point arguments. | |
| void | setConicTolerance (float tolerance) |
| Sets the tolerance for conic-to-quadratic conversion (default 0.25). | |
| PathBuilder & | close () |
| Closes the current sub-path. | |
| PathBuilder & | pushRect (const Rect &rect) |
| Appends a closed rectangle sub-path. | |
| PathBuilder & | pushOval (const Rect &oval) |
| Appends a closed oval sub-path inscribed in the given rect. | |
| PathBuilder & | pushCircle (float x, float y, float r) |
| Appends a closed circle sub-path. | |
| PathBuilder & | pushPath (const Path &other) |
| Appends all segments from another path. | |
| PathBuilder & | pushPathBuilder (const PathBuilder &other) |
| Appends all segments from another builder. | |
| void | clear () |
| Resets the builder, discarding all segments. | |
| std::optional< Path > | finish () |
| Builds and returns the immutable Path. Returns nullopt if empty or invalid. | |
Static Public Member Functions | |
| static std::optional< Path > | fromCircle (float cx, float cy, float radius) |
| Creates a Path from a circle. Returns nullopt for non-positive radius. | |