Roman Dev
Roman Dev

Reputation: 103

Java - From SVG to PNG programmatically

I'm creating a game with LibGDX library (from badlogicgames) and I ran into some doubts about my sprites.

In order to support different screen sizes, we usually create like 4 maybe 6 images with different sizes. I was wondering if using a vector image like.SVG files may be useful.

Would it be smart to get programmatically an SVG file, get screen dimensions and then create an appropriate PNG file taking the screen size into account?

If the only problem is performance, is the difference too significantly? Maybe creating all the PNG images at the beginning of the app would take 3 or 4 seconds but it would be better for forward graphics.

I've heard about batik for achieving this, has anybody tried this?

Has anybody a bit of experience with this stuff and can help me?

Upvotes: 0

Views: 4039

Answers (1)

Paul LeBeau
Paul LeBeau

Reputation: 101800

Batik would be appropriate for a general Java application. However I don't believe it supports Android because it uses the standard Java2D methods which Android doesn't have.

However there are libraries for Android that allow you to render SVG files:

Disclaimer: I am the author of AndroidSVG

Upvotes: 1

Related Questions