From fb0a27f9accf3a054573a220bf1b449f697a1355 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Tue, 14 Nov 2006 00:43:28 +0000 Subject: patch 1591723 for extra tracing parameters (bzr r1948) --- src/trace/potrace/inkscape-potrace.cpp | 23 +++++++--------- src/trace/potrace/inkscape-potrace.h | 49 +++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 16 deletions(-) (limited to 'src/trace') 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 + * Stéphane Gimenez * - * 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 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 + * Stéphane Gimenez * - * 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 #include +#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? -- cgit v1.2.3