Fantastic response, thank you! And thanks to the others who responded to me as well.

Anthony

On 7/26/2012 6:27 PM, DeWeese Thomas wrote:
Hi Anthony,
        Sorry my day job is currently very busy.

On Jul 20, 2012, at 1:23 PM, Anthony Rowlands wrote:

I am evaluating Batik for my work. My main requirement is to generate SVG 
documents in Java, which will mostly be used by JavaScript for display or 
simply streamed somewhere else. So I am interested in generating SVG documents 
as strings and have no interest in Swing or working with Java Graphics. I also 
need the rasterizer packages for creating images out of the SVG, which I have 
experimented with and am impressed with so far.

So what would be the recommended way of doing this? The main feature of Batik 
seems to be a mapping between Java's Graphics API and an SVG document, so that 
you can code using Java's built-in API's and have an SVG document come out of 
it.
        Actually I would say the SVG rendering engine (largely shared by the 
rasterizer and swing components) is a much more important part of Batik 
compared with the SVGGraphics2D (certainly by lines of code).

Question 1: If I don't need any of the features of AWT/Swing/Graphics etc., 
would it make more sense to build the SVG myself using only Java's XML API's 
and only use the rasterizer from Batik? This seems to be the best route right 
now to avoid the overhead of programming to the SVGGraphics2D API.
        There is no problem with doing this.  This generally results in cleaner 
SVG but often is more lines of code.
And especially for complex items (bezier paths and the like) can be a little 
cumbersome.

Question 2: If I do this, and I have a huge SVG document as a String, is there 
an entry point back into SVGGraphics2D so that, if I eventually want to use the 
SVGGraphics2D features, I can start from an existing SVG document? I'm assuming 
there is such an entry point, but what happens if I then stream the document 
back out of SVGGraphics2D? I assume Batik will re-jigger the document in some 
way - can you comment on what will happen?
        The SVGGraphics2D only ever splits SVG out.  You can't take an SVG document and "put 
it into" an SVGGraphics2D.  That said you can use the SVGGraphics2D to draw 
"snippets" that you can then insert into an
existing SVG Document (built from your string) using all the normal XML 
commands.  This is most useful if you have some body of drawing code already 
and you want to leverage that for parts of the SVG document.

        Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org

Reply via email to