xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leo Lim <leo.lim....@fedex.com>
Subject setting attributes dynamically
Date Thu, 08 Mar 2007 22:59:57 GMT
Hello,

 

Is it possible to set attributes (fill, stroke) dynamically?

The g elements in my svg file have already defined the stroke element as you
can see below,

 

<g id="Rudder_Trim_Knob">

<path i:knockout="Off" fill="#B2B2B2" stroke="#000000" stroke-width="0.9684"
d="M202.786,159.913

 
c59.836,0,108.342,48.437,108.342,108.184c0,59.75-48.506,108.189-108.342,108.
189c-59.834,0-108.342-48.439-108.342-108.189

            C94.444,208.35,142.952,159.913,202.786,159.913z"/>

            <path i:knockout="Off" fill="#F2F2F2" stroke="#000000"
stroke-width="0.9684" d="M175.799,166.63

.

</g>

 

With this setup, is it possible to call
target.setAttribute(SVGConstants.SVG_STROKE_ATTRIBUTE, "green");

I tried this one and nothing happened. However, when I removed the stroke
definitions above, I was able

to set it successfully using setAttribute.

 

But I want the stroke definitions to remain in my svg file as the image
would look ugly without them. That said,

is there a way to override the initial definitions of the stroke attribute?

 

 

Thanks!

 

Leo Lim


Mime
View raw message