## SVG images?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
mrguyman
Prole
Posts: 1
Joined: Sat Aug 07, 2010 2:01 pm

### SVG images?

Does Love2D support vector graphics made in Inkscape?

thelinx
The Strongest
Posts: 848
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

### Re: SVG images?

No.

bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

### Re: SVG images?

Not in any vector format anyway.

Jasoco
Inner party member
Posts: 3651
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

### Re: SVG images?

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.

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: SVG images?

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.

s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

### Re: SVG images?

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.
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.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
baby:hurt(me)
end

ivan
Party member
Posts: 1564
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

### Re: SVG images?

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.

Xgoff
Party member
Posts: 211
Joined: Fri Nov 19, 2010 4:20 am

### Re: SVG images?

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

SiENcE
Party member
Posts: 785
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

### Re: SVG images?

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).

### Who is online

Users browsing this forum: Bing [Bot], girng and 17 guests