diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2012-04-07 19:57:31 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2012-04-07 19:57:31 +0000 |
| commit | bdda1cad52c9fe447028bdcea90166cdc2ac8799 (patch) | |
| tree | aade591aa54f9fa55c0d4e4490f6ad369e5fa002 /src | |
| parent | fix possible crasher in knot_clicked_handler (diff) | |
| download | inkscape-bdda1cad52c9fe447028bdcea90166cdc2ac8799.tar.gz inkscape-bdda1cad52c9fe447028bdcea90166cdc2ac8799.zip | |
powerstroke: use path's strokewidth on applying powerstroke effect
(bzr r11175)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-powerstroke.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index d3843dc92..8edee1744 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -14,6 +14,7 @@ #include "live_effects/lpe-powerstroke-interpolators.h" #include "sp-shape.h" +#include "style.h" #include "display/curve.h" #include <2geom/path.h> @@ -182,11 +183,21 @@ LPEPowerStroke::doOnApply(SPLPEItem *lpeitem) { if (SP_IS_SHAPE(lpeitem)) { std::vector<Geom::Point> points; - Geom::PathVector pathv = SP_SHAPE(lpeitem)->_curve->get_pathvector(); - Geom::Path::size_type size = pathv.empty() ? 1 : pathv.front().size_open(); - points.push_back( Geom::Point(0,0) ); - points.push_back( Geom::Point(0.5*size,0) ); - points.push_back( Geom::Point(size,0) ); + Geom::PathVector const &pathv = SP_SHAPE(lpeitem)->_curve->get_pathvector(); + double width = (lpeitem && lpeitem->style) ? lpeitem->style->stroke_width.computed : 1.; + if (pathv.empty()) { + points.push_back( Geom::Point(0.,width) ); + points.push_back( Geom::Point(0.5,width) ); + points.push_back( Geom::Point(1.,width) ); + } else { + Geom::Path const &path = pathv.front(); + Geom::Path::size_type const size = path.size_default(); + points.push_back( Geom::Point(0.,width) ); + points.push_back( Geom::Point(0.5*size,width) ); + if (!path.closed()) { + points.push_back( Geom::Point(size,width) ); + } + } offset_points.param_set_and_write_new_value(points); } else { g_warning("LPE Powerstroke can only be applied to shapes (not groups)."); |
