Jump to content
  • Advertisement
Sign in to follow this  
Xirion

SDL Surface scale with no quality lose

This topic is 2207 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


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

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

Share this post


Link to post
Share on other sites
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!