diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2018-10-24 17:36:37 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2018-10-25 07:48:24 +0000 |
| commit | c3e8ac5a8b824c6441be881441b2f042f28a4be9 (patch) | |
| tree | de98b684811668ebc19f12a2af632807e7eb84c4 /src | |
| parent | Fixing coding style (diff) | |
| download | inkscape-c3e8ac5a8b824c6441be881441b2f042f28a4be9.tar.gz inkscape-c3e8ac5a8b824c6441be881441b2f042f28a4be9.zip | |
Add new features to knot LPE
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-knot.cpp | 36 | ||||
| -rw-r--r-- | src/live_effects/lpe-knot.h | 4 |
2 files changed, 34 insertions, 6 deletions
diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 768277959..bf1a29e5b 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -353,8 +353,12 @@ LPEKnot::LPEKnot(LivePathEffectObject *lpeobject) 3) , prop_to_stroke_width(_("_In units of stroke width"), _("Consider 'Width' as a ratio of stroke width"), "prop_to_stroke_width", &wr, this, true) - , inverse_width(_("_Inverse"), _("Use other stroke width, useful in groups with diferent stroke width"), + , both(_("_Both gaps"), _("Use gap in both intersection elements"), + "both", &wr, this, false) + , inverse_width(_("_Groups: Inverse"), _("Use other stroke width, useful in groups with diferent stroke width"), "inverse_width", &wr, this, false) + , unclimb(_("_Groups: unclimb"), _("Don`t climb the gap in the same path"), + "unclimb", &wr, this, false) , add_stroke_width("St_roke width", "Add the stroke width to the interruption size", "add_stroke_width", &wr, this, "inkscape_1.0_and_up", true) , add_other_stroke_width("_Crossing path stroke width", "Add crossed stroke width to the interruption size", @@ -372,7 +376,9 @@ LPEKnot::LPEKnot(LivePathEffectObject *lpeobject) registerParameter(&interruption_width); registerParameter(&prop_to_stroke_width); registerParameter(&add_stroke_width); + registerParameter(&both); registerParameter(&inverse_width); + registerParameter(&unclimb); registerParameter(&add_other_stroke_width); registerParameter(&crossing_points_vector); @@ -445,7 +451,9 @@ LPEKnot::doEffect_path (Geom::PathVector const &path_in) int geom_sign = ( cross(flag_i[1], flag_j[1]) < 0 ? 1 : -1); - + if (unclimb) { + geom_sign = comp%2 == 0 ? -1 : -1; + } bool i0_is_under = false; double width = interruption_width; if ( crossing_points[p].sign * geom_sign > 0 ){ @@ -453,12 +461,15 @@ LPEKnot::doEffect_path (Geom::PathVector const &path_in) } else if (crossing_points[p].sign * geom_sign < 0) { if (j == i0){ - std::swap( i, j); - std::swap(ti, tj); - std::swap(flag_i,flag_j); i0_is_under = true; } } + i0_is_under = crossing_points[p].sign != 0 && both?true:i0_is_under; + if (i0_is_under && j == i0){ + std::swap( i, j); + std::swap(ti, tj); + std::swap(flag_i,flag_j); + } if (i0_is_under){ if ( prop_to_stroke_width.get_value() ) { if (inverse_width) { @@ -483,6 +494,21 @@ LPEKnot::doEffect_path (Geom::PathVector const &path_in) }else{ dom = complementOf(hidden,dom); } + if (crossing_points[p].i == i0 && + crossing_points[p].j == i0 && + crossing_points[p].sign != 0 && + both) + { + hidden = findShadowedTime(gpaths[i0], flag_i, tj, width/2); + period = size_nondegenerate(gpaths[i0]); + if (hidden.max() > period ) hidden -= period; + if (hidden.min()<0){ + dom = complementOf( Interval(0,hidden.max()) ,dom); + dom = complementOf( Interval(hidden.min()+period, period) ,dom); + }else{ + dom = complementOf(hidden,dom); + } + } } } } diff --git a/src/live_effects/lpe-knot.h b/src/live_effects/lpe-knot.h index b9973f4f6..4f8b11e11 100644 --- a/src/live_effects/lpe-knot.h +++ b/src/live_effects/lpe-knot.h @@ -74,8 +74,10 @@ private: void updateSwitcher(); ScalarParam interruption_width; - BoolParam prop_to_stroke_width; + BoolParam prop_to_stroke_width; + BoolParam both; BoolParam inverse_width; + BoolParam unclimb; // "add_stroke_width" and "add_other_stroke_width" parameters are not used since Inkscape 1.0, // but changed from bool to hidden parameter to retain backward compatibility and dont show in the UI HiddenParam add_stroke_width; |
