Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Geom::PathSink Class Referenceabstract

Callback interface for processing path data. More...

#include <path-sink.h>

Inheritance diagram for Geom::PathSink:
Geom::PathIteratorSink< SubpathInserter > Geom::CairoPathSink Geom::PathIteratorSink< OutputIterator > Geom::SVGPathWriter Geom::PathBuilder

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 ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~PathSink()

virtual Geom::PathSink::~PathSink ( )
inlinevirtual

Definition at line 110 of file path-sink.h.

Member Function Documentation

◆ arcTo()

virtual void Geom::PathSink::arcTo ( Coord  rx,
Coord  ry,
Coord  angle,
bool  large_arc,
bool  sweep,
Point const &  p 
)
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().

◆ backspace()

virtual bool Geom::PathSink::backspace ( )
inlinevirtual

Undo the last segment.

This method is optional.

Returns
true true if a segment was erased, false otherwise.

Reimplemented in Geom::PathIteratorSink< OutputIterator >, and Geom::PathIteratorSink< SubpathInserter >.

Definition at line 86 of file path-sink.h.

Referenced by wrap_parser().

◆ closePath()

virtual void Geom::PathSink::closePath ( )
pure virtual

◆ curveTo()

virtual void Geom::PathSink::curveTo ( Point const &  c0,
Point const &  c1,
Point const &  p 
)
pure virtual

◆ feed() [1/6]

void Geom::PathSink::feed ( Circle const &  e)
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().

◆ feed() [2/6]

void Geom::PathSink::feed ( Curve const &  c,
bool  moveto_initial = true 
)
virtual

◆ feed() [3/6]

void Geom::PathSink::feed ( Ellipse const &  e)
virtual

◆ feed() [4/6]

void Geom::PathSink::feed ( Path const &  p)
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:

virtual void feed(Curve const &c, bool moveto_initial=true)
Definition path-sink.cpp:39

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().

◆ feed() [5/6]

void Geom::PathSink::feed ( PathVector const &  v)
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().

◆ feed() [6/6]

void Geom::PathSink::feed ( Rect const &  r)
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().

◆ flush()

virtual void Geom::PathSink::flush ( )
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().

◆ lineTo()

virtual void Geom::PathSink::lineTo ( Point const &  p)
pure virtual

◆ moveTo()

virtual void Geom::PathSink::moveTo ( Point const &  p)
pure virtual

◆ quadTo()

virtual void Geom::PathSink::quadTo ( Point const &  c,
Point const &  p 
)
pure virtual

The documentation for this class was generated from the following files: