From: johanengelen Date: Wed, 9 Apr 2008 20:34:47 +0000 (+0000) Subject: change doEffect_path to default to calling pwd2 for all continuous subpaths X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=46c4893a7458eda6edcd064121bc000634af7a09;p=inkscape.git change doEffect_path to default to calling pwd2 for all continuous subpaths --- diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 51a59f1a1..d8a48535a 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -123,6 +123,7 @@ Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj) } Effect::Effect(LivePathEffectObject *lpeobject) + : concatenate_before_pwd2(false) { lpeobj = lpeobject; oncanvasedit_it = 0; @@ -198,16 +199,29 @@ Effect::doEffect_nartbpath (NArtBpath * path_in) std::vector Effect::doEffect_path (std::vector & path_in) { - Geom::Piecewise > pwd2_in; - - for (unsigned int i=0; i < path_in.size(); i++) { - pwd2_in.concat( path_in[i].toPwSb() ); + std::vector path_out; + + if ( !concatenate_before_pwd2 ) { + // default behavior + for (unsigned int i=0; i < path_in.size(); i++) { + Geom::Piecewise > pwd2_in = path_in[i].toPwSb(); + Geom::Piecewise > pwd2_out = doEffect_pwd2(pwd2_in); + std::vector path = Geom::path_from_piecewise( pwd2_out, LPE_CONVERSION_TOLERANCE); + // add the output path vector to the already accumulated vector: + for (unsigned int j=0; j < path.size(); j++) { + path_out.push_back(path[j]); + } + } + } else { + // concatenate the path into possibly discontinuous pwd2 + Geom::Piecewise > pwd2_in; + for (unsigned int i=0; i < path_in.size(); i++) { + pwd2_in.concat( path_in[i].toPwSb() ); + } + Geom::Piecewise > pwd2_out = doEffect_pwd2(pwd2_in); + path_out = Geom::path_from_piecewise( pwd2_out, LPE_CONVERSION_TOLERANCE); } - Geom::Piecewise > pwd2_out = doEffect_pwd2(pwd2_in); - - std::vector path_out = Geom::path_from_piecewise( pwd2_out, LPE_CONVERSION_TOLERANCE); - return path_out; } diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index be3cefecf..1726613c5 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -121,11 +121,14 @@ protected: std::vector param_vector; int oncanvasedit_it; - Inkscape::UI::Widget::Registry wr; LivePathEffectObject *lpeobj; + // this boolean defaults to false, it concatenates the input path to one pwd2, + // instead of normally 'splitting' the path into continuous pwd2 paths. + bool concatenate_before_pwd2; + private: Effect(const Effect&); Effect& operator=(const Effect&); diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp index 026c8fb5f..d5bd53247 100644 --- a/src/live_effects/lpe-bendpath.cpp +++ b/src/live_effects/lpe-bendpath.cpp @@ -69,6 +69,8 @@ LPEBendPath::LPEBendPath(LivePathEffectObject *lpeobject) : prop_scale.param_set_digits(3); prop_scale.param_set_increments(0.01, 0.10); + concatenate_before_pwd2 = true; + groupSpecialBehavior = false; } @@ -82,26 +84,25 @@ LPEBendPath::doBeforeEffect (SPLPEItem *lpeitem) { if(SP_IS_GROUP(lpeitem)) { - groupSpecialBehavior = true; + groupSpecialBehavior = true; - using namespace Geom; - Piecewise > pwd2; - std::vector temppath; + using namespace Geom; + Piecewise > pwd2; + std::vector temppath; - recursive_original_bbox(SP_GROUP(lpeitem), pwd2, temppath); + recursive_original_bbox(SP_GROUP(lpeitem), pwd2, temppath); - for (unsigned int i=0; i < temppath.size(); i++) { - pwd2.concat( temppath[i].toPwSb() ); + for (unsigned int i=0; i < temppath.size(); i++) { + pwd2.concat( temppath[i].toPwSb() ); } - D2 > d2pw = make_cuts_independant(pwd2); - boundingbox_X = bounds_exact(d2pw[0]); - boundingbox_Y = bounds_exact(d2pw[1]); + D2 > d2pw = make_cuts_independant(pwd2); + boundingbox_X = bounds_exact(d2pw[0]); + boundingbox_Y = bounds_exact(d2pw[1]); } } - Geom::Piecewise > LPEBendPath::doEffect_pwd2 (Geom::Piecewise > & pwd2_in) {