diff --git a/src/trace/trace.h b/src/trace/trace.h
index bf4a345a6952622c9f8fa3c32b0ca12bcc95dc2e..1341e3d464871883b69015e13af1171acbddf4db 100644 (file)
--- a/src/trace/trace.h
+++ b/src/trace/trace.h
-/*
+/**
* A generic interface for plugging different
* autotracers into Inkscape.
*
* Authors:
* Bob Jamison <rjamison@titan.com>
*
- * Copyright (C) 2004 Bob Jamison
+ * Copyright (C) 2004-2006 Bob Jamison
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
# include <string.h>
#endif
-#include <gdk/gdkpixbuf.h>
+#include <gtkmm.h>
+#include <vector>
+#include <sp-shape.h>
struct SPImage;
struct SPItem;
/**
*
*/
- 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; }
/**
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;
* compatible with the d="" attribute
* of an SVG <path> element.
*/
- virtual TracingEngineResult *trace(GdkPixbuf *pixbuf, int *nrPaths)
- { return NULL; }
+ virtual std::vector<TracingEngineResult> trace(
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf)
+ { std::vector<TracingEngineResult> dummy; return dummy; }
/**
Tracer()
{
engine = NULL;
- selectedItem = NULL;
+ sioxEnabled = false;
}
* A convenience method to allow other software to 'see' the
* same image that this class sees.
*/
- GdkPixbuf *getSelectedImage();
+ Glib::RefPtr<Gdk::Pixbuf> getSelectedImage();
/**
* This is the main working method. Trace the selected image, if
*/
void abort();
+ /**
+ * Whether we want to enable SIOX subimage selection
+ */
+ void enableSiox(bool enable);
+
private:
SPImage *getSelectedSPImage();
- SPItem *selectedItem;
+ std::vector<SPShape *> sioxShapes;
+
+ bool sioxEnabled;
+
+ Glib::RefPtr<Gdk::Pixbuf> sioxProcessImage(
+ SPImage *img, Glib::RefPtr<Gdk::Pixbuf> origPixbuf);
+ Glib::RefPtr<Gdk::Pixbuf> lastSioxPixbuf;
+ Glib::RefPtr<Gdk::Pixbuf> lastOrigPixbuf;
};//class Tracer