summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2007-11-23 23:18:12 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2007-11-23 23:18:12 +0000
commitd46944e58b0d2228efff64ef7caca1d09430a67a (patch)
treeb08951248b5620cff90ec579762a6c55d89a99c0 /src
parentFix [ 1835591 ] Reproducible crash on opening the attached file (diff)
downloadinkscape-d46944e58b0d2228efff64ef7caca1d09430a67a.tar.gz
inkscape-d46944e58b0d2228efff64ef7caca1d09430a67a.zip
LPE add experimental width control to bend path!
(bzr r4130)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-pathalongpath.cpp25
-rw-r--r--src/live_effects/lpe-pathalongpath.h5
2 files changed, 19 insertions, 11 deletions
diff --git a/src/live_effects/lpe-pathalongpath.cpp b/src/live_effects/lpe-pathalongpath.cpp
index 7138b6faa..e552bdaad 100644
--- a/src/live_effects/lpe-pathalongpath.cpp
+++ b/src/live_effects/lpe-pathalongpath.cpp
@@ -63,22 +63,17 @@ static const Util::EnumDataConverter<PAPCopyType> PAPCopyTypeConverter(PAPCopyTy
LPEPathAlongPath::LPEPathAlongPath(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
bend_path(_("Bend path"), _("Path along which to bend the original path"), "bendpath", &wr, this, "M0,0 L1,0"),
+ width_path(_("Width path"), _("..."), "widthpath", &wr, this, "M0,0 L1,0"),
copytype(_("Path copies"), _("How many copies to place along the skeleton path"), "copytype", PAPCopyTypeConverter, &wr, this, PAPCT_SINGLE_STRETCHED),
prop_scale(_("Width"), _("Width of the path"), "prop_scale", &wr, this, 1),
scale_y_rel(_("Width in units of length"), _("Scale the width of the path in units of its length"), "scale_y_rel", &wr, this, false),
- spacing(_("Spacing"), _("Space between copies of the path"), "spacing", &wr, this, 0),
- normal_offset(_("Normal offset"), "", "normal_offset", &wr, this, 0),
- tang_offset(_("Tangential offset"), "", "tang_offset", &wr, this, 0),
vertical_pattern(_("Original path is vertical"), "", "vertical", &wr, this, false)
{
registerParameter( dynamic_cast<Parameter *>(&bend_path) );
+ registerParameter( dynamic_cast<Parameter *>(&width_path) );
registerParameter( dynamic_cast<Parameter *>(&copytype) );
registerParameter( dynamic_cast<Parameter *>(&prop_scale) );
registerParameter( dynamic_cast<Parameter *>(&scale_y_rel) );
-//These parameters have not been implemented yet:
-// registerParameter( dynamic_cast<Parameter *>(&spacing) );
-// registerParameter( dynamic_cast<Parameter *>(&normal_offset) );
-// registerParameter( dynamic_cast<Parameter *>(&tang_offset) );
registerParameter( dynamic_cast<Parameter *>(&vertical_pattern) );
prop_scale.param_set_digits(3);
@@ -151,10 +146,15 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2
if (prop_scale != 1.0) y *= prop_scale;
}
+ Piecewise<D2<SBasis> > widthpwd2 = arc_length_parametrization(Piecewise<D2<SBasis> >(width_path),2,.1);
+ D2<Piecewise<SBasis> > widthd2pw = make_cuts_independant(widthpwd2);
+ Piecewise<SBasis> width = (Piecewise<SBasis>(widthd2pw[Y]) - uskeletonbounds[Y].middle()) * wfactor;
+
+
double offs = 0;
Piecewise<D2<SBasis> > output;
for (int i=0; i<nbCopies; i++){
- output.concat(compose(uskeleton,x+offs)+y*compose(n,x+offs));
+ output.concat(compose(uskeleton,x+offs) + y*compose(width,x+offs)*compose(n,x+offs));
offs+=pattWidth;
}
@@ -187,6 +187,15 @@ LPEPathAlongPath::resetDefaults(SPItem * item)
path.start( start );
path.appendNew<Geom::LineSegment>( end );
bend_path.param_set_and_write_new_value( path.toPwSb() );
+
+ Point startw(bndsX.min(), bndsY.max());
+ Point endw(bndsX.max(), bndsY.max());
+ Geom::Path pathw;
+ pathw.start( startw );
+ pathw.appendNew<Geom::LineSegment>( endw );
+ width_path.param_set_and_write_new_value( pathw.toPwSb() );
+
+ wfactor = 1/(startw[Y]-start[Y]);
}
} // namespace LivePathEffect
diff --git a/src/live_effects/lpe-pathalongpath.h b/src/live_effects/lpe-pathalongpath.h
index d404e0f67..b75d5e227 100644
--- a/src/live_effects/lpe-pathalongpath.h
+++ b/src/live_effects/lpe-pathalongpath.h
@@ -36,13 +36,12 @@ public:
private:
PathParam bend_path;
+ PathParam width_path;
EnumParam<PAPCopyType> copytype;
ScalarParam prop_scale;
BoolParam scale_y_rel;
- ScalarParam spacing;
- ScalarParam normal_offset;
- ScalarParam tang_offset;
BoolParam vertical_pattern;
+ double wfactor;
void on_pattern_pasted();