PDA

View Full Version : Resize sdl surface



code_glitch
02-10-2010, 08:31 AM
I've looked around and I cant seem to find anything that can resize an image in sdl with a new aspect ratio. Does anyone out there know of such a procedure/function? Thanks, it would be a great help for me in the prometheus project (units for simplifying game design for newbies)...

cheers,
code_glitch

Carver413
02-10-2010, 10:17 AM
you might try

sdl_gfx

zoomSurface()

Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1
then the destination 32bit surface is anti-aliased. If the surface is not 8bit
or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

code_glitch
02-10-2010, 10:57 AM
cheers. I always thought it was just to scale it. Just looked into the docs, seems I was wrong. Sorry for asking such an elementary question...

WILL
02-10-2010, 12:17 PM
Problem with this is that any scaling, rotation or fading effects you throw into the library/engine will slow down performance significantly, unless you throw in some OpenGL, but then you're probably tossing away the simplicity factor. Sore truth is that these 3 effects are the product of 3D hardware acceleration for 2D games.

There is, I believe, a 2 times zoom function in the JEDI-SDL units. Written for fast drawing double the size of any image you need.