Image Loading and Displaying

Hi,
I was originally going to use bitmap images, but then realized there were
issues involving transparency. Is it possible to load .png or .gif images
and display them on surfaces? I notice there are only functions to load
bitmap images.

-Jamie

SDL_image supports those, and many more.

BTW, I’d suggest JPG if you want destructive compression, and PNG for
pretty much everything else, including <=256 color images. Most other
formats will result in bigger files, and some aren’t always supported
if you rely on dynamic linking. (No GIF by default on some Linux
distros, for example.)

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Wednesday 13 April 2005 14.21, Jamie Bernier wrote:

Hi,
I was originally going to use bitmap images, but then realized there
were issues involving transparency. Is it possible to load .png
or .gif images and display them on surfaces? I notice there are only
functions to load bitmap images.

Hi,
I was originally going to use bitmap images, but then realized there were
issues involving transparency. Is it possible to load .png or .gif images
and display them on surfaces? I notice there are only functions to load
bitmap images.

If you’re constrained to using only SDL and cannot use SDL_Image, there is
a rather trivial patch you can apply to SDL to allow it to load 32bpp
bitmaps. I have done this myself and it works remarkably well.