summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-04-09 20:34:47 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-04-09 20:34:47 +0000
commit232083aa5e3b3aec3c49612c793dd12dda20f740 (patch)
tree7dd14b8e2474812e4fc7182f5f2873ba5b383563 /src
parentFixed Makefile following earlier commit (removed and added relevant .py files) (diff)
downloadinkscape-232083aa5e3b3aec3c49612c793dd12dda20f740.tar.gz
inkscape-232083aa5e3b3aec3c49612c793dd12dda20f740.zip
change doEffect_path to default to calling pwd2 for all continuous subpaths
(bzr r5392)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/effect.cpp30
-rw-r--r--src/live_effects/effect.h5
-rw-r--r--src/live_effects/lpe-bendpath.cpp23
3 files changed, 38 insertions, 20 deletions
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<Geom::Path>
Effect::doEffect_path (std::vector<Geom::Path> & path_in)
{
- Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_in;
-
- for (unsigned int i=0; i < path_in.size(); i++) {
- pwd2_in.concat( path_in[i].toPwSb() );
+ std::vector<Geom::Path> path_out;
+
+ if ( !concatenate_before_pwd2 ) {
+ // default behavior
+ for (unsigned int i=0; i < path_in.size(); i++) {
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_in = path_in[i].toPwSb();
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_out = doEffect_pwd2(pwd2_in);
+ std::vector<Geom::Path> 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<Geom::D2<Geom::SBasis> > pwd2_in;
+ for (unsigned int i=0; i < path_in.size(); i++) {
+ pwd2_in.concat( path_in[i].toPwSb() );
+ }
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_out = doEffect_pwd2(pwd2_in);
+ path_out = Geom::path_from_piecewise( pwd2_out, LPE_CONVERSION_TOLERANCE);
}
- Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_out = doEffect_pwd2(pwd2_in);
-
- std::vector<Geom::Path> 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<Parameter *> 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<D2<SBasis> > pwd2;
- std::vector<Geom::Path> temppath;
+ using namespace Geom;
+ Piecewise<D2<SBasis> > pwd2;
+ std::vector<Geom::Path> 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<Piecewise<SBasis> > d2pw = make_cuts_independant(pwd2);
- boundingbox_X = bounds_exact(d2pw[0]);
- boundingbox_Y = bounds_exact(d2pw[1]);
+ D2<Piecewise<SBasis> > d2pw = make_cuts_independant(pwd2);
+ boundingbox_X = bounds_exact(d2pw[0]);
+ boundingbox_Y = bounds_exact(d2pw[1]);
}
}
-
Geom::Piecewise<Geom::D2<Geom::SBasis> >
LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
{