summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8033a86)
raw | patch | inline | side by side (parent: 8033a86)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 12 Jul 2008 14:45:33 +0000 (14:45 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 12 Jul 2008 14:45:33 +0000 (14:45 +0000) |
src/svg/path-string.cpp | patch | blob | history | |
src/svg/path-string.h | patch | blob | history | |
src/svg/svg-path.cpp | patch | blob | history |
index 39d66d74ef5a3ecc926e7330c616a9d79fe7d29d..68fcb26d855f78d0e2fbeff49a2fd7a64b9b352f 100644 (file)
--- a/src/svg/path-string.cpp
+++ b/src/svg/path-string.cpp
appendCoord(str, p[NR::Y], rp[NR::Y]);
}
+void Inkscape::SVG::PathString::State::append(NR::Coord v, NR::Coord& rv) {
+ str += ' ';
+ appendCoord(str, v, rv);
+}
+
// NOTE: The following two appendRelative methods will not be exact if the total number of digits needed
// to represent the difference exceeds the precision of a double. This is not very likely though, and if
// it does happen the imprecise value is not likely to be chosen (because it will probably be a lot longer
@@ -138,6 +143,11 @@ void Inkscape::SVG::PathString::State::appendRelative(NR::Point p, NR::Point r)
appendRelativeCoord(str, p[NR::Y], r[NR::Y]);
}
+void Inkscape::SVG::PathString::State::appendRelative(NR::Coord v, NR::Coord r) {
+ str += ' ';
+ appendRelativeCoord(str, v, r);
+}
+
/*
Local Variables:
mode:c++
diff --git a/src/svg/path-string.h b/src/svg/path-string.h
index 39d6d3f07d0ac0c559d321980ea25cdd701fbcb9..bba4c8473969b550d09e10505d96cb6cc6ffbb4a 100644 (file)
--- a/src/svg/path-string.h
+++ b/src/svg/path-string.h
return *this;
}
+ PathString &horizontalLineTo(NR::Coord x) {
+ _appendOp('H','h');
+ _appendX(x, true);
+ return *this;
+ }
+
+ PathString &verticalLineTo(NR::Coord y) {
+ _appendOp('V','v');
+ _appendY(y, true);
+ return *this;
+ }
+
PathString &quadTo(NR::Coord cx, NR::Coord cy, NR::Coord x, NR::Coord y) {
return quadTo(NR::Point(cx, cy), NR::Point(x, y));
}
_abs_state.append(p);
_rel_state.append(p);
}
-/*
+
void _appendX(NR::Coord x, bool sc) {
double rx;
_abs_state.append(x, rx);
_abs_state.append(y, ry);
_rel_state.appendRelative(ry, _current_point[NR::Y]);
if (sc) _current_point[NR::Y] = ry;
- }*/
+ }
void _appendPoint(NR::Point p, bool sc) {
NR::Point rp;
void append(NR::Coord v);
void append(NR::Point v);
- //void append(NR::Coord v, NR::Coord& rv);
+ void append(NR::Coord v, NR::Coord& rv);
void append(NR::Point p, NR::Point& rp);
- //void appendRelative(NR::Coord v, NR::Coord r);
+ void appendRelative(NR::Coord v, NR::Coord r);
void appendRelative(NR::Point p, NR::Point r);
bool operator<=(const State& s) const {
diff --git a/src/svg/svg-path.cpp b/src/svg/svg-path.cpp
index 3deb6105c6cb9de869fbb6c0fb595cc44306b8eb..a57b9248cc49dbbd9a9e1c331e478dd3f8c1ce88 100644 (file)
--- a/src/svg/svg-path.cpp
+++ b/src/svg/svg-path.cpp
@@ -762,11 +762,12 @@ static void sp_svg_write_curve(Inkscape::SVG::PathString & str, Geom::Curve cons
svg_elliptical_arc->rotation_angle(),
svg_elliptical_arc->large_arc_flag(), svg_elliptical_arc->sweep_flag(),
svg_elliptical_arc->finalPoint() );
-/* else if(Geom::HLineSegment const *hline_segment = dynamic_cast<Geom::HLineSegment const *>(c)) {
- str.horizontalLineTo( ... );
+ }
+ else if(Geom::HLineSegment const *hline_segment = dynamic_cast<Geom::HLineSegment const *>(c)) {
+ str.horizontalLineTo( hline_segment->finalPoint()[0] );
}
else if(Geom::VLineSegment const *vline_segment = dynamic_cast<Geom::VLineSegment const *>(c)) {
- str.verticalLineTo( ... ); */
+ str.verticalLineTo( vline_segment->finalPoint()[1] );
} else {
//this case handles sbasis as well as all other curve types
Geom::Path sbasis_path = Geom::cubicbezierpath_from_sbasis(c->toSBasis(), 0.1);