SFML community forums

Help => Graphics => Topic started by: starkhorn on June 03, 2015, 02:52:06 am

Title: Scalable vector graphic support in SFML?
Post by: starkhorn on June 03, 2015, 02:52:06 am
Hi Folks,

I tried loading in a Scalable vector graphic (SVG) file into a texture using the loadfromFile method.
I get:-
Reason: Image not of any known type, or corrupt
Failed to create texture, invalid size (0x0)
 

So then I tried to search to see if SFML supports SVG. I found the change log but no mention of SVG support.
http://www.sfml-dev.org/changelog.php

In addition searches in this forum suggest this isn't supported. I found the below thread from 2012.

http://en.sfml-dev.org/forums/index.php?topic=7667.0

As this is a few years old now, I thought to re-ask the question. I'm assuming the answer is still no but wondering if this was a feature to be included later?
Title: Re: Scalable vector graphic support in SFML?
Post by: zsbzsb on June 03, 2015, 03:51:36 am
No SFML doesn't support it and no there isn't plans to implement it (unless something is planned that nobody has been talking about). Nobody has even bothered yet to implement it as a addon project to SFML that I am aware of so as you can see its not a big deal for most people.
Title: Re: Scalable vector graphic support in SFML?
Post by: Laurent on June 03, 2015, 07:37:33 am
Your post is not clear. Do you just want to be able to load (rasterize) SVG files into textures, or do you want full vector graphics support into SFML?
Title: Re: Scalable vector graphic support in SFML?
Post by: Mario on June 04, 2015, 01:09:44 pm
I'd love being able to read SVG images as some kind of sf::GraphicsShape or whatever (or maybe even just sf::VertexArray), but lack of time, other things to do first, and a such big/complex file format/standard. :(
Title: Re: Scalable vector graphic support in SFML?
Post by: starkhorn on June 05, 2015, 01:46:18 am
Your post is not clear. Do you just want to be able to load (rasterize) SVG files into textures, or do you want full vector graphics support into SFML?

Sorry if I was not clear.

I was simply trying to load SVG files into textures, i.e. I used the texture loadfromFile method and I got that file format unknown error.

This led me to confirm whether loading in SVG was supported - hence this post.

I was not trying to do anything SVG specific - I was simply given an image in this format and I tried to load it as I would a PNG or JPEG etc.

I want to zoom right in on an image and a friend suggested using a SVG to reduce it looking pixelated on zooms in.
Title: Re: Scalable vector graphic support in SFML?
Post by: Laurent on June 05, 2015, 08:01:35 am
Quote
I want to zoom right in on an image and a friend suggested using a SVG to reduce it looking pixelated on zooms in.
That requires real vector graphics rendering. Simply loading a SVG file won't make any difference compared to any other format, after loading it's just an array or RGBA pixels, no matter which file format it was loaded from.