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