SDL_image.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 08 Dec 2008 00:27:32 +0000
changeset 186 5fbbeabf647f
parent 181 9ed028587fd1
child 189 39d5ac4ec0f8
permissions -rw-r--r--
Updated copyright date
slouken@0
     1
/*
slouken@52
     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@52
     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@52
     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@52
    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@52
    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@52
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@0
    22
slouken@0
    23
/* A simple library to load images of various formats as SDL surfaces */
slouken@0
    24
slouken@90
    25
#ifndef _SDL_IMAGE_H
slouken@90
    26
#define _SDL_IMAGE_H
slouken@0
    27
slouken@0
    28
#include "SDL.h"
slouken@89
    29
#include "SDL_version.h"
slouken@0
    30
#include "begin_code.h"
slouken@0
    31
slouken@0
    32
/* Set up for C function definitions, even when using C++ */
slouken@0
    33
#ifdef __cplusplus
slouken@0
    34
extern "C" {
slouken@0
    35
#endif
slouken@0
    36
slouken@89
    37
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
slouken@89
    38
*/
slouken@89
    39
#define SDL_IMAGE_MAJOR_VERSION	1
slouken@89
    40
#define SDL_IMAGE_MINOR_VERSION	2
slouken@181
    41
#define SDL_IMAGE_PATCHLEVEL	7
slouken@89
    42
slouken@89
    43
/* This macro can be used to fill a version structure with the compile-time
slouken@89
    44
 * version of the SDL_image library.
slouken@89
    45
 */
slouken@89
    46
#define SDL_IMAGE_VERSION(X)						\
slouken@89
    47
{									\
slouken@89
    48
	(X)->major = SDL_IMAGE_MAJOR_VERSION;				\
slouken@89
    49
	(X)->minor = SDL_IMAGE_MINOR_VERSION;				\
slouken@89
    50
	(X)->patch = SDL_IMAGE_PATCHLEVEL;				\
slouken@89
    51
}
slouken@89
    52
slouken@89
    53
/* This function gets the version of the dynamically linked SDL_image library.
slouken@89
    54
   it should NOT be used to fill a version structure, instead you should
slouken@89
    55
   use the SDL_IMAGE_VERSION() macro.
slouken@89
    56
 */
slouken@89
    57
extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void);
slouken@89
    58
slouken@0
    59
/* Load an image from an SDL data source.
slouken@0
    60
   The 'type' may be one of: "BMP", "GIF", "PNG", etc.
slouken@0
    61
slouken@0
    62
   If the image format supports a transparent pixel, SDL will set the
slouken@0
    63
   colorkey for the surface.  You can enable RLE acceleration on the
slouken@0
    64
   surface afterwards by calling:
slouken@0
    65
	SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
slouken@0
    66
 */
slouken@64
    67
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type);
slouken@0
    68
/* Convenience functions */
slouken@64
    69
extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
slouken@64
    70
extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc);
slouken@0
    71
slouken@0
    72
/* Invert the alpha of a surface for use with OpenGL
slouken@4
    73
   This function is now a no-op, and only provided for backwards compatibility.
slouken@4
    74
*/
slouken@64
    75
extern DECLSPEC int SDLCALL IMG_InvertAlpha(int on);
slouken@0
    76
slouken@0
    77
/* Functions to detect a file type, given a seekable source */
slouken@64
    78
extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
slouken@64
    79
extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
slouken@64
    80
extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
slouken@119
    81
extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
slouken@119
    82
extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
slouken@119
    83
extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
slouken@119
    84
extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops *src);
slouken@64
    85
extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src);
slouken@119
    86
extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src);
slouken@119
    87
extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src);
slouken@119
    88
extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops *src);
slouken@0
    89
slouken@0
    90
/* Individual loading functions */
slouken@64
    91
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops *src);
slouken@64
    92
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops *src);
slouken@64
    93
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops *src);
slouken@119
    94
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops *src);
slouken@119
    95
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops *src);
slouken@119
    96
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src);
slouken@119
    97
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops *src);
slouken@119
    98
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops *src);
slouken@64
    99
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src);
slouken@119
   100
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src);
slouken@119
   101
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src);
slouken@119
   102
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops *src);
slouken@0
   103
slouken@64
   104
extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm);
slouken@35
   105
slouken@0
   106
/* We'll use SDL for reporting errors */
slouken@0
   107
#define IMG_SetError	SDL_SetError
slouken@0
   108
#define IMG_GetError	SDL_GetError
slouken@0
   109
slouken@0
   110
/* Ends C function definitions when using C++ */
slouken@0
   111
#ifdef __cplusplus
slouken@19
   112
}
slouken@0
   113
#endif
slouken@0
   114
#include "close_code.h"
slouken@0
   115
slouken@90
   116
#endif /* _SDL_IMAGE_H */