Vector graphics lib?


Is there a library that supports defining vector graphics and serialize them into SVG?

I want to be able to define shapes as closed paths consisting of straight lines, arcs and beziers.

If the library can tell me whether a point is inside a shape, or whether two shapes overlap, that would be a big plus.


 Best, Oliver


I don’t know if that fits your use caset - but if you can draw what you want with the standard Java Graphics2D API, then you can easily add support for SVG exports using a library such as JFreeSVG or Apache Batik (from what I’ve seen, JFreeSVG should be lightweight and fast, but the Batik project does provide a ton of other SVG-related functionalites if you ever need them).

The Graphics2D API may not do everything you want out of the box, but you should be able to find plenty of docs and examples on the web (such as how to check if two shapes intersect or all the examples in the Oracle tutorials).

You might also want to have a look at doodle, a Scala library for vector graphics, with both a JVM backend (using the Graphics2D API) and a JS backend (using SVG), though I have no idea how usable/mature it is at the moment.