IMG_xxx.c
author Ozkan Sezer <sezeroz@gmail.com>
Thu, 18 Oct 2018 11:57:19 +0300
changeset 612 ca95d0e31aec
parent 575 36e9e2255178
child 638 e3e9d7430674
permissions -rw-r--r--
use less ancient versions of autofoo scripts
     1 /*
     2   SDL_image:  An example image loading library for use with SDL
     3   Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 /* This is a generic "format not supported" image framework */
    23 
    24 #include "SDL_image.h"
    25 
    26 #ifdef LOAD_XXX
    27 
    28 /* See if an image is contained in a data source */
    29 int IMG_isXXX(SDL_RWops *src)
    30 {
    31     int start;
    32     int is_XXX;
    33 
    34     if ( !src )
    35         return 0;
    36     start = SDL_RWtell(src);
    37     is_XXX = 0;
    38 
    39     /* Detect the image here */
    40 
    41     SDL_RWseek(src, start, RW_SEEK_SET);
    42     return(is_XXX);
    43 }
    44 
    45 /* Load a XXX type image from an SDL datasource */
    46 SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
    47 {
    48     int start;
    49     const char *error = NULL;
    50     SDL_Surface *surface = NULL;
    51 
    52     if ( !src ) {
    53         /* The error message has been set in SDL_RWFromFile */
    54         return NULL;
    55     }
    56     start = SDL_RWtell(src);
    57 
    58     /* Load the image here */
    59 
    60     if ( error ) {
    61         SDL_RWseek(src, start, RW_SEEK_SET);
    62         if ( surface ) {
    63             SDL_FreeSurface(surface);
    64             surface = NULL;
    65         }
    66         IMG_SetError("%s", error);
    67     }
    68     return surface;
    69 }
    70 
    71 #else
    72 
    73 /* See if an image is contained in a data source */
    74 int IMG_isXXX(SDL_RWops *src)
    75 {
    76     return(0);
    77 }
    78 
    79 /* Load a XXX type image from an SDL datasource */
    80 SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
    81 {
    82     return(NULL);
    83 }
    84 
    85 #endif /* LOAD_XXX */