summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2018-11-08 14:56:09 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-11-08 14:56:09 +0000
commit517288aebef7426ab1a70065746d0a81d545568d (patch)
tree2a35356ce5c50d302e69de010a7047af78503013 /src/display
parentfix bug 1793940 ODG image export (diff)
downloadinkscape-517288aebef7426ab1a70065746d0a81d545568d.tar.gz
inkscape-517288aebef7426ab1a70065746d0a81d545568d.zip
Implement the remaining vector effects properties.
Diffstat (limited to 'src/display')
-rw-r--r--src/display/drawing-item.cpp27
-rw-r--r--src/display/drawing-shape.cpp4
-rw-r--r--src/display/drawing-text.cpp2
3 files changed, 30 insertions, 3 deletions
diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp
index f83d0eaeb..86bd0c7f9 100644
--- a/src/display/drawing-item.cpp
+++ b/src/display/drawing-item.cpp
@@ -555,6 +555,33 @@ DrawingItem::update(Geom::IntRect const &area, UpdateContext const &ctx, unsigne
if (_transform) {
child_ctx.ctm = *_transform * ctx.ctm;
}
+
+ // Vector effects
+ if (_style) {
+
+ if (_style->vector_effect.fixed) {
+ child_ctx.ctm.setTranslation(Geom::Point(0,0));
+ }
+
+ if (_style->vector_effect.size) {
+ double value = sqrt(child_ctx.ctm.det());
+ if (value > 0 ) {
+ child_ctx.ctm[0] = child_ctx.ctm[0]/value;
+ child_ctx.ctm[1] = child_ctx.ctm[1]/value;
+ child_ctx.ctm[2] = child_ctx.ctm[2]/value;
+ child_ctx.ctm[3] = child_ctx.ctm[3]/value;
+ }
+ }
+
+ if (_style->vector_effect.rotate) {
+ double value = sqrt(child_ctx.ctm.det());
+ child_ctx.ctm[0] = value;
+ child_ctx.ctm[1] = 0;
+ child_ctx.ctm[2] = 0;
+ child_ctx.ctm[3] = value;
+ }
+ }
+
/* Remember the transformation matrix */
Geom::Affine ctm_change = _ctm.inverse() * child_ctx.ctm;
_ctm = child_ctx.ctm;
diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp
index 05123297e..612593ad8 100644
--- a/src/display/drawing-shape.cpp
+++ b/src/display/drawing-shape.cpp
@@ -180,7 +180,7 @@ DrawingShape::_renderStroke(DrawingContext &dc)
if( has_stroke ) {
// TODO: remove segments outside of bbox when no dashes present
dc.path(_curve->get_pathvector());
- if (_style && _style->vector_effect.computed == SP_VECTOR_EFFECT_NON_SCALING_STROKE) {
+ if (_style && _style->vector_effect.stroke) {
dc.restore();
dc.save();
}
@@ -260,7 +260,7 @@ DrawingShape::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigne
_nrstyle.applyFill(dc);
dc.fillPreserve();
}
- if (_style && _style->vector_effect.computed == SP_VECTOR_EFFECT_NON_SCALING_STROKE) {
+ if (_style && _style->vector_effect.stroke) {
dc.restore();
dc.save();
}
diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp
index d823012e3..5a8a06ede 100644
--- a/src/display/drawing-text.cpp
+++ b/src/display/drawing-text.cpp
@@ -598,7 +598,7 @@ unsigned DrawingText::_renderItem(DrawingContext &dc, Geom::IntRect const &/*are
}
{
Inkscape::DrawingContext::Save save(dc);
- if (!_style || !(_style->vector_effect.computed == SP_VECTOR_EFFECT_NON_SCALING_STROKE)) {
+ if (!_style || !(_style->vector_effect.stroke)) {
dc.transform(_ctm);
}
if (has_stroke) {