Jump to content

  • Log In with Google      Sign In   
  • Create Account

Image resizing using 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.

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

#1 valsar   Members   -  Reputation: 133

Like
0Likes
Like

Posted 19 September 2007 - 06:12 PM

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.

Sponsor:

#2 Lazy Foo   Members   -  Reputation: 1105

Like
0Likes
Like

Posted 19 September 2007 - 06:40 PM

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.

Learn to make games with my SDL 2 Tutorials


#3 NQ   Members   -  Reputation: 328

Like
0Likes
Like

Posted 25 September 2007 - 10:43 AM

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.




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