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