Resize surface

Hi,

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?

SDL_Surface * SDL_ResizeSurface(SDL_Surface * surface, int x, int y);
(aznd eventually a certain filter as an optionnal parameter)

I’ve read some of you had the issue too, there must be some piece of code
around that does it, right?

Alex

Hi,

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.On Thu, 25 Jul 2002, Alexis wrote:


Roger D. Vargas | El sistema se apagara en 5 segundos.
ICQ: 117641572 | Salvese el que pueda!
Linux User: 180787 |

There is an internal call that does this but if it’s not documented
maybe it should NOT be used :slight_smile:

…I found it while doing the SDL Amiga porting :slight_smile:

BTW: I’ve found at least a program that use that function: SDLroids.

You can easily implement bitmap resizing faster than SDL for instance
with a static table if you have to resize tons of pictures always with
the same ratio. Just look on the web for nice ways to do this.

Bye,
Gabry

PS: I don’t write the name of the function in this post since I don’t
want to be guilt of finding it in tons of SDL programs :)On Thu, 2002-07-25 at 16:57, Alexis wrote:

Hi,

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?

  • Roger D. Vargas :> 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

Hi

Is it posible to change the size of an existing Surface ?