From 3b17d8b1415bac54dce1db357e95a2a2c7cbf246 Mon Sep 17 00:00:00 2001 From: MenTaLguY Date: Wed, 24 Jan 2007 03:24:42 +0000 Subject: switch to using SVG::PathString for building paths (bzr r2268) --- src/trace/potrace/inkscape-potrace.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'src/trace') diff --git a/src/trace/potrace/inkscape-potrace.cpp b/src/trace/potrace/inkscape-potrace.cpp index c27309eb9..3f4cbc36c 100644 --- a/src/trace/potrace/inkscape-potrace.cpp +++ b/src/trace/potrace/inkscape-potrace.cpp @@ -27,7 +27,7 @@ #include #include "message-stack.h" #include -#include +#include #include "curve.h" #include "bitmap.h" @@ -125,7 +125,7 @@ hasPoint(std::vector &points, double x, double y) */ static long writePaths(PotraceTracingEngine *engine, potrace_path_t *plist, - Inkscape::SVGOStringStream& data, std::vector &points) + Inkscape::SVG::PathString& data, std::vector &points) { long nodeCount = 0L; @@ -155,7 +155,7 @@ writePaths(PotraceTracingEngine *engine, potrace_path_t *plist, p.x = x2; p.y = y2; points.push_back(p); } - data << "M " << x2 << " " << y2 << " "; + data.moveTo(x2, y2); nodeCount++; for (int i=0 ; in ; i++) @@ -172,21 +172,17 @@ writePaths(PotraceTracingEngine *engine, potrace_path_t *plist, switch (curve->tag[i]) { case POTRACE_CORNER: - data << "L " << x1 << " " << y1 << " " ; - data << "L " << x2 << " " << y2 << " " ; + data.lineTo(x1, y1).lineTo(x2, y2); break; case POTRACE_CURVETO: - data << "C " << x0 << " " << y0 << " " - << x1 << " " << y1 << " " - << x2 << " " << y2 << " "; - + data.curveTo(x0, y0, x1, y1, x2, y2); break; default: break; } nodeCount++; } - data << "z"; + data.closePath(); for (path_t *child=node->childlist; child ; child=child->sibling) { @@ -395,9 +391,7 @@ PotraceTracingEngine::grayMapToPath(GrayMap *grayMap, long *nodeCount) return ""; } - Inkscape::SVGOStringStream data; - - data << ""; + Inkscape::SVG::PathString data; //## copy the path information into our d="" attribute string std::vector points; @@ -409,12 +403,10 @@ PotraceTracingEngine::grayMapToPath(GrayMap *grayMap, long *nodeCount) if (!keepGoing) return ""; - std::string d = data.str(); if ( nodeCount) *nodeCount = thisNodeCount; - return d; - + return data.ustring(); } -- cgit v1.2.3