SDL_image.h
author Sam Lantinga <slouken@lokigames.com>
Wed, 06 Dec 2000 18:00:38 +0000
changeset 11 b3d1b573a542
parent 7 e1b6443ffb6b
child 19 346fbadf38a3
permissions -rw-r--r--
Mattias Engdeg�rd - Wed Dec 6 10:00:07 PST 2000
* Improved the XPM loading code
slouken@0
     1
/*
slouken@0
     2
    IMGLIB:  An example image loading library for use with SDL
slouken@0
     3
    Copyright (C) 1999  Sam Lantinga
slouken@0
     4
slouken@0
     5
    This program is free software; you can redistribute it and/or modify
slouken@0
     6
    it under the terms of the GNU General Public License as published by
slouken@0
     7
    the Free Software Foundation; either version 2 of the License, or
slouken@0
     8
    (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This program 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
slouken@0
    13
    GNU General Public License for more details.
slouken@0
    14
slouken@0
    15
    You should have received a copy of the GNU General Public License
slouken@0
    16
    along with this program; if not, write to the Free Software
slouken@0
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@0
    20
    5635-34 Springhouse Dr.
slouken@0
    21
    Pleasanton, CA 94588 (USA)
slouken@0
    22
    slouken@devolution.com
slouken@0
    23
*/
slouken@0
    24
slouken@0
    25
/* A simple library to load images of various formats as SDL surfaces */
slouken@0
    26
slouken@0
    27
#ifndef _IMG_h
slouken@0
    28
#define _IMG_h
slouken@0
    29
slouken@0
    30
#include "SDL.h"
slouken@0
    31
#include "begin_code.h"
slouken@0
    32
slouken@0
    33
/* Set up for C function definitions, even when using C++ */
slouken@0
    34
#ifdef __cplusplus
slouken@0
    35
extern "C" {
slouken@0
    36
#endif
slouken@0
    37
slouken@0
    38
/* Load an image from an SDL data source.
slouken@0
    39
   The 'type' may be one of: "BMP", "GIF", "PNG", etc.
slouken@0
    40
slouken@0
    41
   If the image format supports a transparent pixel, SDL will set the
slouken@0
    42
   colorkey for the surface.  You can enable RLE acceleration on the
slouken@0
    43
   surface afterwards by calling:
slouken@0
    44
	SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
slouken@0
    45
 */
slouken@0
    46
extern DECLSPEC SDL_Surface *IMG_LoadTyped_RW(SDL_RWops *src, int freesrc,
slouken@0
    47
					      char *type);
slouken@0
    48
/* Convenience functions */
slouken@0
    49
extern DECLSPEC SDL_Surface *IMG_Load(const char *file);
slouken@0
    50
extern DECLSPEC SDL_Surface *IMG_Load_RW(SDL_RWops *src, int freesrc);
slouken@0
    51
slouken@0
    52
/* Invert the alpha of a surface for use with OpenGL
slouken@4
    53
   This function is now a no-op, and only provided for backwards compatibility.
slouken@4
    54
*/
slouken@0
    55
extern DECLSPEC int IMG_InvertAlpha(int on);
slouken@0
    56
slouken@0
    57
/* Functions to detect a file type, given a seekable source */
slouken@0
    58
extern DECLSPEC int IMG_isBMP(SDL_RWops *src);
slouken@0
    59
extern DECLSPEC int IMG_isPPM(SDL_RWops *src);
slouken@7
    60
extern DECLSPEC int IMG_isXPM(SDL_RWops *src);
slouken@0
    61
extern DECLSPEC int IMG_isPCX(SDL_RWops *src);
slouken@0
    62
extern DECLSPEC int IMG_isGIF(SDL_RWops *src);
slouken@0
    63
extern DECLSPEC int IMG_isJPG(SDL_RWops *src);
slouken@0
    64
extern DECLSPEC int IMG_isTIF(SDL_RWops *src);
slouken@0
    65
extern DECLSPEC int IMG_isPNG(SDL_RWops *src);
slouken@0
    66
slouken@0
    67
/* Individual loading functions */
slouken@0
    68
extern DECLSPEC SDL_Surface *IMG_LoadBMP_RW(SDL_RWops *src);
slouken@0
    69
extern DECLSPEC SDL_Surface *IMG_LoadPPM_RW(SDL_RWops *src);
slouken@7
    70
extern DECLSPEC SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src);
slouken@0
    71
extern DECLSPEC SDL_Surface *IMG_LoadPCX_RW(SDL_RWops *src);
slouken@0
    72
extern DECLSPEC SDL_Surface *IMG_LoadGIF_RW(SDL_RWops *src);
slouken@0
    73
extern DECLSPEC SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src);
slouken@0
    74
extern DECLSPEC SDL_Surface *IMG_LoadTIF_RW(SDL_RWops *src);
slouken@0
    75
extern DECLSPEC SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src);
slouken@0
    76
extern DECLSPEC SDL_Surface *IMG_LoadTGA_RW(SDL_RWops *src);
slouken@0
    77
slouken@0
    78
/* We'll use SDL for reporting errors */
slouken@0
    79
#define IMG_SetError	SDL_SetError
slouken@0
    80
#define IMG_GetError	SDL_GetError
slouken@0
    81
slouken@11
    82
/* used internally, NOT an exported function */
slouken@11
    83
extern DECLSPEC int IMG_string_equals(const char *str1, const char *str2);
slouken@11
    84
slouken@0
    85
/* Ends C function definitions when using C++ */
slouken@0
    86
#ifdef __cplusplus
slouken@0
    87
};
slouken@0
    88
#endif
slouken@0
    89
#include "close_code.h"
slouken@0
    90
slouken@0
    91
#endif /* _IMG_h */