From 28d8fa1e12582d875e115bd439d35c5b6ab56259 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Fri, 31 Aug 2007 16:17:13 +0000 Subject: [PATCH] Add "scale y stroke" parameter to Curve Stitching LPE --- src/live_effects/lpe-curvestitch.cpp | 8 ++++++-- src/live_effects/lpe-curvestitch.h | 2 ++ src/live_effects/parameter/bool.h | 2 ++ 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(&nrofpaths) ); registerParameter( dynamic_cast(&startpoint_variation) ); registerParameter( dynamic_cast(&endpoint_variation) ); registerParameter( dynamic_cast(&strokepath) ); + registerParameter( dynamic_cast(&scale_y) ); nrofpaths.param_make_integer(); nrofpaths.param_set_range(2, NR_HUGE); @@ -90,9 +92,11 @@ LPECurveStitch::doEffect (std::vector & 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 > pwd2_out = (strokepath-stroke_origin) * transform; + // add stuff to one big pw > and then outside the loop convert to path? std::vector 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&); -- 2.30.2