A Little Bit About Me
I am currently, as I write this document, a programmer for Raytheon. There I do all sorts of communications, network, GUI, and other general programming tasks in C/C++ on the Solaris, Linux, and Windows Operating Systems.
Feel free to contact me: JonathanCAtkins@gmail.com
I am also usually on IRC at irc.freenode.net in the #SDL channel as LIM
Why is this for you?
Images provide the basic visual building blocks for any user interface. Colors and fun shapes are the stuff that we as kids looked at for hours at a time while trying to shoot down big aliens and rescue pixelated princesses. Now it's our turn to make the images that others will remember later in life perhaps. Now how do we get this dang images into our SDL programs, and be flexible in the handling of the images so that we don't even have to worry about what various formats they may be in? This is where SDLimage makes all of our lives easier. This document doesn't help you make artwork, but it will give you the functional knowledge on how to get that art into your game. Now go forth and make your Stick Figure of Justice, someone else might fill in for your lack of artistry, at least you won't have to make much of an effort to include the new and better art into your code.
This is the README, updated by me for accuracy, in the SDL_image source archive.
The latest version of this library is available from:
This is a simple library to load images of various formats as SDL surfaces.
This library supports ICO(Icon)/CUR(Cursor)/BMP, PNM (PPM/PGM/PBM), XPM,
LBM(IFF ILBM), PCX, GIF, JPEG, PNG, TGA, TIFF, and XV thumbnail formats.
SDL_Surface *IMG_Load(const char *file);
SDL_Surface *IMG_Load_RW(SDL_RWops *src, int freesrc);
SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type);
where type is a string specifying the format (i.e. "PNG" or "pcx").
Note that IMG_Load_RW cannot load TGA images.
To create a surface from an XPM image included in C source, use:
SDL_Surface *IMG_ReadXPMFromArray(char **xpm);
An example program 'showimage' is included, with source in showimage.c
JPEG support requires the JPEG library:
PNG support requires the PNG library:
and the Zlib library:
TIFF support requires the TIFF library:
SGI TIFF FTP Site
If you have these libraries installed in non-standard places, you can
try adding those paths to the configure script, e.g.
sh ./configure CPPFLAGS="-I/somewhere/include" LDFLAGS="-L/somewhere/lib"
If this works, you may need to add /somewhere/lib to your LD_LIBRARY_PATH
so shared library loading works correctly.
This library is under the GNU Library General Public License, see the file
"COPYING" for details. Certain image loaders may be under a different
license, see the individual image loader source files for details.
This document was generated
on November, 3 2009