xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tonny Kohar <to...@kiyut.com>
Subject Re: dynamic change of display rendering
Date Thu, 03 Feb 2005 17:30:56 GMT
Hi,

I could be wrong here. I think that non displayed element eg: element
inside defs does not have correspoding GraphicsNode, since those
elements are not rendered. It will have corresponding GraphicsNode when
there is a displayable element referencing those element eg: by <use>
element

Regards
Tonny Kohar

On Thu, 2005-02-03 at 23:27, Rémy Brousset wrote:
>  
> 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.
>  
>  
> 
> 
> 
> Add FUN to your email - CLICK HERE!


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message