Hi Thomas,
thomas.deweese wrote: > > 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); > I try : Element elt1_g = svgGenerator.getDOMFactory().createElementNS(SVGGraphics2D.SVG_NAMESPACE_URI, SVGGraphics2D.SVG_G_TAG); Element elt2_g = svgGenerator.getDOMFactory().createElementNS(SVGGraphics2D.SVG_NAMESPACE_URI, SVGGraphics2D.SVG_G_TAG); m1.draw(svgGenerator); svgGenerator.getRoot(elt1_g); m2.draw(svgGenerator); svgGenerator.getRoot(elt2_g); Result is : <svg><defs id="genericDefs"/><g/></svg> I try : svgGenerator.getRoot(elt1_g); m1.draw(svgGenerator); svgGenerator.getRoot(elt2_g); m2.draw(svgGenerator); Result is : <svg><defs id="genericDefs"/><g> svg instructions of m2 </g></svg> Normal, because the svg root change after m1 drawing, so svg instructions m1 are lost. Helder Magalhães wrote: > > I'm not sure what you mean with "by component"... I didn't found a > relevant enough difference in the code snippets which would help > understanding the difference. Please clear it up a bit in order to get > interesting feedback, [...] > I want to get the following general schema : <svg> <g> <g> svg instructions of m1 </g> <g> svg instructions of m2 </g> ... <g> svg instructions of m n </g> <g> </svg> And NOT as the default ouput : <svg> <g> svg instructions of m1 svg instructions of m2 ... svg instructions of m n <g> </svg> thomas.deweese wrote: > > >> // 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. > After treatment ? But, how to distinguish the blocks of instructions between them (m1 and m2 ) ? Thanks for your help -- View this message in context: http://old.nabble.com/SVGGraphics2D-how-to-group-elements-tp28129357p28139659.html Sent from the Batik - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org