Page 1 of 1

SVG images?

Posted: Sat Aug 07, 2010 2:04 pm
by mrguyman
Does Love2D support vector graphics made in Inkscape?

Re: SVG images?

Posted: Sat Aug 07, 2010 2:06 pm
by thelinx
No.

Re: SVG images?

Posted: Sat Aug 07, 2010 2:26 pm
by bartbes
Not in any vector format anyway.

Re: SVG images?

Posted: Sat Aug 07, 2010 7:00 pm
by Jasoco
SVG is an open XML format. You might be able to write your own loader and reader, but it would take a lot of work.

Re: SVG images?

Posted: Sat Aug 07, 2010 9:11 pm
by Robin
Lua tables are much simpler to make vector graphics with in LÖVE. If you want to use Inkscape to create graphics, you might find this interesting: http://github.com/gvx/space/tree/master/asseteditor/

It is a converter from SVG to Lua tables, written by CyaNox for (my game) Space. I have no idea how it works, but it does, so I'm happy. :P

Re: SVG images?

Posted: Tue Mar 10, 2015 7:40 am
by s-ol
Robin wrote:Lua tables are much simpler to make vector graphics with in LÖVE. If you want to use Inkscape to create graphics, you might find this interesting: http://github.com/gvx/space/tree/master/asseteditor/

It is a converter from SVG to Lua tables, written by CyaNox for (my game) Space. I have no idea how it works, but it does, so I'm happy. :P
Note to self: try it, look for holes, host publicly for the rest of LÖVE

Edit: better yet, port to python. The actual implementation part is less than 20% of that (well done, but PHP) mess.

Re: SVG images?

Posted: Sun Mar 15, 2015 6:01 am
by ivan
Jasoco wrote:SVG is an open XML format. You might be able to write your own loader and reader, but it would take a lot of work.
A while ago, I wrote a lib that supports the basic SVG functionality (except for stroke, fill rules, gradients and textures):
viewtopic.php?f=5&t=78537&start=10#p181146
It's possible to support every SVG feature in Lua but it's slow and requires a lot of extra math.
For games, it's better to convert the SVGs to a more reasonable format and load that.

Re: SVG images?

Posted: Mon Mar 16, 2015 4:12 pm
by Xgoff
a few years ago i considered writing an svg-handling lib, but even svg tiny's spec is over 400 pages so i just went "nope"

this was also before Meshes were added to love so it probably would have not been the most pleasant thing to implement

Re: SVG images?

Posted: Fri Mar 20, 2015 10:04 am
by SiENcE
Some time ago, I was also thinking about an SVG workflow for love2d.

When you want to support different resolutions, it's a pain to work with raster graphics.

During my research I found this:

SVG Path Extractor for Corona SDK in Lua Language
https://github.com/singularity-is-i/SVG-Path-in-Lua

Lua library for easy SVG generation
https://github.com/cappelnord/EzSVG

nanoSVG
https://github.com/memononen/nanosvg

nanoSVG seems to me the best choice, but you have to write a nativ plugin for Love or a Binding via FFI (LUaJit).