summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpe-taperstroke.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/live_effects/lpe-taperstroke.cpp')
-rw-r--r--src/live_effects/lpe-taperstroke.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp
index 2c74af6d6..ef616f802 100644
--- a/src/live_effects/lpe-taperstroke.cpp
+++ b/src/live_effects/lpe-taperstroke.cpp
@@ -14,7 +14,6 @@
#include "live_effects/lpe-taperstroke.h"
#include <2geom/path.h>
-#include <2geom/shape.h>
#include <2geom/path.h>
#include <2geom/circle.h>
#include <2geom/sbasis-to-bezier.h>
@@ -126,6 +125,7 @@ void LPETaperStroke::doOnApply(SPLPEItem const* lpeitem)
sp_repr_css_attr_unref (css);
line_width.param_set_value(width);
+ line_width.write_to_SVG();
} else {
printf("WARNING: It only makes sense to apply Taper stroke to paths (not groups).\n");
}
@@ -193,7 +193,7 @@ Piecewise<D2<SBasis> > stretch_along(Piecewise<D2<SBasis> > pwd2_in, Geom::Path
Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in)
{
Geom::Path first_cusp = return_at_first_cusp(path_in[0]);
- Geom::Path last_cusp = return_at_first_cusp(path_in[0].reverse());
+ Geom::Path last_cusp = return_at_first_cusp(path_in[0].reversed());
bool zeroStart = false; // [distance from start taper knot -> start of path] == 0
bool zeroEnd = false; // [distance from end taper knot -> end of path] == 0
@@ -275,7 +275,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in)
pat_str << "M 1,0 C " << 1 - (double)smoothing << ",0 0,0.5 0,0.5 0,0.5 " << 1 - (double)smoothing << ",1 1,1";
pat_vec = sp_svg_read_pathv(pat_str.str().c_str());
- pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], -fabs(line_width)));
+ pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], fabs(line_width)));
throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0];
real_path.append(throwaway_path);
@@ -304,7 +304,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in)
pat_vec = sp_svg_read_pathv(pat_str_1.str().c_str());
pwd2 = Piecewise<D2<SBasis> >();
- pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], -fabs(line_width)));
+ pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], fabs(line_width)));
throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0];
if (!Geom::are_near(real_path.finalPoint(), throwaway_path.initialPoint()) && real_path.size() >= 1) {
@@ -317,7 +317,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in)
if (!metInMiddle) {
// append the inside outline of the path (against direction)
- throwaway_path = half_outline(pathv_out[1].reverse(), fabs(line_width)/2., miter_limit, static_cast<LineJoinType>(join_type.get_value()));
+ throwaway_path = half_outline(pathv_out[1].reversed(), fabs(line_width)/2., miter_limit, static_cast<LineJoinType>(join_type.get_value()));
if (!Geom::are_near(real_path.finalPoint(), throwaway_path.initialPoint()) && real_path.size() >= 1) {
real_path.appendNew<Geom::LineSegment>(throwaway_path.initialPoint());
@@ -389,13 +389,9 @@ Piecewise<D2<SBasis> > stretch_along(Piecewise<D2<SBasis> > pwd2_in, Geom::Path
x0 -= pattBndsX->min();
y0 -= pattBndsY->middle();
- double xspace = 0;
double noffset = 0;
double toffset = 0;
// Prevent more than 90% overlap...
- if (xspace < -pattBndsX->extent()*.9) {
- xspace = -pattBndsX->extent()*.9;
- }
y0+=noffset;
@@ -486,7 +482,7 @@ void KnotHolderEntityAttachBegin::knot_set(Geom::Point const &p, Geom::Point con
Geom::Path p_in = return_at_first_cusp(pathv[0]);
pwd2.concat(p_in.toPwSb());
- double t0 = nearest_point(s, pwd2);
+ double t0 = nearest_time(s, pwd2);
lpe->attach_start.param_set_value(t0);
// FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating.
@@ -511,10 +507,10 @@ void KnotHolderEntityAttachEnd::knot_set(Geom::Point const &p, Geom::Point const
return;
}
Geom::PathVector pathv = lpe->pathvector_before_effect;
- Geom::Path p_in = return_at_first_cusp(pathv[0].reverse());
+ Geom::Path p_in = return_at_first_cusp(pathv[0].reversed());
Piecewise<D2<SBasis> > pwd2 = p_in.toPwSb();
- double t0 = nearest_point(s, pwd2);
+ double t0 = nearest_time(s, pwd2);
lpe->attach_end.param_set_value(t0);
sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true);