over the past couple of months the SVG-->Texture(Region) idea was floating through the forums. (Not only) My opinion was that it would be to slow to be well usable, especially thinking of startup times.
Inspired by the library behind Androidify ( http://code.google.com/p/svg-android/ ), I worked a little on this now ...
I had to rewrite their path-parser so it can handle both formats that are used by Inkscape and Adobe Illustrator. Together with some many bugfixes and lots of refactoring and enhancements here are some examples:
From left to right:
- Created from scratch using Inkscape
- Created from scratch using Inkscape (including gradients)
- Created using Adobe Illustrator (does excellent and clean export btw!)
- Created by opening previous image and saving it using Inkscape (
need to fix gradients as Inkscape saves weird things when importing a svg created with Adobe Illustrator
)
This is how you would use it:
Using java Syntax Highlighting
- int size = (isHighResDevice()) ? 128 : 64;
- ITextureRegion textureRegion = SVGTextureRegionFactory.createFromAsset(this.mBuildableTexture, this, "gfx/vector.svg", size, size);
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
Also you'll be able to render svg files to PNGs so that you have to render them only once, i.e. when the game is first started, and after that only have to load them i.e. from the SDCard.
Example: The FarmTower SVG Chicken rendered in different sizes! (8x8, 16x16, 32x32, 64x64, 128x128, 256x256)
The compressed SVG is about 1.5kB where the size of the images (png) is about 20kB.
Conclusion: You'll be able to render your sprites directly from svg to textures in the perfect device-specific size, which you determine during runtime, instead of putting a pre-rendered png into each and every resource-folder (ldpi/mdpi/hpdi/xhdpi/xlarge/... ). That's it for today.
Will fix the remaining issues tomorrow
[Edit]Now working on allowing to specify the width/height to render the svgs at.[/Edit] Done.
[Edit]Now working on gradient strokes.[/Edit] Done.
[Edit]Adding support for "Optimized Inkscape-SVG" (has all redundant and Inkscape specific tags/attributes stripped!)[/Edit] Done.
There will be a public release in a couple of days. Done.

Download
Jar: http://code.google.com/p/andengineexamp ... ension.jar
Repository: http://code.google.com/p/andenginesvgte ... extension/
Best Regards,
Nicolas
