diff options
| author | mcecchetti <mcecchetti@users.sourceforge.net> | 2008-05-28 09:40:56 +0000 |
|---|---|---|
| committer | mcecchetti <mcecchetti@users.sourceforge.net> | 2008-05-28 09:40:56 +0000 |
| commit | ee0c39f9d8dc799c0af918c87ffd1408d79e5b44 (patch) | |
| tree | 4e563c29875b002b504f53b257d96756f3ba7b63 /src/2geom/svg-path.cpp | |
| parent | Fix for PathString to eliminate use of sscanf (which is locale dependent). (diff) | |
| download | inkscape-ee0c39f9d8dc799c0af918c87ffd1408d79e5b44.tar.gz inkscape-ee0c39f9d8dc799c0af918c87ffd1408d79e5b44.zip | |
added methods to PathSink to manage horizontal and vertical line segments, modified svg-path-parser.rl accordingly; now PathSink::arcTo has a real implementation; parser issue quickly solved by Aaron Spike
(bzr r5758)
Diffstat (limited to 'src/2geom/svg-path.cpp')
| -rw-r--r-- | src/2geom/svg-path.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/2geom/svg-path.cpp b/src/2geom/svg-path.cpp index 2c275cb4c..819b53aac 100644 --- a/src/2geom/svg-path.cpp +++ b/src/2geom/svg-path.cpp @@ -39,6 +39,14 @@ void output(Curve const &curve, SVGPathSink &sink) { sink.curveTo(pts[0], pts[1], pts[2]); } +void output(HLineSegment const &curve, SVGPathSink &sink) { + sink.hlineTo(curve.finalPoint()[X]); +} + +void output(VLineSegment const &curve, SVGPathSink &sink) { + sink.vlineTo(curve.finalPoint()[Y]); +} + void output(LineSegment const &curve, SVGPathSink &sink) { sink.lineTo(curve[1]); } @@ -51,9 +59,10 @@ void output(QuadraticBezier const &curve, SVGPathSink &sink) { sink.quadTo(curve[1], curve[2]); } -void output(EllipticalArc const &/*curve*/, SVGPathSink &/*sink*/) { - // FIXME - THROW_NOTIMPLEMENTED(); +void output(EllipticalArc const &curve, SVGPathSink &sink) { + sink.arcTo( curve.ray(X), curve.ray(Y), curve.rotation_angle(), + curve.large_arc_flag(), curve.sweep_flag(), + curve.finalPoint() ); } template <typename T> @@ -72,6 +81,8 @@ void output_svg_path(Path &path, SVGPathSink &sink) { Path::iterator iter; for ( iter = path.begin() ; iter != path.end() ; ++iter ) { + output_as<HLineSegment>(*iter, sink) || + output_as<VLineSegment>(*iter, sink) || output_as<LineSegment>(*iter, sink) || output_as<CubicBezier>(*iter, sink) || output_as<QuadraticBezier>(*iter, sink) || |
