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 Thomas DeWeese <Th...@Kodak.com> on 2005/03/01 11:41:07 UTC

Re: building GVT from elements

Hi Jonathan,

Jonathan Gray wrote:

> Does batik internally use the builder to build GraphicsNodes or does it 
> always use Documents?  

    They are always built in the context of a document, otherwise
CSS won't work properly.

> I have been using this to build child GraphicsNodes of an SVG document 
> so that I can rasterize fragments of it.  However, so far its been 
> pretty unsuccessful because all of the 'g' elements have been the wrong 
> size and all the shape nodes (mostly 'polygon') have appeared as black 
> images (although they do seem to be the right size).

    I don't think I understand what you mean by "the 'g' elements have
been the wrong size".  The 'g' elements are aways the union of their
descendants bounds.

> Can anyone think of a good way to rasterize parts of an SVG document, or 
> a path to develop this functionality with batik?

    I would do one of two things, one would be to build the complete GVT
tree and then call paint directly on the GraphicsNode that I was
interested in having painted or I might set all the other 'branches'
of the SVG document to be visibility="hidden" or display="none".

    At the very least you might consider building a 'sub' document that
includes all the nodes from the root of the SVG document to the
element of interest.  Without this the 'context' for the subtree
many things could be lost (I would suspect that this is why the polygons
are black, although that might also be because the coloring is done
with a CSS style sheet?) it all depends heavily on the structure of
the document in question.

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