[Disscussion] Which is better for mobile games, PNG or SVG?
-
PNG is the way to go. You can use SVG internally to get good quality, but the resulting game should be using PNGs. Reason is quite simple: displaying (parsing and drawing) SVG files takes a lot more time (IIRC, time is a few orders of magnitude longer).
-
wrote on 10 Feb 2012, 10:40 last edited by
[quote author="sierdzio" date="1328868566"]PNG is the way to go. You can use SVG internally to get good quality, but the resulting game should be using PNGs. Reason is quite simple: displaying (parsing and drawing) SVG files takes a lot more time (IIRC, time is a few orders of magnitude longer).[/quote]
The thing is I liked the way how you can make Sprite sheets easliy in SVG
Also, the rumor about the new screen res of the iPad 3, am creating screen res independent games :)
-
I know, it would be nice and easy to go with SVG, but it seems that the choice is this:
- either go with PNG and go through pain of generating separate files for various resolutions
- or try SVG and suffer from performance loses (or, if the amount of SVG content is not too large, the battery might get hit even though performance would stay decent)
-
Anyway, you can try benchmarking both approaches to see what is the real difference. I've seen comparison somewhere, but can't seem to be able to find it now.
-
wrote on 11 Feb 2012, 09:12 last edited by
Ok, let's ask another question,
In both cases, I'm scaling my images!
In PNGs, I scale images to a percentage where it looks good on screen.
So I will do in SVGs
BTW, I'm searching the internet for SVG Files to do comparison
Bests
-
take any Linux icon pack, they're full of SVGs, and usually come with prerendered PNGs, too.
-
wrote on 11 Feb 2012, 17:19 last edited by
You can have images saved as SVG and when you start your game, you resize them to desired resolution and save them ( only to RAM) as png or bmp ( preferably to bmp for better performance) with which your work with.
-
wrote on 11 Feb 2012, 18:15 last edited by
Thank you that's a great idea
[quote author="Jake007" date="1328980764"]You can have images saved as SVG and when you start your game, you resize them to desired resolution and save them ( only to RAM) as png or bmp ( preferably to bmp for better performance) with which your work with. [/quote]
Anyways I have made a comparison if anyone want source code let me know.
-
wrote on 12 Feb 2012, 22:42 last edited by
Can anyone give me hints on how to resize the an svg and then convert it
I will appreciate a code snippet
Bests
-
wrote on 17 Feb 2012, 18:16 last edited by
Code snippet
You can multiply the size to any size you like for the SVG Item or set the size customly in the QPixmap constructor
Bests
@ QSvgRenderer renderer;
renderer.load(QLatin1String("Head.svg"));
QPixmap image(renderer.defaultSize()2);
image.fill(Qt::transparent);
QPainter painter(&image);
renderer.render(&painter);
QGraphicsPixmapItem item = new QGraphicsPixmapItem(image);
@ -
wrote on 16 Sept 2013, 20:42 last edited by
Hello,
I read this discussion, and I like the hybrid approach to load the .svg and convert them to pixmap and then render it.
Because, it is seems a very good approach for get a perfect balance between the resolution independence of .svg with the speed of drawing of a pixmap...
I'm wondering if the QML Image item use this approach when you set a .svg image as source ...
anyone know the performances of QML Image item on .svg images ??