Hi Richard.

Richard Harris:
>   When I use "use" to define the path for clipPath, the clip-rule attribute
> seems to be lost.  This does not happen in adobe's svg viewer.  
> 
>   It works OK if it is changed to either define the path (along with it's
> clip-rule) directly as a child of the clipPath, or if the clip-rule is added as
> an attribute of the clipPath.

This does seem to be a bug with Batik.  Attached is a patch that fixes
the problem.  If Thomas deems it worthy, he may check it in to CVS when
he gets back. :-)

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922
--- xml-batik/sources/org/apache/batik/bridge/SVGClipPathElementBridge.java     
2004-02-09 11:15:22.000000000 +1100
+++ xml-batik.csvg/sources/org/apache/batik/bridge/SVGClipPathElementBridge.java       
 2004-02-09 11:27:55.000000000 +1100
@@ -55,6 +55,8 @@
 import java.awt.geom.Area;
 import java.awt.geom.GeneralPath;
 
+import org.apache.batik.css.engine.CSSImportNode;
+import org.apache.batik.dom.svg.SVGOMCSSImportedElementRoot;
 import org.apache.batik.ext.awt.image.renderable.ClipRable;
 import org.apache.batik.ext.awt.image.renderable.ClipRable8Bit;
 import org.apache.batik.ext.awt.image.renderable.Filter;
@@ -152,6 +154,21 @@
             }
             hasChildren = true;
 
+            // if this is a 'use' element, get the actual shape used
+            if (child instanceof CSSImportNode) {
+                SVGOMCSSImportedElementRoot shadow =
+                    (SVGOMCSSImportedElementRoot)
+                    ((CSSImportNode) child).getCSSImportedElementRoot();
+                
+                if (shadow != null) {
+                    Node shadowChild = shadow.getFirstChild();
+                    if (shadowChild != null
+                            && shadowChild.getNodeType() == Node.ELEMENT_NODE) {
+                        child = (Element) shadowChild;
+                    }
+                }
+            }
+
             // compute the outline of the current clipPath's child
             int wr = CSSUtilities.convertClipRule(child);
             GeneralPath path;

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to