diff --git a/src/svg/svg-path.cpp b/src/svg/svg-path.cpp
index e6899a3b2a3660adf9c6083d9469ee7f3f87e319..0239d2ae0cd843d32c916982ff9170fdee0d5007 100644 (file)
--- a/src/svg/svg-path.cpp
+++ b/src/svg/svg-path.cpp
#define __SP_SVG_PARSE_C__
-/*
+/*
svg-path.c: Parse SVG path element data into bezier path.
-
+
Copyright (C) 2000 Eazel, Inc.
Copyright (C) 2000 Lauris Kaplinski
Copyright (C) 2001 Ximian, Inc.
-
+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-
+
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-
+
Authors:
Raph Levien <raph@artofcode.com>
Lauris Kaplinski <lauris@ximian.com>
*/
+#include <cstring>
+#include <string>
#include <cassert>
#include <glib/gmem.h>
#include <glib/gmessages.h>
#include <glib/gstrfuncs.h>
+#include <glib.h> // g_assert()
#include "libnr/n-art-bpath.h"
#include "gnome-canvas-bpath-util.h"
-#include "stringstream.h"
+#include "svg/path-string.h"
/* This module parses an SVG path element into an RsvgBpathDef.
g_return_val_if_fail (bpath != NULL, NULL);
+ Inkscape::SVG::PathString str;
+
for (int i = 0; bpath[i].code != NR_END; i++){
- if (i) {
- os << " ";
- }
switch (bpath [i].code){
case NR_LINETO:
- os << "L " << bpath[i].x3 << "," << bpath[i].y3;
+ str.lineTo(bpath[i].x3, bpath[i].y3);
break;
case NR_CURVETO:
- os << "C " << bpath[i].x1 << "," << bpath[i].y1
- << " " << bpath[i].x2 << "," << bpath[i].y2
- << " " << bpath[i].x3 << "," << bpath[i].y3;
+ str.curveTo(bpath[i].x1, bpath[i].y1,
+ bpath[i].x2, bpath[i].y2,
+ bpath[i].x3, bpath[i].y3);
break;
case NR_MOVETO_OPEN:
case NR_MOVETO:
if (closed) {
- os << "z ";
+ str.closePath();
}
closed = ( bpath[i].code == NR_MOVETO );
- os << "M " << bpath[i].x3 << "," << bpath[i].y3;
+ str.moveTo(bpath[i].x3, bpath[i].y3);
break;
+
default:
g_assert_not_reached ();
}
}
if (closed) {
- os << " z ";
+ str.closePath();
}
-// std::string s = os.str();
-// gchar *ret = g_strdup(s.c_str());
-// delete (s);
-// return ret;
- return g_strdup (os.str().c_str());
+ return g_strdup(str.c_str());
}
/*