You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by David Proft <da...@motive.com> on 2003/10/14 16:16:09 UTC

Multiple Passes Through a Document for Displaying Simple SVG

First of all, many thanks to Thomas and Tony for their earlier advice on looking at the slideshow app.

Well, I'm on to my next (hopefully last) problem.  I have an Illustrator document that I saved as a SVG file.  The document has about 10 layers.  What I am doing is:

 1) Create the SVGDocument from the SVG file
 2) Go through all of the "layers" (<g> elements with ids attrs) and make them invisible (set attr: "i:visible" to "no" and "display" to "none").
 3) For each "layer", set it visible, build the GraphicsNode root node, create a buffered image and store that image in a hashmap.


This works fine in theory, but I am seeing that I have to either reload the SVGDocument or clone it between each rendering iteration.  If I don't, only the first "layer" is rendered and all of the other layers' images are simply the first image.

Can anyone offer any advice on why I am having to clone the SVGDocument every time?  I am guessing it is getting cached somewhere, but I can't find it after spending a good amount of time searching.

Thanks in advance for your assistance,

David

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


Re: Multiple Passes Through a Document for Displaying Simple SVG

Posted by Thomas DeWeese <Th...@Kodak.com>.
David Proft wrote:
> First of all, many thanks to Thomas and Tony for their earlier advice on looking at the slideshow app.
> 
> Well, I'm on to my next (hopefully last) problem.  I have an Illustrator document that I saved as a SVG file.  
> The document has about 10 layers.  What I am doing is:
> 
>  1) Create the SVGDocument from the SVG file
>  2) Go through all of the "layers" (<g> elements with ids attrs) and make them invisible 
>     (set attr: "i:visible" to "no" and "display" to "none").
>  3) For each "layer", set it visible, build the GraphicsNode root node, create a buffered 
> image and store that image in a hashmap.
> 
> 
> This works fine in theory, but I am seeing that I have to either reload the SVGDocument or clone 
> it between each rendering iteration.  If I don't, only the first "layer" is rendered and all of 
> the other layers' images are simply the first image.
> 
> Can anyone offer any advice on why I am having to clone the SVGDocument every time?  I am guessing 
> it is getting cached somewhere, but I can't find it after spending a good amount of time searching.

   There are two possibilities:
1) You aren't building the document to support modification of the DOM,
    by calling BridgeContext.setDynamic(true), or something similar.
2) More likely, you aren't using a really, really, really current
    version of Batik.  I only added support for modification of the
    'display' property like a week ago.
    I don't think it matters much for the above case (since you
    'iterate' through the layers) but you can accomplish something
    similar by toggling 'visibility="visible"' and 'visibility="hidden"'.

    The difference is that display removes the subtree from the rendering tree
    where as visibility simply 'skips' the subtree when rendering.

> 
> Thanks in advance for your assistance,
> 
> David
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 




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