X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Ftrace%2Ftrace.h;h=1341e3d464871883b69015e13af1171acbddf4db;hb=761a541468cc0b8a7fcfb8c65784c0896f0f80f4;hp=bf4a345a6952622c9f8fa3c32b0ca12bcc95dc2e;hpb=6b15695578f07a3f72c4c9475c1a261a3021472a;p=inkscape.git diff --git a/src/trace/trace.h b/src/trace/trace.h index bf4a345a6..1341e3d46 100644 --- a/src/trace/trace.h +++ b/src/trace/trace.h @@ -1,11 +1,11 @@ -/* +/** * A generic interface for plugging different * autotracers into Inkscape. * * Authors: * Bob Jamison * - * Copyright (C) 2004 Bob Jamison + * Copyright (C) 2004-2006 Bob Jamison * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -24,8 +24,10 @@ # include #endif -#include +#include +#include +#include struct SPImage; struct SPItem; @@ -47,38 +49,39 @@ public: /** * */ - TracingEngineResult(char *theStyle, char *thePathData, long theNodeCount) + TracingEngineResult(const std::string &theStyle, + const std::string &thePathData, + long theNodeCount) { - next = NULL; - style = strdup(theStyle); - pathData = strdup(thePathData); + style = theStyle; + pathData = thePathData; nodeCount = theNodeCount; } + TracingEngineResult(const TracingEngineResult &other) + { assign(other); } + + virtual TracingEngineResult &operator=(const TracingEngineResult &other) + { assign(other); return *this; } + + /** * */ virtual ~TracingEngineResult() - { - if (next) - delete next; - if (style) - free(style); - if (pathData) - free(pathData); - } + { } /** * */ - char *getStyle() + std::string getStyle() { return style; } /** * */ - char *getPathData() + std::string getPathData() { return pathData; } /** @@ -87,16 +90,18 @@ public: long getNodeCount() { return nodeCount; } - /** - * - */ - TracingEngineResult *next; - private: - char *style; + void assign(const TracingEngineResult &other) + { + style = other.style; + pathData = other.pathData; + nodeCount = other.nodeCount; + } - char *pathData; + std::string style; + + std::string pathData; long nodeCount; @@ -131,8 +136,9 @@ class TracingEngine * compatible with the d="" attribute * of an SVG element. */ - virtual TracingEngineResult *trace(GdkPixbuf *pixbuf, int *nrPaths) - { return NULL; } + virtual std::vector trace( + Glib::RefPtr pixbuf) + { std::vector dummy; return dummy; } /** @@ -171,7 +177,7 @@ public: Tracer() { engine = NULL; - selectedItem = NULL; + sioxEnabled = false; } @@ -187,7 +193,7 @@ public: * A convenience method to allow other software to 'see' the * same image that this class sees. */ - GdkPixbuf *getSelectedImage(); + Glib::RefPtr getSelectedImage(); /** * This is the main working method. Trace the selected image, if @@ -202,6 +208,11 @@ public: */ void abort(); + /** + * Whether we want to enable SIOX subimage selection + */ + void enableSiox(bool enable); + private: @@ -224,8 +235,15 @@ private: SPImage *getSelectedSPImage(); - SPItem *selectedItem; + std::vector sioxShapes; + + bool sioxEnabled; + + Glib::RefPtr sioxProcessImage( + SPImage *img, Glib::RefPtr origPixbuf); + Glib::RefPtr lastSioxPixbuf; + Glib::RefPtr lastOrigPixbuf; };//class Tracer