diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-06-06 01:43:35 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-06-06 01:43:35 +0000 |
| commit | 8a38c52bce619b07117cdd87a183eb05fb51e28e (patch) | |
| tree | 39b9f2af1ce9df43884a3b33ca2445097fe8f5a5 /src/live_effects | |
| parent | oops. sys/wait.h not on win32 (diff) | |
| download | inkscape-8a38c52bce619b07117cdd87a183eb05fb51e28e.tar.gz inkscape-8a38c52bce619b07117cdd87a183eb05fb51e28e.zip | |
merge gsoc2008_johan_path2geom into trunk
(bzr r5823)
Diffstat (limited to 'src/live_effects')
| -rw-r--r-- | src/live_effects/effect.cpp | 30 | ||||
| -rw-r--r-- | src/live_effects/effect.h | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-curvestitch.cpp | 4 | ||||
| -rw-r--r-- | src/live_effects/lpe-knot.h | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-test-doEffect-stack.cpp | 23 | ||||
| -rw-r--r-- | src/live_effects/lpe-test-doEffect-stack.h | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-vonkoch.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/parameter/parameter.h | 3 | ||||
| -rw-r--r-- | src/live_effects/parameter/path.cpp | 12 |
9 files changed, 17 insertions, 61 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 765d0a59b..0749e4e93 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -221,40 +221,22 @@ Effect::doBeforeEffect (SPLPEItem */*lpeitem*/) void Effect::doEffect (SPCurve * curve) { - NArtBpath *new_bpath = doEffect_nartbpath(curve->get_bpath()); + NArtBpath const *bpath_in = curve->get_bpath(); - curve->set_bpath(new_bpath); -} + std::vector<Geom::Path> result_pathv; -NArtBpath * -Effect::doEffect_nartbpath (NArtBpath const * path_in) -{ try { - std::vector<Geom::Path> orig_pathv = BPath_to_2GeomPath(path_in); - - std::vector<Geom::Path> result_pathv = doEffect_path(orig_pathv); + std::vector<Geom::Path> orig_pathv = BPath_to_2GeomPath(bpath_in); - NArtBpath *new_bpath = BPath_from_2GeomPath(result_pathv); - - return new_bpath; + result_pathv = doEffect_path(orig_pathv); } catch (std::exception & e) { g_warning("Exception during LPE %s execution. \n %s", getName().c_str(), e.what()); SP_ACTIVE_DESKTOP->messageStack()->flash( Inkscape::WARNING_MESSAGE, _("An exception occurred during execution of the Path Effect.") ); - - NArtBpath *path_out; - - unsigned ret = 0; - while ( path_in[ret].code != NR_END ) { - ++ret; - } - unsigned len = ++ret; - - path_out = g_new(NArtBpath, len); - memcpy(path_out, path_in, len * sizeof(NArtBpath)); - return path_out; } + + curve->set_pathv(result_pathv); } std::vector<Geom::Path> diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index c04f248e3..a8cb525b8 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -125,8 +125,6 @@ protected: // the order in which they appear is the order in which they are // called by this base class. (i.e. doEffect(SPCurve * curve) defaults to calling // doEffect(std::vector<Geom::Path> ) - virtual NArtBpath * - doEffect_nartbpath (NArtBpath const * path_in) __attribute__ ((deprecated)); virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in); virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp index 9cf9f2f26..814a381af 100644 --- a/src/live_effects/lpe-curvestitch.cpp +++ b/src/live_effects/lpe-curvestitch.cpp @@ -17,7 +17,7 @@ #include "sp-item.h" #include "sp-path.h" -#include "libnr/n-art-bpath-2geom.h" +#include "svg/svg.h" #include "xml/repr.h" #include <2geom/path.h> @@ -158,7 +158,7 @@ LPECurveStitch::resetDefaults(SPItem * item) // calculate bounding box: (isn't there a simpler way?) Piecewise<D2<SBasis> > pwd2; - std::vector<Geom::Path> temppath = SVGD_to_2GeomPath( SP_OBJECT_REPR(item)->attribute("inkscape:original-d")); + std::vector<Geom::Path> temppath = sp_svg_read_pathv( SP_OBJECT_REPR(item)->attribute("inkscape:original-d")); for (unsigned int i=0; i < temppath.size(); i++) { pwd2.concat( temppath[i].toPwSb() ); } diff --git a/src/live_effects/lpe-knot.h b/src/live_effects/lpe-knot.h index 521c2d7c9..a68888105 100644 --- a/src/live_effects/lpe-knot.h +++ b/src/live_effects/lpe-knot.h @@ -27,7 +27,6 @@ public: // Choose to implement one of the doEffect functions. You can delete or comment out the others. // virtual void doEffect (SPCurve * curve); -// virtual NArtBpath * doEffect_nartbpath (NArtBpath * path_in); virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & input_path); // virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in); diff --git a/src/live_effects/lpe-test-doEffect-stack.cpp b/src/live_effects/lpe-test-doEffect-stack.cpp index f3fb346fe..3b578b2c6 100644 --- a/src/live_effects/lpe-test-doEffect-stack.cpp +++ b/src/live_effects/lpe-test-doEffect-stack.cpp @@ -45,31 +45,10 @@ LPEdoEffectStackTest::doEffect (SPCurve * curve) } } -NArtBpath * -LPEdoEffectStackTest::doEffect_nartbpath (NArtBpath const * path_in) -{ - if (step >= 2) { - return Effect::doEffect_nartbpath(path_in); - } else { - // return here - NArtBpath *path_out; - - unsigned ret = 0; - while ( path_in[ret].code != NR_END ) { - ++ret; - } - unsigned len = ++ret; - - path_out = g_new(NArtBpath, len); - memcpy(path_out, path_in, len * sizeof(NArtBpath)); - return path_out; - } -} - std::vector<Geom::Path> LPEdoEffectStackTest::doEffect_path (std::vector<Geom::Path> const & path_in) { - if (step >= 3) { + if (step >= 2) { return Effect::doEffect_path(path_in); } else { // return here diff --git a/src/live_effects/lpe-test-doEffect-stack.h b/src/live_effects/lpe-test-doEffect-stack.h index cf2d480b1..7c22a3b37 100644 --- a/src/live_effects/lpe-test-doEffect-stack.h +++ b/src/live_effects/lpe-test-doEffect-stack.h @@ -26,7 +26,6 @@ public: virtual ~LPEdoEffectStackTest(); virtual void doEffect (SPCurve * curve); - virtual NArtBpath * doEffect_nartbpath (NArtBpath const * path_in); virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in); virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in); diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp index ee09221ed..114dd7263 100644 --- a/src/live_effects/lpe-vonkoch.cpp +++ b/src/live_effects/lpe-vonkoch.cpp @@ -159,7 +159,7 @@ LPEVonKoch::resetDefaults(SPItem * item) // set the bend path to run horizontally in the middle of the bounding box of the original path Piecewise<D2<SBasis> > pwd2; - std::vector<Geom::Path> temppath = SVGD_to_2GeomPath( SP_OBJECT_REPR(item)->attribute("inkscape:original-d")); + std::vector<Geom::Path> temppath = sp_svg_read_pathv( SP_OBJECT_REPR(item)->attribute("inkscape:original-d")); for (unsigned int i=0; i < temppath.size(); i++) { pwd2.concat( temppath[i].toPwSb() ); } diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h index d3afec3af..511ce46a2 100644 --- a/src/live_effects/parameter/parameter.h +++ b/src/live_effects/parameter/parameter.h @@ -10,8 +10,7 @@ */ #include <glibmm/ustring.h> -#include <2geom/point.h> -#include <2geom/path.h> +#include <2geom/forward.h> struct SPDesktop; struct SPItem; diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index 376e61bee..759e9f788 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -113,10 +113,10 @@ PathParam::param_readSVGValue(const gchar * strvalue) } catch (Inkscape::BadURIException &e) { g_warning("%s", e.what()); ref.detach(); - _pathvector = SVGD_to_2GeomPath(defvalue); + _pathvector = sp_svg_read_pathv(defvalue); } } else { - _pathvector = SVGD_to_2GeomPath(strvalue); + _pathvector = sp_svg_read_pathv(strvalue); } signal_path_changed.emit(); @@ -132,7 +132,7 @@ PathParam::param_getSVGValue() const if (href) { return href; } else { - gchar * svgd = SVGD_from_2GeomPath( _pathvector ); + gchar * svgd = sp_svg_write_path( _pathvector ); return svgd; } } @@ -233,7 +233,7 @@ PathParam::param_set_and_write_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> { remove_link(); _pathvector = Geom::path_from_piecewise(newpath, LPE_CONVERSION_TOLERANCE); - gchar * svgd = SVGD_from_2GeomPath( _pathvector ); + gchar * svgd = sp_svg_write_path( _pathvector ); param_write_to_repr(svgd); g_free(svgd); // force value upon pwd2 and don't recalculate. @@ -248,7 +248,7 @@ PathParam::param_set_and_write_new_value (std::vector<Geom::Path> const & newpat _pathvector = newpath; must_recalculate_pwd2 = true; - gchar * svgd = SVGD_from_2GeomPath( _pathvector ); + gchar * svgd = sp_svg_write_path( _pathvector ); param_write_to_repr(svgd); g_free(svgd); } @@ -324,7 +324,7 @@ PathParam::linked_modified(SPObject *linked_obj, guint /*flags*/) if (curve == NULL) { // curve invalid, set default value - _pathvector = SVGD_to_2GeomPath(defvalue); + _pathvector = sp_svg_read_pathv(defvalue); } else { _pathvector = BPath_to_2GeomPath(SP_CURVE_BPATH(curve)); curve->unref(); |
