SDL_image.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 10 May 2010 22:40:18 -0700
changeset 251 a6565b353095
parent 246 44389d6f0f65
child 262 87ec529fd6ce
permissions -rw-r--r--
Fixed decoding HAM6 image with masking
     1 /*
     2     SDL_image:  An example image loading library for use with SDL
     3     Copyright (C) 1997-2009 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 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     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /* A simple library to load images of various formats as SDL surfaces */
    24 
    25 #ifndef _SDL_IMAGE_H
    26 #define _SDL_IMAGE_H
    27 
    28 #include "SDL.h"
    29 #include "SDL_version.h"
    30 #include "begin_code.h"
    31 
    32 /* Set up for C function definitions, even when using C++ */
    33 #ifdef __cplusplus
    34 extern "C" {
    35 #endif
    36 
    37 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
    38 */
    39 #define SDL_IMAGE_MAJOR_VERSION	1
    40 #define SDL_IMAGE_MINOR_VERSION	2
    41 #define SDL_IMAGE_PATCHLEVEL	10
    42 
    43 /* This macro can be used to fill a version structure with the compile-time
    44  * version of the SDL_image library.
    45  */
    46 #define SDL_IMAGE_VERSION(X)						\
    47 {									\
    48 	(X)->major = SDL_IMAGE_MAJOR_VERSION;				\
    49 	(X)->minor = SDL_IMAGE_MINOR_VERSION;				\
    50 	(X)->patch = SDL_IMAGE_PATCHLEVEL;				\
    51 }
    52 
    53 /* This function gets the version of the dynamically linked SDL_image library.
    54    it should NOT be used to fill a version structure, instead you should
    55    use the SDL_IMAGE_VERSION() macro.
    56  */
    57 extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void);
    58 
    59 typedef enum
    60 {
    61     IMG_INIT_JPG = 0x00000001,
    62     IMG_INIT_PNG = 0x00000002,
    63     IMG_INIT_TIF = 0x00000004
    64 } IMG_InitFlags;
    65 
    66 /* Loads dynamic libraries and prepares them for use.  Flags should be
    67    one or more flags from IMG_InitFlags OR'd together.
    68    It returns the flags successfully initialized, or 0 on failure.
    69  */
    70 extern DECLSPEC int SDLCALL IMG_Init(int flags);
    71 
    72 /* Unloads libraries loaded with IMG_Init */
    73 extern DECLSPEC void SDLCALL IMG_Quit(void);
    74 
    75 /* Load an image from an SDL data source.
    76    The 'type' may be one of: "BMP", "GIF", "PNG", etc.
    77 
    78    If the image format supports a transparent pixel, SDL will set the
    79    colorkey for the surface.  You can enable RLE acceleration on the
    80    surface afterwards by calling:
    81 	SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
    82  */
    83 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, char *type);
    84 /* Convenience functions */
    85 extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
    86 extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc);
    87 
    88 /* Invert the alpha of a surface for use with OpenGL
    89    This function is now a no-op, and only provided for backwards compatibility.
    90 */
    91 extern DECLSPEC int SDLCALL IMG_InvertAlpha(int on);
    92 
    93 /* Functions to detect a file type, given a seekable source */
    94 extern DECLSPEC int SDLCALL IMG_isICO(SDL_RWops *src);
    95 extern DECLSPEC int SDLCALL IMG_isCUR(SDL_RWops *src);
    96 extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
    97 extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
    98 extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
    99 extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
   100 extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
   101 extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
   102 extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops *src);
   103 extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src);
   104 extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src);
   105 extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src);
   106 extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops *src);
   107 
   108 /* Individual loading functions */
   109 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadICO_RW(SDL_RWops *src);
   110 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadCUR_RW(SDL_RWops *src);
   111 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops *src);
   112 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops *src);
   113 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops *src);
   114 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops *src);
   115 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops *src);
   116 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src);
   117 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops *src);
   118 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops *src);
   119 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src);
   120 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src);
   121 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src);
   122 extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops *src);
   123 
   124 extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm);
   125 
   126 /* We'll use SDL for reporting errors */
   127 #define IMG_SetError	SDL_SetError
   128 #define IMG_GetError	SDL_GetError
   129 
   130 /* Ends C function definitions when using C++ */
   131 #ifdef __cplusplus
   132 }
   133 #endif
   134 #include "close_code.h"
   135 
   136 #endif /* _SDL_IMAGE_H */