Inkscape
Vector Graphics Editor
|
Output paths to a Cairo drawing context. More...
#include <cairo-path-sink.h>
Public Member Functions | |
CairoPathSink (cairo_t *cr) | |
void | moveTo (Point const &p) override |
Move to a different point without creating a segment. | |
void | lineTo (Point const &p) override |
Output a line segment. | |
void | curveTo (Point const &c0, Point const &c1, Point const &p) override |
Output a quadratic Bezier segment. | |
void | quadTo (Point const &c, Point const &p) override |
Output a cubic Bezier segment. | |
void | arcTo (Coord rx, Coord ry, Coord angle, bool large_arc, bool sweep, Point const &p) override |
Output an elliptical arc segment. | |
void | closePath () override |
Close the current path with a line segment. | |
void | flush () override |
Flush any internal state of the generator. | |
![]() | |
virtual bool | backspace () |
Undo the last segment. | |
virtual void | feed (Curve const &c, bool moveto_initial=true) |
virtual void | feed (Path const &p) |
Output a subpath. | |
virtual void | feed (PathVector const &v) |
Output a path. | |
virtual void | feed (Rect const &) |
Output an axis-aligned rectangle, using moveTo, lineTo and closePath. | |
virtual void | feed (Circle const &e) |
Output a circle as two elliptical arcs. | |
virtual void | feed (Ellipse const &e) |
Output an ellipse as two elliptical arcs. | |
virtual | ~PathSink () |
Private Attributes | |
cairo_t * | _cr |
Point | _current_point |
Output paths to a Cairo drawing context.
This class converts from 2Geom path representation to the Cairo representation. Use it to simplify visualizing the results of 2Geom operations with the Cairo library, for example:
Currently the flush method is a no-op, but this is not guaranteed to hold forever.
Definition at line 57 of file cairo-path-sink.h.
Geom::CairoPathSink::CairoPathSink | ( | cairo_t * | cr | ) |
Definition at line 40 of file cairo-path-sink.cpp.
|
overridevirtual |
Output an elliptical arc segment.
See the EllipticalArc class for the documentation of parameters.
Implements Geom::PathSink.
Definition at line 73 of file cairo-path-sink.cpp.
References _cr, _current_point, Geom::EllipticalArc::finalAngle(), Geom::EllipticalArc::initialAngle(), and Geom::EllipticalArc::unitCircleTransform().
|
overridevirtual |
Close the current path with a line segment.
Implements Geom::PathSink.
Definition at line 107 of file cairo-path-sink.cpp.
References _cr.
|
overridevirtual |
Output a quadratic Bezier segment.
Implements Geom::PathSink.
Definition at line 56 of file cairo-path-sink.cpp.
References _cr, _current_point, cairo_curve_to(), Geom::X, and Geom::Y.
|
overridevirtual |
Flush any internal state of the generator.
This call should implicitly finish the current subpath. Calling this method should be idempotent, because the default implementations of path() and pathvector() will call it multiple times in a row.
Implements Geom::PathSink.
Definition at line 112 of file cairo-path-sink.cpp.
|
overridevirtual |
Output a line segment.
Implements Geom::PathSink.
Definition at line 50 of file cairo-path-sink.cpp.
References _cr, _current_point, cairo_line_to(), Geom::X, and Geom::Y.
|
overridevirtual |
Move to a different point without creating a segment.
Usually starts a new subpath.
Implements Geom::PathSink.
Definition at line 44 of file cairo-path-sink.cpp.
References _cr, _current_point, cairo_move_to(), Geom::X, and Geom::Y.
Output a cubic Bezier segment.
Implements Geom::PathSink.
Definition at line 62 of file cairo-path-sink.cpp.
References _cr, _current_point, cairo_curve_to(), Geom::X, and Geom::Y.
|
private |
Definition at line 73 of file cairo-path-sink.h.
Referenced by arcTo(), closePath(), curveTo(), lineTo(), moveTo(), and quadTo().
|
private |