IMG_xxx.c
author Sam Lantinga <slouken@libsdl.org>
Mon, 08 Dec 2008 00:27:32 +0000
changeset 186 5fbbeabf647f
parent 154 201cc5c1b373
child 236 cce1251de477
permissions -rw-r--r--
Updated copyright date
slouken@0
     1
/*
slouken@53
     2
    SDL_image:  An example image loading library for use with SDL
slouken@186
     3
    Copyright (C) 1997-2009 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@121
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@121
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@121
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@121
    15
    You should have received a copy of the GNU Lesser General Public
slouken@121
    16
    License along with this library; if not, write to the Free Software
slouken@121
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@53
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@0
    22
slouken@0
    23
/* This is a generic "format not supported" image framework */
slouken@0
    24
slouken@0
    25
#include <stdio.h>
slouken@0
    26
slouken@0
    27
#include "SDL_image.h"
slouken@0
    28
slouken@0
    29
#ifdef LOAD_XXX
slouken@0
    30
slouken@0
    31
/* See if an image is contained in a data source */
slouken@0
    32
int IMG_isXXX(SDL_RWops *src)
slouken@0
    33
{
slouken@117
    34
	int start;
slouken@0
    35
	int is_XXX;
slouken@0
    36
icculus@154
    37
	if ( !src )
icculus@154
    38
		return 0;
slouken@117
    39
	start = SDL_RWtell(src);
slouken@0
    40
	is_XXX = 0;
slouken@118
    41
slouken@118
    42
	/* Detect the image here */
slouken@118
    43
slouken@117
    44
	SDL_RWseek(src, start, SEEK_SET);
slouken@0
    45
	return(is_XXX);
slouken@0
    46
}
slouken@0
    47
slouken@0
    48
/* Load a XXX type image from an SDL datasource */
slouken@0
    49
SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
slouken@0
    50
{
slouken@118
    51
	int start;
slouken@118
    52
	const char *error = NULL;
slouken@118
    53
	SDL_Surface *surface = NULL;
slouken@118
    54
slouken@98
    55
	if ( !src ) {
slouken@98
    56
		/* The error message has been set in SDL_RWFromFile */
slouken@98
    57
		return NULL;
slouken@98
    58
	}
slouken@118
    59
	start = SDL_RWtell(src);
slouken@118
    60
slouken@118
    61
	/* Load the image here */
slouken@118
    62
slouken@118
    63
	if ( error ) {
slouken@118
    64
		SDL_RWseek(src, start, SEEK_SET);
slouken@118
    65
		if ( surface ) {
slouken@118
    66
			SDL_FreeSurface(surface);
slouken@118
    67
			surface = NULL;
slouken@118
    68
		}
slouken@118
    69
		IMG_SetError(error);
slouken@118
    70
	}
slouken@118
    71
	return surface;
slouken@0
    72
}
slouken@0
    73
slouken@0
    74
#else
slouken@0
    75
slouken@0
    76
/* See if an image is contained in a data source */
slouken@0
    77
int IMG_isXXX(SDL_RWops *src)
slouken@0
    78
{
slouken@0
    79
	return(0);
slouken@0
    80
}
slouken@0
    81
slouken@0
    82
/* Load a XXX type image from an SDL datasource */
slouken@0
    83
SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
slouken@0
    84
{
slouken@0
    85
	return(NULL);
slouken@0
    86
}
slouken@0
    87
slouken@0
    88
#endif /* LOAD_XXX */