SDL Surface scale with no quality lose

Started by
4 comments, last by Brother Bob 11 years, 7 months ago
Greetings.
I hope this doesn't sound dumb.
I'm looking for something that let me scale an image but with no quality lose.
I'm using C++ and SDL. I have my image and when i scaled it with gimp or photoshop
so i can use it in my game it get pixelated, and i don't want that.
(My image is around 2000px * 1500px and i need it 150px * 80px)
Is there a way of doing this with C++ and SDL?
I've heard about rotozoom, does this work for what i want?

Thanks a lot.
Sorry for my bad English.
Advertisement
Sorry, scaling a raster image invariably leads to some loss of quality, there are algorithms that try to minimize it's appearance like bi cubic scaling. I am afraid there isn't a way to take an 2000px x 1500px down to 150 x 80 without significant loss.

No, rotozooming, is just rotating an image while zoom in an out and will display the same problems of quality loss when zoomed far in or out.
Patrick
That's what i feared.
I was asking because, for example, secret maryo chronicles uses 256*256 images and when
rendered they are scaled but doesn't seem pixelated.
Is this because it uses openGL?

That's what i feared.
I was asking because, for example, secret maryo chronicles uses 256*256 images and when
rendered they are scaled but doesn't seem pixelated.
Is this because it uses openGL?


They probably use tiling to avoid scaling. That said you can scale an image and still have it look decent, but their are limits and the further you go the more noticable it will be, interpolation algorithms like Lanczos resampling, bi-cubic filtering, and tri-linear filtering and others just help hide the effects.
Patrick
I may have find out how. It seems they use Inkscape (SVG) for their graphics.
This means they can scale their images with minimal quality loss right?
If i'm in the right track can someone tell me how can i use SVG with SDL?
And if i'm not in the right track can someone point out wich is the right track?
Vector-based images, which is what SVG files are, are entirely different beasts than pixel-based images. They don't suffer from pixel artifacts when scaling simply because they aren't pixel based, and so you can scale them as you wish since pixels are introduced only when the actual pixel scale has been determined and it's time to render it to a pixel-based buffer.

I am not aware of any direct solution for handling vector graphics in SDL. You probably have to resort to a third-party renderer and then use the resulting bitmap in SDL.

This topic is closed to new replies.

Advertisement