summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpe-powerstroke.cpp
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2019-07-17 22:57:15 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2019-07-19 21:33:23 +0000
commit44911fb71708f71feea4c853de856a14af4fbccf (patch)
tree264c3b8651b9d58915616986792cf4cd8d117dae /src/live_effects/lpe-powerstroke.cpp
parentFix translations and coding style (diff)
downloadinkscape-44911fb71708f71feea4c853de856a14af4fbccf.tar.gz
inkscape-44911fb71708f71feea4c853de856a14af4fbccf.zip
Improvements finish pointed by Maren
Diffstat (limited to 'src/live_effects/lpe-powerstroke.cpp')
-rw-r--r--src/live_effects/lpe-powerstroke.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp
index 0a13e4661..5eb5afc75 100644
--- a/src/live_effects/lpe-powerstroke.cpp
+++ b/src/live_effects/lpe-powerstroke.cpp
@@ -12,7 +12,9 @@
*/
#include "live_effects/lpe-powerstroke.h"
+#include "live_effects/lpe-simplify.h"
#include "live_effects/lpe-powerstroke-interpolators.h"
+#include "live_effects/lpeobject.h"
#include "svg/svg-color.h"
#include "desktop-style.h"
@@ -182,17 +184,25 @@ LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) :
scale_width.param_set_range(0.0, Geom::infinity());
scale_width.param_set_increments(0.1, 0.1);
scale_width.param_set_digits(4);
+ recusion_limit = 0;
+ previous_size = 0;
}
-LPEPowerStroke::~LPEPowerStroke()
-= default;
+LPEPowerStroke::~LPEPowerStroke() = default;
+
void
LPEPowerStroke::doBeforeEffect(SPLPEItem const *lpeItem)
{
offset_points.set_scale_width(scale_width);
+ size_t psize = pathvector_before_effect.size();
+ if (!is_load && previous_size != psize) {
+ adjustForNewPath(pathvector_before_effect);
+ }
+ previous_size = psize;
}
-void LPEPowerStroke::applyStyle(SPLPEItem *lpeitem)
+void
+LPEPowerStroke::applyStyle(SPLPEItem *lpeitem)
{
SPCSSAttr *css = sp_repr_css_attr_new();
if (lpeitem->style) {
@@ -755,6 +765,24 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in)
return path_out;
}
+void
+LPEPowerStroke::doAfterEffect (SPLPEItem const* lpeitem){
+ is_load = false;
+ if (pathvector_before_effect[0].size() == pathvector_after_effect[0].size()) {
+ if (recusion_limit < 6) {
+ Inkscape::LivePathEffect::Effect* effect = sp_lpe_item->getPathEffectOfType(Inkscape::LivePathEffect::SIMPLIFY);
+ if(effect){
+ LivePathEffect::LPESimplify *simplify = dynamic_cast<LivePathEffect::LPESimplify*>(effect->getLPEObj()->get_lpe());
+ double threshold = simplify->threshold * 1.2;
+ simplify->threshold.param_set_value(threshold);
+ simplify->threshold.write_to_SVG();
+ }
+ }
+ ++recusion_limit;
+ } else {
+ recusion_limit = 0;
+ }
+}
/* ######################## */