IMG_xpm.c
author Sam Lantinga <slouken@libsdl.org>
Sun, 22 Jan 2012 21:52:00 -0500
changeset 320 aa5d55b11751
parent 288 cbf4a9d168ff
child 339 2e4f9d95a8c8
permissions -rw-r--r--
Updated for SDL 2.0
slouken@7
     1
/*
slouken@280
     2
  SDL_image:  An example image loading library for use with SDL
slouken@280
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
slouken@7
     4
slouken@280
     5
  This software is provided 'as-is', without any express or implied
slouken@280
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@280
     7
  arising from the use of this software.
slouken@7
     8
slouken@280
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@280
    10
  including commercial applications, and to alter it and redistribute it
slouken@280
    11
  freely, subject to the following restrictions:
slouken@7
    12
slouken@280
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@280
    14
     claim that you wrote the original software. If you use this software
slouken@280
    15
     in a product, an acknowledgment in the product documentation would be
slouken@280
    16
     appreciated but is not required.
slouken@280
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@280
    18
     misrepresented as being the original software.
slouken@280
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@7
    20
*/
slouken@7
    21
slouken@35
    22
/*
slouken@35
    23
 * XPM (X PixMap) image loader:
slouken@35
    24
 *
slouken@35
    25
 * Supports the XPMv3 format, EXCEPT:
slouken@35
    26
 * - hotspot coordinates are ignored
slouken@35
    27
 * - only colour ('c') colour symbols are used
slouken@35
    28
 * - rgb.txt is not used (for portability), so only RGB colours
slouken@35
    29
 *   are recognized (#rrggbb etc) - only a few basic colour names are
slouken@35
    30
 *   handled
slouken@35
    31
 *
slouken@35
    32
 * The result is an 8bpp indexed surface if possible, otherwise 32bpp.
slouken@35
    33
 * The colourkey is correctly set if transparency is used.
slouken@35
    34
 * 
slouken@35
    35
 * Besides the standard API, also provides
slouken@35
    36
 *
slouken@35
    37
 *     SDL_Surface *IMG_ReadXPMFromArray(char **xpm)
slouken@35
    38
 *
slouken@35
    39
 * that reads the image data from an XPM file included in the C source.
slouken@35
    40
 *
slouken@35
    41
 * TODO: include rgb.txt here. The full table (from solaris 2.6) only
slouken@35
    42
 * requires about 13K in binary form.
slouken@35
    43
 */
slouken@7
    44
slouken@9
    45
#include <stdlib.h>
slouken@7
    46
#include <stdio.h>
slouken@7
    47
#include <string.h>
slouken@7
    48
#include <ctype.h>
slouken@7
    49
slouken@7
    50
#include "SDL_image.h"
slouken@7
    51
slouken@7
    52
#ifdef LOAD_XPM
slouken@7
    53
slouken@7
    54
/* See if an image is contained in a data source */
slouken@7
    55
int IMG_isXPM(SDL_RWops *src)
slouken@7
    56
{
slouken@117
    57
	int start;
slouken@117
    58
	int is_XPM;
slouken@35
    59
	char magic[9];
slouken@7
    60
icculus@154
    61
	if ( !src )
icculus@154
    62
		return 0;
slouken@117
    63
	start = SDL_RWtell(src);
slouken@117
    64
	is_XPM = 0;
slouken@117
    65
	if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
slouken@117
    66
		if ( memcmp(magic, "/* XPM */", sizeof(magic)) == 0 ) {
slouken@117
    67
			is_XPM = 1;
slouken@117
    68
		}
slouken@117
    69
	}
slouken@236
    70
	SDL_RWseek(src, start, RW_SEEK_SET);
slouken@117
    71
	return(is_XPM);
slouken@7
    72
}
slouken@7
    73
slouken@7
    74
/* Hash table to look up colors from pixel strings */
slouken@11
    75
#define STARTING_HASH_SIZE 256
slouken@11
    76
slouken@11
    77
struct hash_entry {
slouken@11
    78
	char *key;
slouken@11
    79
	Uint32 color;
slouken@11
    80
	struct hash_entry *next;
slouken@7
    81
};
slouken@7
    82
slouken@11
    83
struct color_hash {
slouken@11
    84
	struct hash_entry **table;
slouken@11
    85
	struct hash_entry *entries; /* array of all entries */
slouken@11
    86
	struct hash_entry *next_free;
slouken@11
    87
	int size;
slouken@11
    88
	int maxnum;
slouken@11
    89
};
slouken@11
    90
slouken@11
    91
static int hash_key(const char *key, int cpp, int size)
slouken@7
    92
{
slouken@7
    93
	int hash;
slouken@7
    94
slouken@7
    95
	hash = 0;
slouken@7
    96
	while ( cpp-- > 0 ) {
slouken@11
    97
		hash = hash * 33 + *key++;
slouken@7
    98
	}
slouken@11
    99
	return hash & (size - 1);
slouken@7
   100
}
slouken@7
   101
slouken@11
   102
static struct color_hash *create_colorhash(int maxnum)
slouken@7
   103
{
slouken@11
   104
	int bytes, s;
slouken@7
   105
	struct color_hash *hash;
slouken@7
   106
slouken@11
   107
	/* we know how many entries we need, so we can allocate
slouken@11
   108
	   everything here */
slouken@11
   109
	hash = malloc(sizeof *hash);
slouken@11
   110
	if(!hash)
slouken@11
   111
		return NULL;
slouken@11
   112
slouken@11
   113
	/* use power-of-2 sized hash table for decoding speed */
slouken@11
   114
	for(s = STARTING_HASH_SIZE; s < maxnum; s <<= 1)
slouken@11
   115
		;
slouken@11
   116
	hash->size = s;
slouken@11
   117
	hash->maxnum = maxnum;
slouken@11
   118
	bytes = hash->size * sizeof(struct hash_entry **);
slouken@11
   119
	hash->entries = NULL;	/* in case malloc fails */
slouken@11
   120
	hash->table = malloc(bytes);
slouken@11
   121
	if(!hash->table)
slouken@11
   122
		return NULL;
slouken@11
   123
	memset(hash->table, 0, bytes);
slouken@11
   124
	hash->entries = malloc(maxnum * sizeof(struct hash_entry));
icculus@275
   125
	if(!hash->entries) {
icculus@275
   126
		free(hash->table);
slouken@11
   127
		return NULL;
icculus@275
   128
	}
slouken@11
   129
	hash->next_free = hash->entries;
slouken@11
   130
	return hash;
slouken@7
   131
}
slouken@7
   132
slouken@7
   133
static int add_colorhash(struct color_hash *hash,
slouken@11
   134
                         char *key, int cpp, Uint32 color)
slouken@7
   135
{
slouken@11
   136
	int index = hash_key(key, cpp, hash->size);
slouken@11
   137
	struct hash_entry *e = hash->next_free++;
slouken@11
   138
	e->color = color;
slouken@11
   139
	e->key = key;
slouken@11
   140
	e->next = hash->table[index];
slouken@11
   141
	hash->table[index] = e;
slouken@11
   142
	return 1;
slouken@7
   143
}
slouken@7
   144
slouken@11
   145
/* fast lookup that works if cpp == 1 */
slouken@22
   146
#define QUICK_COLORHASH(hash, key) ((hash)->table[*(Uint8 *)(key)]->color)
slouken@11
   147
slouken@11
   148
static Uint32 get_colorhash(struct color_hash *hash, const char *key, int cpp)
slouken@7
   149
{
slouken@11
   150
	struct hash_entry *entry = hash->table[hash_key(key, cpp, hash->size)];
slouken@11
   151
	while(entry) {
slouken@11
   152
		if(memcmp(key, entry->key, cpp) == 0)
slouken@11
   153
			return entry->color;
slouken@11
   154
		entry = entry->next;
slouken@7
   155
	}
slouken@11
   156
	return 0;		/* garbage in - garbage out */
slouken@7
   157
}
slouken@7
   158
slouken@7
   159
static void free_colorhash(struct color_hash *hash)
slouken@7
   160
{
slouken@11
   161
	if(hash && hash->table) {
slouken@11
   162
		free(hash->table);
slouken@11
   163
		free(hash->entries);
slouken@11
   164
		free(hash);
slouken@7
   165
	}
slouken@7
   166
}
slouken@7
   167
slouken@35
   168
/* portable case-insensitive string comparison */
slouken@35
   169
static int string_equal(const char *a, const char *b, int n)
slouken@35
   170
{
slouken@35
   171
	while(*a && *b && n) {
slouken@35
   172
		if(toupper((unsigned char)*a) != toupper((unsigned char)*b))
slouken@35
   173
			return 0;
slouken@35
   174
		a++;
slouken@35
   175
		b++;
slouken@35
   176
		n--;
slouken@35
   177
	}
slouken@35
   178
	return *a == *b;
slouken@35
   179
}
slouken@35
   180
slouken@11
   181
#define ARRAYSIZE(a) (int)(sizeof(a) / sizeof((a)[0]))
slouken@11
   182
slouken@11
   183
/*
slouken@11
   184
 * convert colour spec to RGB (in 0xrrggbb format).
slouken@35
   185
 * return 1 if successful.
slouken@11
   186
 */
slouken@35
   187
static int color_to_rgb(char *spec, int speclen, Uint32 *rgb)
slouken@7
   188
{
slouken@11
   189
	/* poor man's rgb.txt */
slouken@11
   190
	static struct { char *name; Uint32 rgb; } known[] = {
slouken@11
   191
		{"none",  0xffffffff},
slouken@11
   192
		{"black", 0x00000000},
slouken@11
   193
		{"white", 0x00ffffff},
slouken@11
   194
		{"red",   0x00ff0000},
slouken@11
   195
		{"green", 0x0000ff00},
slouken@11
   196
		{"blue",  0x000000ff}
slouken@11
   197
	};
slouken@7
   198
slouken@11
   199
	if(spec[0] == '#') {
slouken@11
   200
		char buf[7];
slouken@35
   201
		switch(speclen) {
slouken@35
   202
		case 4:
slouken@35
   203
			buf[0] = buf[1] = spec[1];
slouken@35
   204
			buf[2] = buf[3] = spec[2];
slouken@35
   205
			buf[4] = buf[5] = spec[3];
slouken@7
   206
			break;
slouken@35
   207
		case 7:
slouken@35
   208
			memcpy(buf, spec + 1, 6);
slouken@7
   209
			break;
slouken@35
   210
		case 13:
slouken@35
   211
			buf[0] = spec[1];
slouken@35
   212
			buf[1] = spec[2];
slouken@35
   213
			buf[2] = spec[5];
slouken@35
   214
			buf[3] = spec[6];
slouken@35
   215
			buf[4] = spec[9];
slouken@35
   216
			buf[5] = spec[10];
slouken@7
   217
			break;
slouken@11
   218
		}
slouken@11
   219
		buf[6] = '\0';
slouken@11
   220
		*rgb = strtol(buf, NULL, 16);
slouken@11
   221
		return 1;
slouken@11
   222
	} else {
slouken@11
   223
		int i;
slouken@11
   224
		for(i = 0; i < ARRAYSIZE(known); i++)
slouken@35
   225
			if(string_equal(known[i].name, spec, speclen)) {
slouken@11
   226
				*rgb = known[i].rgb;
slouken@11
   227
				return 1;
slouken@11
   228
			}
slouken@11
   229
		return 0;
slouken@7
   230
	}
slouken@7
   231
}
slouken@7
   232
slouken@11
   233
#ifndef MAX
slouken@11
   234
#define MAX(a, b) ((a) > (b) ? (a) : (b))
slouken@11
   235
#endif
slouken@11
   236
slouken@35
   237
static char *linebuf;
slouken@35
   238
static int buflen;
slouken@35
   239
static char *error;
slouken@35
   240
slouken@35
   241
/*
slouken@35
   242
 * Read next line from the source.
slouken@35
   243
 * If len > 0, it's assumed to be at least len chars (for efficiency).
slouken@35
   244
 * Return NULL and set error upon EOF or parse error.
slouken@35
   245
 */
slouken@36
   246
static char *get_next_line(char ***lines, SDL_RWops *src, int len)
slouken@7
   247
{
slouken@288
   248
	char *linebufnew;
slouken@288
   249
slouken@35
   250
	if(lines) {
slouken@35
   251
		return *(*lines)++;
slouken@35
   252
	} else {
slouken@35
   253
		char c;
slouken@35
   254
		int n;
slouken@35
   255
		do {
slouken@35
   256
			if(SDL_RWread(src, &c, 1, 1) <= 0) {
slouken@35
   257
				error = "Premature end of data";
slouken@35
   258
				return NULL;
slouken@35
   259
			}
slouken@35
   260
		} while(c != '"');
slouken@35
   261
		if(len) {
slouken@35
   262
			len += 4;	/* "\",\n\0" */
slouken@35
   263
			if(len > buflen){
slouken@35
   264
				buflen = len;
slouken@288
   265
				linebufnew = realloc(linebuf, buflen);
icculus@275
   266
				if(!linebufnew) {
icculus@275
   267
					free(linebuf);
slouken@35
   268
					error = "Out of memory";
slouken@35
   269
					return NULL;
slouken@35
   270
				}
icculus@275
   271
				linebuf = linebufnew;
slouken@35
   272
			}
slouken@35
   273
			if(SDL_RWread(src, linebuf, len - 1, 1) <= 0) {
slouken@35
   274
				error = "Premature end of data";
slouken@35
   275
				return NULL;
slouken@35
   276
			}
slouken@35
   277
			n = len - 2;
slouken@35
   278
		} else {
slouken@35
   279
			n = 0;
slouken@35
   280
			do {
slouken@35
   281
				if(n >= buflen - 1) {
slouken@35
   282
					if(buflen == 0)
slouken@35
   283
						buflen = 16;
slouken@35
   284
					buflen *= 2;
slouken@288
   285
					linebufnew = realloc(linebuf, buflen);
icculus@275
   286
					if(!linebufnew) {
icculus@275
   287
						free(linebuf);
slouken@35
   288
						error = "Out of memory";
slouken@35
   289
						return NULL;
slouken@35
   290
					}
icculus@275
   291
					linebuf = linebufnew;
slouken@35
   292
				}
slouken@35
   293
				if(SDL_RWread(src, linebuf + n, 1, 1) <= 0) {
slouken@35
   294
					error = "Premature end of data";
slouken@35
   295
					return NULL;
slouken@35
   296
				}
slouken@35
   297
			} while(linebuf[n++] != '"');
slouken@35
   298
			n--;
slouken@35
   299
		}
slouken@35
   300
		linebuf[n] = '\0';
slouken@35
   301
		return linebuf;
slouken@35
   302
	}
slouken@35
   303
}
slouken@35
   304
slouken@35
   305
#define SKIPSPACE(p)				\
slouken@35
   306
do {						\
slouken@35
   307
	while(isspace((unsigned char)*(p)))	\
slouken@35
   308
	      ++(p);				\
slouken@35
   309
} while(0)
slouken@35
   310
slouken@35
   311
#define SKIPNONSPACE(p)					\
slouken@35
   312
do {							\
slouken@35
   313
	while(!isspace((unsigned char)*(p)) && *p)	\
slouken@35
   314
	      ++(p);					\
slouken@35
   315
} while(0)
slouken@35
   316
slouken@35
   317
/* read XPM from either array or RWops */
slouken@35
   318
static SDL_Surface *load_xpm(char **xpm, SDL_RWops *src)
slouken@35
   319
{
slouken@176
   320
	int start = 0;
slouken@35
   321
	SDL_Surface *image = NULL;
slouken@7
   322
	int index;
slouken@11
   323
	int x, y;
slouken@7
   324
	int w, h, ncolors, cpp;
slouken@7
   325
	int indexed;
slouken@7
   326
	Uint8 *dst;
slouken@35
   327
	struct color_hash *colors = NULL;
slouken@11
   328
	SDL_Color *im_colors = NULL;
slouken@35
   329
	char *keystrings = NULL, *nextkey;
slouken@35
   330
	char *line;
slouken@35
   331
	char ***xpmlines = NULL;
slouken@35
   332
	int pixels_len;
slouken@7
   333
slouken@38
   334
	error = NULL;
slouken@38
   335
	linebuf = NULL;
slouken@38
   336
	buflen = 0;
slouken@38
   337
icculus@154
   338
	if ( src ) 
icculus@154
   339
		start = SDL_RWtell(src);
slouken@118
   340
slouken@35
   341
	if(xpm)
slouken@35
   342
		xpmlines = &xpm;
slouken@35
   343
slouken@35
   344
	line = get_next_line(xpmlines, src, 0);
slouken@35
   345
	if(!line)
slouken@35
   346
		goto done;
slouken@11
   347
	/*
slouken@11
   348
	 * The header string of an XPMv3 image has the format
slouken@11
   349
	 *
slouken@11
   350
	 * <width> <height> <ncolors> <cpp> [ <hotspot_x> <hotspot_y> ]
slouken@11
   351
	 *
slouken@11
   352
	 * where the hotspot coords are intended for mouse cursors.
slouken@11
   353
	 * Right now we don't use the hotspots but it should be handled
slouken@11
   354
	 * one day.
slouken@11
   355
	 */
slouken@35
   356
	if(sscanf(line, "%d %d %d %d", &w, &h, &ncolors, &cpp) != 4
slouken@11
   357
	   || w <= 0 || h <= 0 || ncolors <= 0 || cpp <= 0) {
slouken@35
   358
		error = "Invalid format description";
slouken@35
   359
		goto done;
slouken@11
   360
	}
slouken@7
   361
slouken@11
   362
	keystrings = malloc(ncolors * cpp);
slouken@11
   363
	if(!keystrings) {
slouken@35
   364
		error = "Out of memory";
slouken@35
   365
		goto done;
slouken@11
   366
	}
slouken@11
   367
	nextkey = keystrings;
slouken@7
   368
slouken@11
   369
	/* Create the new surface */
slouken@11
   370
	if(ncolors <= 256) {
slouken@11
   371
		indexed = 1;
slouken@11
   372
		image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8,
slouken@11
   373
					     0, 0, 0, 0);
slouken@11
   374
		im_colors = image->format->palette->colors;
slouken@11
   375
		image->format->palette->ncolors = ncolors;
slouken@11
   376
	} else {
slouken@11
   377
		indexed = 0;
slouken@11
   378
		image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
slouken@11
   379
					     0xff0000, 0x00ff00, 0x0000ff, 0);
slouken@11
   380
	}
slouken@11
   381
	if(!image) {
slouken@11
   382
		/* Hmm, some SDL error (out of memory?) */
slouken@35
   383
		goto done;
slouken@11
   384
	}
slouken@7
   385
slouken@7
   386
	/* Read the colors */
slouken@11
   387
	colors = create_colorhash(ncolors);
slouken@35
   388
	if (!colors) {
slouken@11
   389
		error = "Out of memory";
slouken@11
   390
		goto done;
slouken@7
   391
	}
slouken@11
   392
	for(index = 0; index < ncolors; ++index ) {
slouken@35
   393
		char *p;
slouken@35
   394
		line = get_next_line(xpmlines, src, 0);
slouken@35
   395
		if(!line)
slouken@35
   396
			goto done;
slouken@11
   397
slouken@35
   398
		p = line + cpp + 1;
slouken@11
   399
slouken@11
   400
		/* parse a colour definition */
slouken@11
   401
		for(;;) {
slouken@11
   402
			char nametype;
slouken@11
   403
			char *colname;
slouken@35
   404
			Uint32 rgb, pixel;
slouken@11
   405
slouken@35
   406
			SKIPSPACE(p);
slouken@35
   407
			if(!*p) {
slouken@35
   408
				error = "colour parse error";
slouken@11
   409
				goto done;
slouken@7
   410
			}
slouken@35
   411
			nametype = *p;
slouken@35
   412
			SKIPNONSPACE(p);
slouken@35
   413
			SKIPSPACE(p);
slouken@35
   414
			colname = p;
slouken@35
   415
			SKIPNONSPACE(p);
slouken@11
   416
			if(nametype == 's')
slouken@11
   417
				continue;      /* skip symbolic colour names */
slouken@11
   418
slouken@35
   419
			if(!color_to_rgb(colname, p - colname, &rgb))
slouken@11
   420
				continue;
slouken@11
   421
slouken@35
   422
			memcpy(nextkey, line, cpp);
slouken@11
   423
			if(indexed) {
slouken@11
   424
				SDL_Color *c = im_colors + index;
slouken@139
   425
				c->r = (Uint8)(rgb >> 16);
slouken@139
   426
				c->g = (Uint8)(rgb >> 8);
slouken@139
   427
				c->b = (Uint8)(rgb);
slouken@35
   428
				pixel = index;
slouken@11
   429
			} else
slouken@35
   430
				pixel = rgb;
slouken@35
   431
			add_colorhash(colors, nextkey, cpp, pixel);
slouken@11
   432
			nextkey += cpp;
slouken@11
   433
			if(rgb == 0xffffffff)
slouken@320
   434
				SDL_SetColorKey(image, SDL_TRUE, pixel);
slouken@11
   435
			break;
slouken@7
   436
		}
slouken@7
   437
	}
slouken@7
   438
slouken@7
   439
	/* Read the pixels */
slouken@11
   440
	pixels_len = w * cpp;
slouken@11
   441
	dst = image->pixels;
slouken@35
   442
	for(y = 0; y < h; y++) {
slouken@35
   443
		line = get_next_line(xpmlines, src, pixels_len);
slouken@11
   444
		if(indexed) {
slouken@11
   445
			/* optimization for some common cases */
slouken@11
   446
			if(cpp == 1)
slouken@11
   447
				for(x = 0; x < w; x++)
slouken@139
   448
					dst[x] = (Uint8)QUICK_COLORHASH(colors,
slouken@35
   449
								 line + x);
slouken@11
   450
			else
slouken@11
   451
				for(x = 0; x < w; x++)
slouken@139
   452
					dst[x] = (Uint8)get_colorhash(colors,
slouken@35
   453
							       line + x * cpp,
slouken@11
   454
							       cpp);
slouken@11
   455
		} else {
slouken@11
   456
			for (x = 0; x < w; x++)
slouken@11
   457
				((Uint32*)dst)[x] = get_colorhash(colors,
slouken@35
   458
								line + x * cpp,
slouken@11
   459
								  cpp);
slouken@7
   460
		}
slouken@11
   461
		dst += image->pitch;
slouken@7
   462
	}
slouken@11
   463
slouken@11
   464
done:
slouken@11
   465
	if(error) {
icculus@154
   466
		if ( src )
slouken@236
   467
			SDL_RWseek(src, start, RW_SEEK_SET);
slouken@118
   468
		if ( image ) {
slouken@118
   469
			SDL_FreeSurface(image);
slouken@118
   470
			image = NULL;
slouken@118
   471
		}
slouken@11
   472
		IMG_SetError(error);
slouken@7
   473
	}
slouken@11
   474
	free(keystrings);
slouken@7
   475
	free_colorhash(colors);
slouken@35
   476
	free(linebuf);
slouken@7
   477
	return(image);
slouken@7
   478
}
slouken@7
   479
slouken@35
   480
/* Load a XPM type image from an RWops datasource */
slouken@35
   481
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
slouken@35
   482
{
slouken@98
   483
	if ( !src ) {
slouken@98
   484
		/* The error message has been set in SDL_RWFromFile */
slouken@98
   485
		return NULL;
slouken@98
   486
	}
slouken@35
   487
	return load_xpm(NULL, src);
slouken@35
   488
}
slouken@35
   489
slouken@35
   490
SDL_Surface *IMG_ReadXPMFromArray(char **xpm)
slouken@35
   491
{
slouken@35
   492
	return load_xpm(xpm, NULL);
slouken@35
   493
}
slouken@35
   494
slouken@35
   495
#else  /* not LOAD_XPM */
slouken@7
   496
slouken@7
   497
/* See if an image is contained in a data source */
slouken@7
   498
int IMG_isXPM(SDL_RWops *src)
slouken@7
   499
{
slouken@7
   500
	return(0);
slouken@7
   501
}
slouken@7
   502
slouken@35
   503
slouken@7
   504
/* Load a XPM type image from an SDL datasource */
slouken@7
   505
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
slouken@7
   506
{
slouken@7
   507
	return(NULL);
slouken@7
   508
}
slouken@7
   509
slouken@35
   510
SDL_Surface *IMG_ReadXPMFromArray(char **xpm)
slouken@35
   511
{
slouken@35
   512
    return NULL;
slouken@35
   513
}
slouken@35
   514
#endif /* not LOAD_XPM */