Sign in to follow this  
Xirion

SDL Surface scale with no quality lose

Recommended Posts

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

Share this post


Link to post
Share on other sites
prh99    520
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.

Share this post


Link to post
Share on other sites
Xirion    292
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?

Share this post


Link to post
Share on other sites
prh99    520
[quote name='Xirion' timestamp='1346710016' post='4976213']
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?
[/quote]

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. Edited by prh99

Share this post


Link to post
Share on other sites
Xirion    292
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?

Share this post


Link to post
Share on other sites
Brother Bob    10344
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this