diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2011-11-08 21:27:40 +0000 |
|---|---|---|
| committer | Johan Engelen <goejendaagh@zonnet.nl> | 2011-11-08 21:27:40 +0000 |
| commit | 8e5adaadb93502ad0a9f476b246a934ebfee8410 (patch) | |
| tree | 676d151e41aa550102320f252616099bd2e4e3a5 /src | |
| parent | split interpolator code from main powerstroke code (diff) | |
| download | inkscape-8e5adaadb93502ad0a9f476b246a934ebfee8410.tar.gz inkscape-8e5adaadb93502ad0a9f476b246a934ebfee8410.zip | |
Powerstroke: add smoothness parameter for CubicBezierJohan
(bzr r10733)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-powerstroke-interpolators.h | 4 | ||||
| -rw-r--r-- | src/live_effects/lpe-powerstroke.cpp | 5 | ||||
| -rw-r--r-- | src/live_effects/lpe-powerstroke.h | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/live_effects/lpe-powerstroke-interpolators.h b/src/live_effects/lpe-powerstroke-interpolators.h index 88bc13ff2..7f9cb3ddb 100644 --- a/src/live_effects/lpe-powerstroke-interpolators.h +++ b/src/live_effects/lpe-powerstroke-interpolators.h @@ -124,6 +124,10 @@ public: return fit; }; + void setBeta(double beta) { + _beta = beta; + } + double _beta; private: diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 1cf8ff764..fc6026d31 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -68,6 +68,7 @@ LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) : offset_points(_("Offset points"), _("Offset points"), "offset_points", &wr, this), sort_points(_("Sort points"), _("Sort offset points according to their time value along the curve."), "sort_points", &wr, this, true), interpolator_type(_("Interpolator type"), _("Determines which kind of interpolator will be used to interpolate between stroke width along the path."), "interpolator_type", InterpolatorTypeConverter, &wr, this, Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN), + interpolator_beta(_("Smoothness"), _("Sets the smoothness for the CubicBezierJohan interpolator. 0 = linear interpolation, 1 = smooth"), "interpolator_beta", &wr, this, 0.2), start_linecap_type(_("Start line cap type"), _("Determines the shape of the path's start."), "start_linecap_type", LineCapTypeConverter, &wr, this, LINECAP_ROUND), cusp_linecap_type(_("Cusp line cap type"), _("Determines the shape of the cusps along the path."), "cusp_linecap_type", LineCuspTypeConverter, &wr, this, LINECUSP_ROUND), end_linecap_type(_("End line cap type"), _("Determines the shape of the path's end."), "end_linecap_type", LineCapTypeConverter, &wr, this, LINECAP_ROUND) @@ -79,6 +80,7 @@ LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) : registerParameter( dynamic_cast<Parameter *>(&offset_points) ); registerParameter( dynamic_cast<Parameter *>(&sort_points) ); registerParameter( dynamic_cast<Parameter *>(&interpolator_type) ); + registerParameter( dynamic_cast<Parameter *>(&interpolator_beta) ); registerParameter( dynamic_cast<Parameter *>(&start_linecap_type) ); registerParameter( dynamic_cast<Parameter *>(&cusp_linecap_type) ); registerParameter( dynamic_cast<Parameter *>(&end_linecap_type) ); @@ -220,6 +222,9 @@ LPEPowerStroke::doEffect_path (std::vector<Geom::Path> const & path_in) } // create stroke path where points (x,y) := (t, offset) Geom::Interpolate::Interpolator *interpolator = Geom::Interpolate::Interpolator::create(static_cast<Geom::Interpolate::InterpolatorType>(interpolator_type.get_value())); + if (Geom::Interpolate::CubicBezierJohan *johan = dynamic_cast<Geom::Interpolate::CubicBezierJohan*>(interpolator)) { + johan->setBeta(interpolator_beta); + } Geom::Path strokepath = interpolator->interpolateToPath(ts); delete interpolator; diff --git a/src/live_effects/lpe-powerstroke.h b/src/live_effects/lpe-powerstroke.h index 6c005f792..4c9c6d327 100644 --- a/src/live_effects/lpe-powerstroke.h +++ b/src/live_effects/lpe-powerstroke.h @@ -36,6 +36,7 @@ private: PowerStrokePointArrayParam offset_points; BoolParam sort_points; EnumParam<unsigned> interpolator_type; + ScalarParam interpolator_beta; EnumParam<unsigned> start_linecap_type; EnumParam<unsigned> cusp_linecap_type; EnumParam<unsigned> end_linecap_type; |
