xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rémy Brousset " <r.brous...@sig-image.fr>
Subject dynamic change of display rendering
Date Thu, 03 Feb 2005 16:27:14 GMT

hi folks,

i have some simple svg that i use with their gvt root node to display it in
existing java canvas.

....
GVTBuilder builder = new GVTBuilder();
Element svgRootElem = svgDoc.getDocumentElement();
 GraphicsNode rootNode = builder.build(ctx,svgRootElem );
... 
rootNode.paint( myDisplayContext );

this works pretty good.
What i want to do now is changing the display dynamically among 3 or 4
possible definitions stored in the svg.
I tried tu put a defs section in the svg,

<svg width="10%" xmlns:xlink="http://www.w3.org/1999/xlink" height="10%"
viewBox="0 0 600 600" preserveAspectRatio="xMidYMid meet"     xmlns=
http://www.w3.org/2000/svg">
    
<!-- default display -->
    <ellipse rx="299" ry="299" style="stroke: rgb(255, 255, 255); fill:
rgb(255, 153, 0);" cx="300"
         cy="300"/>
    <path style="stroke: rgb(255, 255, 255); fill:rgb(255, 255, 255)" d=
m300,300 l 212.1,-212.1 
        a300 300 0 0 1 0 424.2 z"/>
    <path style="stroke: rgb(255, 255, 255); fill:rgb(255, 255, 255)" d=
m300,300 l -212.1,-212.1 
        a300 300 0 0 0 0 424.2 z"/>
        

       <defs>
             <g id="display2" >
        
                 <ellipse rx="299" ry="299" style="stroke: rgb(255, 255,
255); fill: rgb(100, 150, 100);" cx="300"
                  cy="300"/>
                 <path style="stroke: rgb(255, 255, 255); fill:rgb(255, 255,
255)" d="m300,300 l 212.1,-212.1 
                 a300 300 0 0 1 0 424.2 z"/>
                 <path style="stroke: rgb(255, 255, 255); fill:rgb(255, 255,
255)" d="m300,300 l -212.1,-212.1 
                 a300 300 0 0 0 0 424.2 z"/>
 
             </g>   
       </defs>
</svg>



and i tried to access it that way with no results :

     Element elem = svgDoc.getElementById("display2");
     GraphicsNode auxDisplayNode = ctx.getGraphicsNode(elem);  <--
auxDisplayNode == null

Has someone ever done it? should i put it in a symbol section instead of
defs?
have i to reconstruct a whole gvt tree (to have a root graphics node)?if i
have, how can i do that?
 
every ideas welcome (even stupids, trust me i got a lot...;)

thanks,regards
Remy.
Mime
View raw message