IMG_xxx.c
author Sam Lantinga <slouken@libsdl.org>
Tue, 21 May 2013 21:24:32 -0700
changeset 368 8a61842d00ce
parent 347 ad5034cad524
child 465 e8573815cc1f
permissions -rw-r--r--
Cleaned up whitespace for the 2.0.0 release
slouken@0
     1
/*
slouken@280
     2
  SDL_image:  An example image loading library for use with SDL
slouken@347
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
slouken@0
     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@0
     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@0
    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@0
    20
*/
slouken@0
    21
slouken@0
    22
/* This is a generic "format not supported" image framework */
slouken@0
    23
slouken@0
    24
#include <stdio.h>
slouken@0
    25
slouken@0
    26
#include "SDL_image.h"
slouken@0
    27
slouken@0
    28
#ifdef LOAD_XXX
slouken@0
    29
slouken@0
    30
/* See if an image is contained in a data source */
slouken@0
    31
int IMG_isXXX(SDL_RWops *src)
slouken@0
    32
{
slouken@368
    33
    int start;
slouken@368
    34
    int is_XXX;
slouken@0
    35
slouken@368
    36
    if ( !src )
slouken@368
    37
        return 0;
slouken@368
    38
    start = SDL_RWtell(src);
slouken@368
    39
    is_XXX = 0;
slouken@118
    40
slouken@368
    41
    /* Detect the image here */
slouken@118
    42
slouken@368
    43
    SDL_RWseek(src, start, RW_SEEK_SET);
slouken@368
    44
    return(is_XXX);
slouken@0
    45
}
slouken@0
    46
slouken@0
    47
/* Load a XXX type image from an SDL datasource */
slouken@0
    48
SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
slouken@0
    49
{
slouken@368
    50
    int start;
slouken@368
    51
    const char *error = NULL;
slouken@368
    52
    SDL_Surface *surface = NULL;
slouken@118
    53
slouken@368
    54
    if ( !src ) {
slouken@368
    55
        /* The error message has been set in SDL_RWFromFile */
slouken@368
    56
        return NULL;
slouken@368
    57
    }
slouken@368
    58
    start = SDL_RWtell(src);
slouken@118
    59
slouken@368
    60
    /* Load the image here */
slouken@118
    61
slouken@368
    62
    if ( error ) {
slouken@368
    63
        SDL_RWseek(src, start, RW_SEEK_SET);
slouken@368
    64
        if ( surface ) {
slouken@368
    65
            SDL_FreeSurface(surface);
slouken@368
    66
            surface = NULL;
slouken@368
    67
        }
slouken@368
    68
        IMG_SetError(error);
slouken@368
    69
    }
slouken@368
    70
    return surface;
slouken@0
    71
}
slouken@0
    72
slouken@0
    73
#else
slouken@0
    74
slouken@0
    75
/* See if an image is contained in a data source */
slouken@0
    76
int IMG_isXXX(SDL_RWops *src)
slouken@0
    77
{
slouken@368
    78
    return(0);
slouken@0
    79
}
slouken@0
    80
slouken@0
    81
/* Load a XXX type image from an SDL datasource */
slouken@0
    82
SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
slouken@0
    83
{
slouken@368
    84
    return(NULL);
slouken@0
    85
}
slouken@0
    86
slouken@0
    87
#endif /* LOAD_XXX */