summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2007-08-31 16:17:13 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2007-08-31 16:17:13 +0000
commitcdfe483f2de4347343938d55a30ed6b399ef9283 (patch)
treecc8c67d0332a00774ed96a20d43036891d188cde /src
parentMan i really miss tortoise under linux :( (diff)
downloadinkscape-cdfe483f2de4347343938d55a30ed6b399ef9283.tar.gz
inkscape-cdfe483f2de4347343938d55a30ed6b399ef9283.zip
Add "scale y stroke" parameter to Curve Stitching LPE
(bzr r3630)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-curvestitch.cpp8
-rw-r--r--src/live_effects/lpe-curvestitch.h2
-rw-r--r--src/live_effects/parameter/bool.h2
3 files changed, 10 insertions, 2 deletions
diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp
index b0e8dc8f7..f595a9553 100644
--- a/src/live_effects/lpe-curvestitch.cpp
+++ b/src/live_effects/lpe-curvestitch.cpp
@@ -40,12 +40,14 @@ LPECurveStitch::LPECurveStitch(LivePathEffectObject *lpeobject) :
strokepath(_("Stroke path"), _("The path that will be stroked, whatever, think of good text here."), "strokepath", &wr, this, "M0,0 L1,0"),
nrofpaths(_("Nr of paths"), _("The number of paths that will be generated."), "count", &wr, this, 5),
startpoint_variation(_("Startpoint variation"), _("..."), "startpoint_variation", &wr, this, 0),
- endpoint_variation(_("Endpoint variation"), _("..."), "endpoint_variation", &wr, this, 0)
+ endpoint_variation(_("Endpoint variation"), _("..."), "endpoint_variation", &wr, this, 0),
+ scale_y(_("Scale stroke y"), _("Scale the height of the stroke path with its length"), "scale_stroke_y", &wr, this, false)
{
registerParameter( dynamic_cast<Parameter *>(&nrofpaths) );
registerParameter( dynamic_cast<Parameter *>(&startpoint_variation) );
registerParameter( dynamic_cast<Parameter *>(&endpoint_variation) );
registerParameter( dynamic_cast<Parameter *>(&strokepath) );
+ registerParameter( dynamic_cast<Parameter *>(&scale_y) );
nrofpaths.param_make_integer();
nrofpaths.param_set_range(2, NR_HUGE);
@@ -90,9 +92,11 @@ LPECurveStitch::doEffect (std::vector<Geom::Path> & path_in)
Matrix transform;
transform.setXAxis( (end-start) / scaling );
- transform.setYAxis( rot90(unit_vector(end-start)));
+ gdouble scaling_y = scale_y.get_value() ? L2(end-start)/scaling : 1.0;
+ transform.setYAxis( rot90(unit_vector(end-start)) * scaling_y);
transform.setTranslation( start );
Piecewise<D2<SBasis> > pwd2_out = (strokepath-stroke_origin) * transform;
+ // add stuff to one big pw<d2<sbasis> > and then outside the loop convert to path?
std::vector<Path> result = Geom::path_from_piecewise(pwd2_out, LPE_CONVERSION_TOLERANCE);
path_out[i] = result[0];
tA += incrementA;
diff --git a/src/live_effects/lpe-curvestitch.h b/src/live_effects/lpe-curvestitch.h
index 1853e378f..571996a7c 100644
--- a/src/live_effects/lpe-curvestitch.h
+++ b/src/live_effects/lpe-curvestitch.h
@@ -17,6 +17,7 @@
#include "live_effects/effect.h"
#include "live_effects/parameter/path.h"
#include "live_effects/parameter/parameter.h"
+#include "live_effects/parameter/bool.h"
namespace Inkscape {
namespace LivePathEffect {
@@ -33,6 +34,7 @@ private:
ScalarParam nrofpaths;
ScalarParam startpoint_variation;
ScalarParam endpoint_variation;
+ BoolParam scale_y;
LPECurveStitch(const LPECurveStitch&);
LPECurveStitch& operator=(const LPECurveStitch&);
diff --git a/src/live_effects/parameter/bool.h b/src/live_effects/parameter/bool.h
index cf8c9c94d..24c10fb3b 100644
--- a/src/live_effects/parameter/bool.h
+++ b/src/live_effects/parameter/bool.h
@@ -39,6 +39,8 @@ public:
void param_setValue(bool newvalue);
void param_set_default();
+ bool get_value() { return value; };
+
private:
BoolParam(const BoolParam&);
BoolParam& operator=(const BoolParam&);