SDL_image.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 04 Jan 2004 17:41:55 +0000
changeset 97 e1161bd417c4
parent 92 907eda08da0a
child 106 65e8cd587119
permissions -rw-r--r--
Updated copyright information for 2004 (Happy New Year!)
     1 /*
     2     SDL_image:  An example image loading library for use with SDL
     3     Copyright (C) 1999-2004 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Library General Public
     7     License as published by the Free Software Foundation; either
     8     version 2 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     Library General Public License for more details.
    14 
    15     You should have received a copy of the GNU Library General Public
    16     License along with this library; if not, write to the Free
    17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /* $Id$ */
    24 
    25 /* A simple library to load images of various formats as SDL surfaces */
    26 
    27 #ifndef _SDL_IMAGE_H
    28 #define _SDL_IMAGE_H
    29 
    30 #include "SDL.h"
    31 #include "SDL_version.h"
    32 #include "begin_code.h"
    33 
    34 /* Set up for C function definitions, even when using C++ */
    35 #ifdef __cplusplus
    36 extern "C" {
    37 #endif
    38 
    39 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
    40 */
    41 #define SDL_IMAGE_MAJOR_VERSION	1
    42 #define SDL_IMAGE_MINOR_VERSION	2
    43 #define SDL_IMAGE_PATCHLEVEL	4
    44 
    45 /* This macro can be used to fill a version structure with the compile-time
    46  * version of the SDL_image library.
    47  */
    48 #define SDL_IMAGE_VERSION(X)						\
    49 {									\
    50 	(X)->major = SDL_IMAGE_MAJOR_VERSION;				\
    51 	(X)->minor = SDL_IMAGE_MINOR_VERSION;				\
    52 	(X)->patch = SDL_IMAGE_PATCHLEVEL;				\
    53 }
    54 
    55 /* This function gets the version of the dynamically linked SDL_image library.
    56    it should NOT be used to fill a version structure, instead you should
    57    use the SDL_IMAGE_VERSION() macro.
    58  */
    59 extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void);
    60 
    61 /* Load an image from an SDL data source.
    62    The 'type' may be one of: "BMP", "GIF", "PNG", etc.
    63 
    64    If the image format supports a transparent pixel, SDL will set the
    65    colorkey for the surface.  You can enable RLE acceleration on the
    66    surface afterwards by calling:
    67 	SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
    68  */
    69 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type);
    70 /* Convenience functions */
    71 extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
    72 extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc);
    73 
    74 /* Invert the alpha of a surface for use with OpenGL
    75    This function is now a no-op, and only provided for backwards compatibility.
    76 */
    77 extern DECLSPEC int SDLCALL IMG_InvertAlpha(int on);
    78 
    79 /* Functions to detect a file type, given a seekable source */
    80 extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
    81 extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops *src);
    82 extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src);
    83 extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src);
    84 extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
    85 extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
    86 extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
    87 extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src);
    88 extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
    89 extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
    90 
    91 /* Individual loading functions */
    92 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops *src);
    93 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops *src);
    94 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src);
    95 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src);
    96 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops *src);
    97 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops *src);
    98 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops *src);
    99 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src);
   100 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src);
   101 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops *src);
   102 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops *src);
   103 
   104 extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm);
   105 
   106 /* We'll use SDL for reporting errors */
   107 #define IMG_SetError	SDL_SetError
   108 #define IMG_GetError	SDL_GetError
   109 
   110 /* Ends C function definitions when using C++ */
   111 #ifdef __cplusplus
   112 }
   113 #endif
   114 #include "close_code.h"
   115 
   116 #endif /* _SDL_IMAGE_H */