Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


SDL Surface scale with no quality lose


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Xirion   Members   -  Reputation: 262

Like
0Likes
Like

Posted 03 September 2012 - 03:43 PM

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.

Sponsor:

#2 prh99   Members   -  Reputation: 504

Like
1Likes
Like

Posted 03 September 2012 - 03:57 PM

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

#3 Xirion   Members   -  Reputation: 262

Like
0Likes
Like

Posted 03 September 2012 - 04:06 PM

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?

#4 prh99   Members   -  Reputation: 504

Like
1Likes
Like

Posted 03 September 2012 - 04:23 PM

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, 03 September 2012 - 04:25 PM.

Patrick

#5 Xirion   Members   -  Reputation: 262

Like
0Likes
Like

Posted 04 September 2012 - 11:07 AM

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?

#6 Brother Bob   Moderators   -  Reputation: 8621

Like
1Likes
Like

Posted 04 September 2012 - 11:17 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS