diff options
author | kitfox | 2012-02-19 21:17:51 +0100 |
---|---|---|
committer | kitfox | 2012-02-19 21:17:51 +0100 |
commit | 72cd62e664ba92bf4c3c7ca187fa115cad334834 (patch) | |
tree | 0605e94d0d4db302d63527338bffec3e9a2775f4 | |
parent | MarkerElement now respects markerUnits attribute. (diff) | |
download | svg-salamander-core-72cd62e664ba92bf4c3c7ca187fa115cad334834.tar.gz svg-salamander-core-72cd62e664ba92bf4c3c7ca187fa115cad334834.tar.xz svg-salamander-core-72cd62e664ba92bf4c3c7ca187fa115cad334834.zip |
Shape elements now handing currentColor attribute.
git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@107 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
-rw-r--r-- | src/main/java/com/kitfox/svg/ShapeElement.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/main/java/com/kitfox/svg/ShapeElement.java b/src/main/java/com/kitfox/svg/ShapeElement.java index eaa4832..092fc59 100644 --- a/src/main/java/com/kitfox/svg/ShapeElement.java +++ b/src/main/java/com/kitfox/svg/ShapeElement.java @@ -95,6 +95,26 @@ abstract public class ShapeElement extends RenderableElement }
}
+ private Paint handleCurrentColor(StyleAttribute styleAttrib) throws SVGException
+ {
+ if (styleAttrib.getStringValue().equals("currentColor"))
+ {
+ StyleAttribute currentColorAttrib = new StyleAttribute();
+ if (getStyle(currentColorAttrib.setName("color")))
+ {
+ if (!currentColorAttrib.getStringValue().equals("none"))
+ {
+ return currentColorAttrib.getColorValue();
+ }
+ }
+ return null;
+ }
+ else
+ {
+ return styleAttrib.getColorValue();
+ }
+ }
+
protected void renderShape(Graphics2D g, Shape shape) throws SVGException
{
//g.setColor(Color.green);
@@ -119,7 +139,7 @@ abstract public class ShapeElement extends RenderableElement if (styleAttrib.getStringValue().equals("none")) fillPaint = null;
else
{
- fillPaint = styleAttrib.getColorValue();
+ fillPaint = handleCurrentColor(styleAttrib);
if (fillPaint == null)
{
URI uri = styleAttrib.getURIValue(getXMLBase());
@@ -158,7 +178,7 @@ abstract public class ShapeElement extends RenderableElement if (styleAttrib.getStringValue().equals("none")) strokePaint = null;
else
{
- strokePaint = styleAttrib.getColorValue();
+ strokePaint = handleCurrentColor(styleAttrib);
if (strokePaint == null)
{
URI uri = styleAttrib.getURIValue(getXMLBase());
|