Resizing surfaces

hi !
Does anyone of you know a good way (and an easy one if possible) to
resize pictures ?
For example I would have a 6464 pixels image and i would transform it
to a x
x one.

In fact my pb is that I’m working on a formation editor for a soccer
game. I’m using wide pictures for comfort but on some configs 1024*768
is not always supported. So i’d like to have an opportunity to resize
pics on startup to fit the resolution my soft will be able to use.

also where could i find info on keeping framerates constant ?

Any suggestions ?

C-ya !

Trias Sylvain wrote:

hi !
Does anyone of you know a good way (and an easy one if possible) to
resize pictures ?
For example I would have a 6464 pixels image and i would transform it
to a x
x one.

If you simply want to enlarge the surface (without stretching the image
itself), create a new surface of the desired size and blit the old one
onto it.
However, if you want to scale the surface, you’ll need to write your own
routine to do it. It’s not too hard, but you’ll need to access the
surface’s pixels directly.

also where could i find info on keeping framerates constant ?

SDL syncs with the video refresh by default (I believe), but if that’s
not sufficient you can use another timing source to insert the
appropriate delays.

-John

hi !
Does anyone of you know a good way (and an easy one if possible) to
resize pictures ?
For example I would have a 6464 pixels image and i would transform it
to a x
x one.

Alexander Pipelka posted some code called
SDLStretch that does just that. It works well, and is under LGPL like
SDL.

I don’t know where you can find it on the web. I can email the code
SDLStretch.{cpp,h} if you like.

FrancisOn Thu, 06 Jul 2000 02:54:56 +0200, you wrote:

Francis Irving a ?crit :> On Thu, 06 Jul 2000 02:54:56 +0200, you wrote:

hi !
Does anyone of you know a good way (and an easy one if possible) to
resize pictures ?
For example I would have a 6464 pixels image and i would transform it
to a x
x one.

Alexander Pipelka posted some code called
SDLStretch that does just that. It works well, and is under LGPL like
SDL.

I don’t know where you can find it on the web. I can email the code
SDLStretch.{cpp,h} if you like.

Francis

Yes, I would appreciate !
(just a little joke : I spent 2 hours ripping my hair off with one of my
piece of code to discover a if (screen=NULL) instead of == . I’m just so
stupid)
C ya

Alexander Pipelka posted some code called
SDLStretch that does just that. It works well, and is under LGPL like
SDL.

I don’t know where you can find it on the web. I can email the code
SDLStretch.{cpp,h} if you like.

Francis

Yes, I would appreciate !
(just a little joke : I spent 2 hours ripping my hair off with one of my
piece of code to discover a if (screen=NULL) instead of == . I’m just so
stupid)

Emailed!

FrancisOn Fri, 07 Jul 2000 00:48:00 +0200, you wrote:

bozo wrote:

(just a little joke : I spent 2 hours ripping my hair off with one of my
piece of code to discover a if (screen=NULL) instead of == . I’m just so
stupid)

What? You didn’t have full pedantic ("-Wall -pedantic") warnings
enabled? They TELL you about this! Gosh, do I love GCC! :-)–
“As usual, this being a 1.3.x release, I haven’t even compiled this
kernel yet. So if it works, you should be doubly impressed.”
– Linus Torvalds

Pierre Phaneuf wrote:

bozo wrote:

(just a little joke : I spent 2 hours ripping my hair off with one of my
piece of code to discover a if (screen=NULL) instead of == . I’m just so
stupid)

What? You didn’t have full pedantic ("-Wall -pedantic") warnings
enabled? They TELL you about this! Gosh, do I love GCC! :slight_smile:

CXXFLAGS =
-ansi
-pedantic
-Wall
-Wtraditional
-Wid-clash-8
-Wpointer-arith
-Wcast-qual
-Wcast-align
-Wwrite-strings
-Wconversion
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
-Wnested-externs
-Woverloaded-virtual
-Werror

These I usually have problems with so don’t use

-Wshadow declaration of `foo’ shadows global declaratio

-Waggregate-return warning: function returns an aggregate

-Wredundant-decls warning: redundant redeclaration of `foo’ in same

scope

-Wenum-clash Invalid option `-Wenum-clash’

-Winline warning: function with static variable cannot be

inline–
Marc A. Lepage
Software Developer
Molecular Mining Corporation
http://www.molecularmining.com/

CXXFLAGS =
-ansi
-pedantic\

Seems -pedantic isn’t very useful with SDL and C++ because of the use of
some header files. Those who care (!= me) may want to clean up that mess.

Personally, I use -Wall -W -O2 (don’t forget that turning optimization on
permits the dataflow analyser to detect more bad things).

-Wcast-align\

is something I would like all x86 programmers to use.

Newsgroups: loki.open-source.sdl

bozo wrote:

(just a little joke : I spent 2 hours ripping my hair off with one of my
piece of code to discover a if (screen=NULL) instead of == . I’m just so
stupid)

Anyway since NULL==0, “if(!screen)” is shorter (economize your disk space),
faster, etc…

Herve PARISSI
"You assume too much" (The Menace Phantom)

----- Original Message -----
From: pp@ludusdesign.com (Pierre Phaneuf)
To:
Sent: Friday, July 07, 2000 6:05 PM
Subject: [SDL] Re: resizing surfaces

(just a little joke : I spent 2 hours ripping my hair off with one of my
piece of code to discover a if (screen=NULL) instead of == . I’m just so
stupid)

Anyway since NULL==0, “if(!screen)” is shorter (economize your disk space),
faster, etc…

No, NULL and 0 are not quite the same thing. There are many misconceptions
about null pointers, and they have a whole chapter in the C FAQ. I suggest
you read http://www.faqs.org/faqs/C-faq/faq/, especially section 5 but in
fact all the others as well.

And no, it isn’t faster. (I usually write if(!pointer) myself, but not for
disk space or speed reasons.)

thank you all for all your responses!
bozo_fr