I'm just getting started with scripting in SVG. My files render perfectly in squiggle, but the batik-rasterizer ignores the scripted elements and renders just the blank canvas. When I rasterize files without scripting, everything works fine.

I'm sure I must just be missing something basic.

Here is an example of how I'm scripting elements. Thanks for any advice you can give.

--David

<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
             "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
<svg width="100px" height="100px"
    xmlns="http://www.w3.org/2000/svg"; version="1.1"
onload="makeBallSimple(evt)">
 <title>Example scripted element</title>
 <desc>An example of scripting an element with ecmascript in SVG.</desc>

   <script type="text/ecmascript"> <![CDATA[
        var svgns = "http://www.w3.org/2000/svg";;

        var ballRad = 20;
        var ballFill = "#999999";
        var ballOutline = "#333333";

        function makeBallSimple(evt) {
        if ( window.svgDocument == null )
                svgDocument = evt.target.ownerDocument;

var shape = svgDocument.createElementNS(svgns, "circle");
shape.setAttributeNS(null, "cx", 2*ballRad + 4);
shape.setAttributeNS(null, "cy", 2*ballRad + 4);
shape.setAttributeNS(null, "r", ballRad);
shape.setAttributeNS(null, "fill", ballFill);
shape.setAttributeNS(null, "stroke", ballOutline);
shape.setAttributeNS(null, "stroke-width", 2);


   svgDocument.documentElement.appendChild(shape);
   }
  ]]> </script>
</svg>

_________________________________________________________________
Keep up with high-tech trends here at "Hook'd on Technology." http://special.msn.com/msnbc/hookedontech.armx



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



Reply via email to