author Sam Lantinga <>
Sat, 28 Apr 2001 18:24:37 +0000
changeset 35 4b1f174486fa
parent 34 26723f72c583
child 45 45736a3044c0
permissions -rw-r--r--
Date: Tue, 24 Apr 2001 15:26:53 +0200 (MET DST)
From: "Mattias Engdeg�rd" <>
Subject: XPM patch to SDL_image

A couple of people have requested an interface to SDL_image for loading
SDL images directly from #included XPM files in the C source.
Writing a separate loader for this would be silly as the code in SDL_image
already does the XPM parsing, so I added a new call to the SDL_image API:

SDL_Surface *IMG_ReadXPMFromArray(char **xpm);

which does the obvious thing. As a bonus, the code got a little cleaner as
well. (We probably need to increase the minor .so-version number since the
interface got changed but I didn't do so in my patch.)

We should perhaps include the rgb.txt colour name database as well, since
it's quite small (~13K in binary form), but I haven't made up my mind


     2 SDL_image 1.2
     4 The latest version of this library is available from:
     7 This is a simple library to load images of various formats as SDL surfaces.
     8 This library supports BMP, PNM (PPM/PGM/PBM), XPM, PCX, GIF, JPEG, PNG,
     9 TGA, and TIFF formats.
    11 API:
    12 #include "SDL_image.h"
    14 	SDL_Surface *IMG_Load(const char *file);
    15 or
    16 	SDL_Surface *IMG_Load_RW(SDL_RWops *src, int freesrc);
    17 or
    18 	SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type);
    20 where type is a string specifying the format (i.e. "PNG" or "pcx").
    21 Note that IMG_Load_RW cannot load TGA images.
    23 To create a surface from an XPM image included in C source, use:
    25 	SDL_Surface *IMG_ReadXPMFromArray(char **xpm);
    27 An example program 'showimage' is included, with source in showimage.c
    29 JPEG support requires the JPEG library:
    30 PNG support requires the PNG library:
    31     and the Zlib library:
    32 TIFF support requires the TIFF library:
    34 This library is under the GNU Library General Public License, see the file
    35 "COPYING" for details.  Certain image loaders may be under a different
    36 license, see the individual image loader source files for details.