summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/kitfox/svg/ShapeElement.java42
1 files changed, 33 insertions, 9 deletions
diff --git a/src/main/java/com/kitfox/svg/ShapeElement.java b/src/main/java/com/kitfox/svg/ShapeElement.java
index 092fc59..7fdc671 100644
--- a/src/main/java/com/kitfox/svg/ShapeElement.java
+++ b/src/main/java/com/kitfox/svg/ShapeElement.java
@@ -328,26 +328,50 @@ abstract public class ShapeElement extends RenderableElement
stroke = new BasicStroke(strokeWidth, strokeLinecap, strokeLinejoin, strokeMiterLimit, strokeDashArray, strokeDashOffset);
}
- Shape strokeShape = stroke.createStrokedShape(shape);
+ Shape strokeShape;
+ AffineTransform cacheXform = g.getTransform();
+ if (vectorEffect == VECTOR_EFFECT_NON_SCALING_STROKE)
+ {
+ strokeShape = cacheXform.createTransformedShape(shape);
+ strokeShape = stroke.createStrokedShape(strokeShape);
+ }
+ else
+ {
+ strokeShape = stroke.createStrokedShape(shape);
+ }
if (strokeOpacity <= 0)
{
//Do nothing
}
- else if (strokeOpacity < 1f)
+ else
{
Composite cachedComposite = g.getComposite();
- g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, strokeOpacity));
- g.setPaint(strokePaint);
- g.fill(strokeShape);
+ if (strokeOpacity < 1f)
+ {
+ g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, strokeOpacity));
+ }
+
+ if (vectorEffect == VECTOR_EFFECT_NON_SCALING_STROKE)
+ {
+ //Set to identity
+ g.setTransform(new AffineTransform());
+ }
- g.setComposite(cachedComposite);
- }
- else
- {
g.setPaint(strokePaint);
g.fill(strokeShape);
+
+ if (vectorEffect == VECTOR_EFFECT_NON_SCALING_STROKE)
+ {
+ //Set to identity
+ g.setTransform(cacheXform);
+ }
+
+ if (strokeOpacity < 1f)
+ {
+ g.setComposite(cachedComposite);
+ }
}
}