[SDL] resize surface

Alexis ihate at fucking.spam
Thu Jul 25 07:56:01 PDT 2002

On Thu, 2002-07-11 at 23:17, Neil Bradley wrote:
> 2) SDL_BlitSurface() Takes both a source and destination rectangle. This
> would allude to the fact that blitting may do a stretch blit - this is a
> feature I would like to have. However, if I increase the size of the
> destination rectangle, say, to 2X on both axes from the source rectangle,
> just the original size gets blitted to the destination. Is a stetch blit
> possible at all with SDL?

As far as I know, there is no such thing in SDL.
All the rectangles do is specifying which part of the surface gets
SDL is the Simpel DirectMedia Layer. If you want strech blit you'll have
to write it yourself. There aren't even any graphics primitives in
standard SDL.

> 3) I've noticed that blitting from an 8 bit surface to an 8 bit surface
> (offscreen buffer to onscreen buffer) is significantly slower than doing
> it via the DirectX route. Is it attempting some sort of palette
> translation? If so, how can I shut this off? Both palettes on both
> surfaces are surfaces are set identically, so no translation is needed.

Use SDL_DisplayFormat() on your surface first.
Otherwise it gets converted on-the-fly every time you blit it.

> 4) Is there any way, other than doing my own platform hooks in strategic
> places, I can ask SDL what environment it's running under (Windows, Linux,
> etc... would be sufficient)? This would be useful in figuring what I'd
> have to do to deal with the differences between drive letters (under
> Winderz) and explicit paths (everything else).

You could use macros and #ifdefs.
Call your compiler like this in your Windows makefile:
gcc -DWIN32 foo.c -o foo.o
and like this in Linux:
gcc foo.c -o foo.o

And in your code:
#ifdef WIN32
    open ("C:\\foo")
    open ("/foo");

More information about the SDL mailing list