summaryrefslogtreecommitdiffstats
path: root/src/trace
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2006-11-14 00:43:28 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2006-11-14 00:43:28 +0000
commitfb0a27f9accf3a054573a220bf1b449f697a1355 (patch)
tree91f3c2a0f165589224d5cf4ed153c71b92af4b92 /src/trace
parentpatch for emf export on win32 (diff)
downloadinkscape-fb0a27f9accf3a054573a220bf1b449f697a1355.tar.gz
inkscape-fb0a27f9accf3a054573a220bf1b449f697a1355.zip
patch 1591723 for extra tracing parameters
(bzr r1948)
Diffstat (limited to 'src/trace')
-rw-r--r--src/trace/potrace/inkscape-potrace.cpp23
-rw-r--r--src/trace/potrace/inkscape-potrace.h49
2 files changed, 56 insertions, 16 deletions
diff --git a/src/trace/potrace/inkscape-potrace.cpp b/src/trace/potrace/inkscape-potrace.cpp
index 404d25d3a..e36673e4f 100644
--- a/src/trace/potrace/inkscape-potrace.cpp
+++ b/src/trace/potrace/inkscape-potrace.cpp
@@ -3,8 +3,9 @@
*
* Authors:
* Bob Jamison <rjamison@titan.com>
+ * Stéphane Gimenez <dev@gim.name>
*
- * Copyright (C) 2004 Bob Jamison
+ * Copyright (C) 2004-2006 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*
@@ -70,18 +71,23 @@ namespace Potrace {
*/
PotraceTracingEngine::PotraceTracingEngine()
{
+ /* get default parameters */
+ potraceParams = potrace_param_default();
+ potraceParams->progress.callback = potraceStatusCallback;
+ potraceParams->progress.data = (void *)this;
//##### Our defaults
invert = false;
traceType = TRACE_BRIGHTNESS;
-
quantizationNrColors = 8;
-
brightnessThreshold = 0.45;
-
cannyHighThreshold = 0.65;
+}
+PotraceTracingEngine::~PotraceTracingEngine()
+{
+ potrace_param_free(potraceParams);
}
@@ -366,13 +372,6 @@ PotraceTracingEngine::preview(Glib::RefPtr<Gdk::Pixbuf> thePixbuf)
std::string
PotraceTracingEngine::grayMapToPath(GrayMap *grayMap, long *nodeCount)
{
-
- /* get default parameters */
- potrace_param_t *potraceParams = potrace_param_default();
-
- potraceParams->progress.callback = potraceStatusCallback;
- potraceParams->progress.data = (void *)this;
-
potrace_bitmap_t *potraceBitmap = bm_new(grayMap->width, grayMap->height);
bm_clear(potraceBitmap, 0);
@@ -410,7 +409,6 @@ PotraceTracingEngine::grayMapToPath(GrayMap *grayMap, long *nodeCount)
{
g_warning("aborted");
potrace_state_free(potraceState);
- potrace_param_free(potraceParams);
return "";
}
@@ -424,7 +422,6 @@ PotraceTracingEngine::grayMapToPath(GrayMap *grayMap, long *nodeCount)
/* free a potrace items */
potrace_state_free(potraceState);
- potrace_param_free(potraceParams);
if (!keepGoing)
return "";
diff --git a/src/trace/potrace/inkscape-potrace.h b/src/trace/potrace/inkscape-potrace.h
index f3459159f..838a1363a 100644
--- a/src/trace/potrace/inkscape-potrace.h
+++ b/src/trace/potrace/inkscape-potrace.h
@@ -3,8 +3,9 @@
*
* Authors:
* Bob Jamison <rjamison@titan.com>
+ * Stéphane Gimenez <dev@gim.name>
*
- * Copyright (C) 2004 Bob Jamison
+ * Copyright (C) 2004-2006 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*
@@ -20,6 +21,8 @@
#include <trace/trace.h>
#include <trace/imagemap.h>
+#include "potracelib.h"
+
namespace Inkscape {
namespace Trace {
@@ -50,8 +53,47 @@ class PotraceTracingEngine : public TracingEngine
/**
*
*/
- virtual ~PotraceTracingEngine()
- {}
+ ~PotraceTracingEngine();
+
+
+ /**
+ * Sets/gets potrace parameters
+ */
+ void setParamsTurdSize(int val)
+ {
+ potraceParams->turdsize = val;
+ }
+ int getParamsTurdSize()
+ {
+ return potraceParams->turdsize;
+ }
+
+ void setParamsAlphaMax(double val)
+ {
+ potraceParams->alphamax = val;
+ }
+ double getParamsAlphaMax()
+ {
+ return potraceParams->alphamax;
+ }
+
+ void setParamsOptiCurve(bool val)
+ {
+ potraceParams->opticurve = val;
+ }
+ bool getParamsOptiCurve()
+ {
+ return potraceParams->opticurve;
+ }
+
+ void setParamsOptTolerance(double val)
+ {
+ potraceParams->opttolerance = val;
+ }
+ double getParamsOptTolerance()
+ {
+ return potraceParams->opttolerance;
+ }
void setTraceType(TraceType val)
{
@@ -199,6 +241,7 @@ class PotraceTracingEngine : public TracingEngine
private:
+ potrace_param_t *potraceParams;
TraceType traceType;
//## do i invert at the end?