Code

LPE: add Paste LPE verb + menu item. add scale ratios to curve stitch and path-along...
[inkscape.git] / src / live_effects / lpe-skeletalstrokes.cpp
index 162dfe8a460f2b61b42aa7b9424b2151f0f938b7..459b01861971b406a67b607aaebf5a80c6bb6737 100644 (file)
@@ -58,11 +58,15 @@ static const Util::EnumDataConverter<SkelCopyType> SkelCopyTypeConverter(SkelCop
 \r
 LPESkeletalStrokes::LPESkeletalStrokes(LivePathEffectObject *lpeobject) :\r
     Effect(lpeobject),\r
-    pattern(_("Pattern"), _("Path to put along path"), "pattern", &wr, this, "M0,0 L1,1"),\r
-    copytype(_("Copytype"), _("How to shape the pattern path along the path"), "copytype", SkelCopyTypeConverter, &wr, this, SSCT_SINGLE_STRETCHED)\r
+    pattern(_("Pattern"), _("Path to put along path"), "pattern", &wr, this, "M0,0 L1,0"),\r
+    copytype(_("Copytype"), _("How to shape the pattern path along the path"), "copytype", SkelCopyTypeConverter, &wr, this, SSCT_SINGLE_STRETCHED),\r
+    prop_scale(_("Scale ratio"), _("Ratio between scaling in the x and y direction of the original path"), "prop_scale", &wr, this, 1),\r
+    scale_y(_("Scale pattern y"), _("Scale the height of the pattern path with its length"), "scale_stroke_y", &wr, this, false)\r
 {\r
     registerParameter( dynamic_cast<Parameter *>(&pattern) );\r
     registerParameter( dynamic_cast<Parameter *>(&copytype) );\r
+    registerParameter( dynamic_cast<Parameter *>(&prop_scale) );\r
+    registerParameter( dynamic_cast<Parameter *>(&scale_y) );\r
 }\r
 \r
 LPESkeletalStrokes::~LPESkeletalStrokes()\r
@@ -76,8 +80,7 @@ LPESkeletalStrokes::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in
 {\r
     using namespace Geom;\r
 \r
-/* LOTS OF CODE COPIED FROM 2geom/src/toys/path-along-path.cpp\r
- * All credits should go to jfb and mgsloan of lib2geom development! */\r
+/* Much credit should go to jfb and mgsloan of lib2geom development for the code below! */\r
 \r
     SkelCopyType type = copytype.get_value();\r
 \r
@@ -94,7 +97,6 @@ LPESkeletalStrokes::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in
     Interval pattBndsY = bounds_exact(y);\r
     y -= (pattBndsY.max()+pattBndsY.min())/2;\r
 \r
-\r
     int nbCopies = int(uskeleton.cuts.back()/pattBnds.extent());\r
     double scaling = 1;\r
 \r
@@ -121,8 +123,12 @@ LPESkeletalStrokes::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in
 \r
     double pattWidth = pattBnds.extent() * scaling;\r
 \r
-    if (scaling != 1)\r
+    if (scaling != 1.0) {\r
         x*=scaling;\r
+    }\r
+    if ( scale_y.get_value() && (scaling*prop_scale != 1.0) ) {\r
+        y*=(scaling*prop_scale);\r
+    }\r
 \r
     double offs = 0;\r
     Piecewise<D2<SBasis> > output;\r