Inkscape
Vector Graphics Editor
|
Callback interface for processing path data. More...
#include <path-sink.h>
Public Member Functions | |
virtual void | moveTo (Point const &p)=0 |
Move to a different point without creating a segment. | |
virtual void | lineTo (Point const &p)=0 |
Output a line segment. | |
virtual void | curveTo (Point const &c0, Point const &c1, Point const &p)=0 |
Output a quadratic Bezier segment. | |
virtual void | quadTo (Point const &c, Point const &p)=0 |
Output a cubic Bezier segment. | |
virtual void | arcTo (Coord rx, Coord ry, Coord angle, bool large_arc, bool sweep, Point const &p)=0 |
Output an elliptical arc segment. | |
virtual void | closePath ()=0 |
Close the current path with a line segment. | |
virtual void | flush ()=0 |
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 () |
Callback interface for processing path data.
PathSink provides an interface that allows one to easily write code which processes path data, for instance when converting between path formats used by different graphics libraries. It is also useful for writing algorithms which must do something for each curve in the path.
To store a path in a new format, implement the virtual methods for segments in a derived class and call feed().
Definition at line 56 of file path-sink.h.
|
inlinevirtual |
Definition at line 110 of file path-sink.h.
|
pure virtual |
Output an elliptical arc segment.
See the EllipticalArc class for the documentation of parameters.
Implemented in Geom::CairoPathSink, Geom::PathIteratorSink< OutputIterator >, Geom::PathIteratorSink< SubpathInserter >, and Geom::SVGPathWriter.
Referenced by feed(), feed(), Geom::EllipticalArc::feed(), and wrap_parser().
|
inlinevirtual |
Undo the last segment.
This method is optional.
Reimplemented in Geom::PathIteratorSink< OutputIterator >, and Geom::PathIteratorSink< SubpathInserter >.
Definition at line 86 of file path-sink.h.
Referenced by wrap_parser().
|
pure virtual |
Close the current path with a line segment.
Implemented in Geom::CairoPathSink, Geom::PathIteratorSink< OutputIterator >, Geom::PathIteratorSink< SubpathInserter >, and Geom::SVGPathWriter.
Referenced by Geom::SVGPathParser::_closePath(), feed(), feed(), feed(), and wrap_parser().
|
pure virtual |
Output a quadratic Bezier segment.
Implemented in Geom::CairoPathSink, Geom::PathIteratorSink< OutputIterator >, Geom::PathIteratorSink< SubpathInserter >, and Geom::SVGPathWriter.
Referenced by Geom::Curve::feed(), Geom::BezierCurveN< degree >::feed(), Geom::BezierCurve::feed(), and wrap_parser().
|
virtual |
Output a circle as two elliptical arcs.
Reimplemented in Geom::PathIteratorSink< OutputIterator >, and Geom::PathIteratorSink< SubpathInserter >.
Definition at line 73 of file path-sink.cpp.
References arcTo(), c, Geom::Circle::center(), closePath(), moveTo(), and Geom::Circle::radius().
|
virtual |
Reimplemented in Geom::PathIteratorSink< OutputIterator >, and Geom::PathIteratorSink< SubpathInserter >.
Definition at line 39 of file path-sink.cpp.
References c.
Referenced by Geom::SVGPathParser::_pushCurve(), feed(), Geom::operator<<(), Geom::operator<<(), sp_is_valid_svg_path_d(), TEST_F(), and Geom::write_svg_path().
|
virtual |
Output an ellipse as two elliptical arcs.
Reimplemented in Geom::PathIteratorSink< OutputIterator >, and Geom::PathIteratorSink< SubpathInserter >.
Definition at line 85 of file path-sink.cpp.
References arcTo(), moveTo(), Geom::Ellipse::pointAt(), Geom::Ellipse::ray(), Geom::Ellipse::rotationAngle(), Geom::X, and Geom::Y.
|
virtual |
Output a subpath.
Calls the appropriate segment methods according to the contents of the passed subpath. You can override this function. NOTE: if you override only some of the feed() functions, always write this in the derived class:
Otherwise the remaining methods will be hidden.
Reimplemented in Geom::PathIteratorSink< OutputIterator >, Geom::PathIteratorSink< SubpathInserter >, Geom::PathIteratorSink< OutputIterator >, and Geom::PathIteratorSink< SubpathInserter >.
Definition at line 44 of file path-sink.cpp.
References Geom::Path::begin(), Geom::Path::closed(), closePath(), Geom::Path::end_open(), flush(), Geom::Path::front(), Geom::Curve::initialPoint(), and moveTo().
|
virtual |
Output a path.
Calls feed() on each path in the vector. You can override this function.
Reimplemented in Geom::PathIteratorSink< OutputIterator >, and Geom::PathIteratorSink< SubpathInserter >.
Definition at line 59 of file path-sink.cpp.
References feed().
|
virtual |
Output an axis-aligned rectangle, using moveTo, lineTo and closePath.
Reimplemented in Geom::PathIteratorSink< OutputIterator >, and Geom::PathIteratorSink< SubpathInserter >.
Definition at line 65 of file path-sink.cpp.
References closePath(), Geom::GenericRect< C >::corner(), lineTo(), and moveTo().
|
pure virtual |
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.
Implemented in Geom::CairoPathSink, Geom::PathIteratorSink< OutputIterator >, Geom::PathIteratorSink< SubpathInserter >, and Geom::SVGPathWriter.
Referenced by Geom::SVGPathParser::_parse(), feed(), and wrap_parser().
|
pure virtual |
Output a line segment.
Implemented in Geom::CairoPathSink, Geom::PathIteratorSink< OutputIterator >, Geom::PathIteratorSink< SubpathInserter >, and Geom::SVGPathWriter.
Referenced by Geom::BezierCurveN< degree >::feed(), Geom::BezierCurve::feed(), feed(), and wrap_parser().
|
pure virtual |
Move to a different point without creating a segment.
Usually starts a new subpath.
Implemented in Geom::CairoPathSink, Geom::PathIteratorSink< OutputIterator >, Geom::PathIteratorSink< SubpathInserter >, and Geom::SVGPathWriter.
Referenced by Geom::SVGPathParser::_moveTo(), feed(), feed(), feed(), Geom::Curve::feed(), Geom::BezierCurveN< degree >::feed(), Geom::EllipticalArc::feed(), Geom::BezierCurve::feed(), feed(), and wrap_parser().
Output a cubic Bezier segment.
Implemented in Geom::CairoPathSink, Geom::PathIteratorSink< OutputIterator >, Geom::PathIteratorSink< SubpathInserter >, and Geom::SVGPathWriter.
Referenced by Geom::BezierCurveN< degree >::feed(), Geom::BezierCurve::feed(), and wrap_parser().