Skip to main content
gamedev.net
svg in java

svg in java

pinacolada
Satisfaction Guaranteed* Ā· Ā· 1 min read
1,710 2

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

So I thought it would be cool to use SVG in my java games. The standard library to do this is Batik. The library is pretty sweet, but damn is it huge- 4mb of class files. 1mb of this is from the included XML reader Xerces. Damned if I know how an XML reader can take up 1mb.

It works well, but you can tell Batik is meant for the high-end user. Doing something that seems like it would be simple (like, hey, how about you just draw this SVG file where I tell you to?) is actually a lot of work. And it's made more difficult by the huge API to swim through.

This graph pretty much sums it up. According to Batik, I am a "serious hacker"

Anyway, I think I have it under control- I already have a class that loads a document and renders it to an offscreen image, suitable for drawing.

Also, I looked into SVGSalamander, which sounded promising because it's suppossed to be optimized for games. But I couldn't even get it to work, even when I tried using their example code. Soooooo, yeah.

Discussion

Loading comments...