• Advertisement
Sign in to follow this  

Image resizing using SDL

This topic is 3768 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

Does anyone know of a way to resize an image using SDL? What I'm looking for specifically is a way to stretching an image. I'm making a 2d rpg and I'm using the chipsets that people use for rpgmaker. Basically each tile on the chipset is 16x16 and I'm looking for a way with code to resize it so I can keep using different images without having to resize the actual images I download. I'm using C++ and VS2003 if you wanted to know.

Share this post


Link to post
Share on other sites
Advertisement
You can do it at runtime using SDL_gfx, specifically SDL_rotozoom.

or better yet do it before runtime using Irfan View. Doing it at runtime just waste CPU power. If you need constant scaling, you're better off using hardware accelerated OpenGL.

Share this post


Link to post
Share on other sites
I would just like to clarify what LazyFoo said;

1. If you want to resize it to a specific size and then use it like that in many places: use SDL_rotozoom to pre-process them and store them in their altered state as new surfaces. Then use those to blit the resized version.

2. If you want to resize it at runtime to an arbitrary size: then SDL_rotozoom is most likely too slow for you and you would have to look into using OpenGL instead. OpenGL does this without missing a step.

But even if you want to do it at runtime, then try rotozoom first and check if you can manage with the loss of speed. Maybe it won't bother you.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement