what is the proper way to scale an SDL Surface? I found one explanation online but it required redrawing the Surface pixel by pixel. It seems like there should be some way of doing this natively through SDL rather than redrawing the image like that. I haven't been able to find anything in the SDL documentation that covers this. I am able to resize surfaces without any problem by modifying the surfaces width and height, but the resulting surface is clipped. Thanks for any help!
+4
A:
SDL doesn't support scaled blitting. According to the documentation of SDL_BlitSurface:
Note: the SDL blitter does not (yet) have the capability of scaling the blitted surfaces up or down like it is the case with other more sophisticated blitting mechanisms. You have to figure something out for yourself if you want to scale images (e.g. use SDL_gfx).
You could find SDL_gfx here. Writing your own blitting function isn't that bad, it might be a fun and useful learning experiment (though you'd be reinventing the wheel). Using OpenGL is also an option, as stuff like scaling and rotating could be done in a single function call.
Firas Assaad
2008-11-30 06:09:29