SVGRoundTrip, Part 3b: Convert SVG to Java 2D

Having re-read the previous post I realised that the stuff on supporting unsupported SVG elements could have been clearer. Somehow I doubt I could write it any better so I thought I'd show an example instead.

The SVG file used in these three examples contains both embedded raster images and text nodes which, by default, are unsupported. If we specify that we wish to skip unsupported SVG elements (-u skip) then what we get is a Java class that will draw the left hand image. If we specify that we want to add image support (-i) then we get the middle image. And finally, if we say that unsupported SVG elements should be treated as images (-u image) then we get the right hand image.

Whilst it may look like the right hand image is best what you have to remember is that only the elements in the left most image will scale without a loss of quality.


Post a Comment