xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: SVGGraphics2D how to group elements
Date Mon, 05 Apr 2010 10:37:45 GMT
Hi Olivier,

kpu <olivier.capuozzo@gmail.com> wrote on 04/03/2010 04:32:26 PM:

>  I wish grouped elements "by component".

> I try  create a <g> element and call
> method  getDOMTreeManager().appendGroup(element_g, getDomGroupManager())

   You need to call 'getRoot(element_g)' this will append everything
drawn since the graphics was constructed, or the last time getRoot was
called as children of 'element_g'.

>       m1.draw(svgGenerator);

        svgGenerator.getRoot(g1);

>       m2.draw(svgGenerator);

        svgGenerator.getRoot(g2);

>       // Finally, stream out SVG to the standard output using
>       // UTF-8 encoding.

    You will need to manage the streaming of the SVG yourself.
There are many options for this but two from Batik are
batik.svggen.XmlWriter or I think a little better is
bati.dom.DOMUtilities.


Mime
View raw message