summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkitfox2012-04-25 18:03:27 +0200
committerkitfox2012-04-25 18:03:27 +0200
commit7d54babdb92f3c4f7ab25b565075f0c1554e946f (patch)
treece59178d4f87fc4554fcfbf7b8419edaac46147e /src
parentTranslate attribute now works when only one parameter specified. (diff)
downloadsvg-salamander-core-7d54babdb92f3c4f7ab25b565075f0c1554e946f.tar.gz
svg-salamander-core-7d54babdb92f3c4f7ab25b565075f0c1554e946f.tar.xz
svg-salamander-core-7d54babdb92f3c4f7ab25b565075f0c1554e946f.zip
Support for non-scaling stroke added.
git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@112 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
Diffstat (limited to 'src')
-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);
+ }
}
}