[SDL] Re: resize surface

Thatcher Ulrich tulrich at tulrich.com
Thu Jul 25 21:29:01 PDT 2002


* Roger D. Vargas <roger at eht.scu.tur.cu>:
>  On Thu, 25 Jul 2002, Alexis wrote:
>  
> > A very simple issue most of you may have an answer..  My program
> > loads an image from a file (let's say 'whatever.tga') on a surface
> > using sdl_image. This program is supposed to blit this surface
> > somewhere on another surface (the screen for instance).  My
> > problem is i've gotta scale the image's surface so that it keeps a
> > certain ratio. I guess there must be a way to resize this surface
> > but can't find any SDL call to perform this task, do i have to
> > implement something like this myself?
>
>  I think there are some libs that does that (maybe rotozoom?) and
>  also antialising.

If you do end up needing to roll your own, here is some public domain
source that does antialiased resizing (but not rotation):

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/tu-testbed/tu-testbed/engine/image_filters.cpp?rev=1.7&content-type=text/vnd.viewcvs-markup

It's a C++ version of Dale Schumacher's public domain K&R C code from
Graphics Gems III, which is also on the net in various places.

-- 
Thatcher Ulrich
http://tulrich.com






More information about the SDL mailing list