Skip to content

Latest commit

 

History

History
161 lines (136 loc) · 6.66 KB

SDL_image.h

File metadata and controls

161 lines (136 loc) · 6.66 KB
 
Aug 10, 2000
Aug 10, 2000
1
/*
Dec 31, 2011
Dec 31, 2011
2
SDL_image: An example image loading library for use with SDL
Mar 1, 2018
Mar 1, 2018
3
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
Dec 31, 2011
Dec 31, 2011
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Aug 10, 2000
Aug 10, 2000
20
21
22
23
*/
/* A simple library to load images of various formats as SDL surfaces */
Dec 2, 2016
Dec 2, 2016
24
25
#ifndef SDL_IMAGE_H_
#define SDL_IMAGE_H_
Aug 10, 2000
Aug 10, 2000
26
27
#include "SDL.h"
Jul 23, 2003
Jul 23, 2003
28
#include "SDL_version.h"
Aug 10, 2000
Aug 10, 2000
29
30
31
32
33
34
35
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
Jul 23, 2003
Jul 23, 2003
36
37
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
May 22, 2013
May 22, 2013
38
39
#define SDL_IMAGE_MAJOR_VERSION 2
#define SDL_IMAGE_MINOR_VERSION 0
Jan 29, 2018
Jan 29, 2018
40
#define SDL_IMAGE_PATCHLEVEL 3
Jul 23, 2003
Jul 23, 2003
41
42
43
44
/* This macro can be used to fill a version structure with the compile-time
* version of the SDL_image library.
*/
May 22, 2013
May 22, 2013
45
46
47
48
49
#define SDL_IMAGE_VERSION(X) \
{ \
(X)->major = SDL_IMAGE_MAJOR_VERSION; \
(X)->minor = SDL_IMAGE_MINOR_VERSION; \
(X)->patch = SDL_IMAGE_PATCHLEVEL; \
Jul 23, 2003
Jul 23, 2003
50
51
}
Oct 21, 2017
Oct 21, 2017
52
53
54
55
56
57
58
59
60
61
62
63
/**
* This is the version number macro for the current SDL_image version.
*/
#define SDL_IMAGE_COMPILEDVERSION \
SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_PATCHLEVEL)
/**
* This macro will evaluate to true if compiled with SDL_image at least X.Y.Z.
*/
#define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \
(SDL_IMAGE_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
Jul 23, 2003
Jul 23, 2003
64
65
66
67
68
69
/* This function gets the version of the dynamically linked SDL_image library.
it should NOT be used to fill a version structure, instead you should
use the SDL_IMAGE_VERSION() macro.
*/
extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void);
Sep 26, 2009
Sep 26, 2009
70
71
72
73
typedef enum
{
IMG_INIT_JPG = 0x00000001,
IMG_INIT_PNG = 0x00000002,
Dec 30, 2011
Dec 30, 2011
74
75
IMG_INIT_TIF = 0x00000004,
IMG_INIT_WEBP = 0x00000008
Sep 26, 2009
Sep 26, 2009
76
77
78
} IMG_InitFlags;
/* Loads dynamic libraries and prepares them for use. Flags should be
Nov 8, 2009
Nov 8, 2009
79
80
81
one or more flags from IMG_InitFlags OR'd together.
It returns the flags successfully initialized, or 0 on failure.
*/
Sep 26, 2009
Sep 26, 2009
82
83
84
extern DECLSPEC int SDLCALL IMG_Init(int flags);
/* Unloads libraries loaded with IMG_Init */
Nov 15, 2009
Nov 15, 2009
85
extern DECLSPEC void SDLCALL IMG_Quit(void);
Sep 26, 2009
Sep 26, 2009
86
Aug 10, 2000
Aug 10, 2000
87
88
89
90
91
92
/* Load an image from an SDL data source.
The 'type' may be one of: "BMP", "GIF", "PNG", etc.
If the image format supports a transparent pixel, SDL will set the
colorkey for the surface. You can enable RLE acceleration on the
surface afterwards by calling:
May 22, 2013
May 22, 2013
93
SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
Aug 10, 2000
Aug 10, 2000
94
*/
Jan 23, 2012
Jan 23, 2012
95
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, const char *type);
Aug 10, 2000
Aug 10, 2000
96
/* Convenience functions */
Apr 13, 2002
Apr 13, 2002
97
98
extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc);
Aug 10, 2000
Aug 10, 2000
99
Jun 3, 2013
Jun 3, 2013
100
#if SDL_VERSION_ATLEAST(2,0,0)
Jan 23, 2012
Jan 23, 2012
101
102
103
104
105
/* Load an image directly into a render texture.
*/
extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer, const char *file);
extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc);
extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc, const char *type);
Jun 3, 2013
Jun 3, 2013
106
#endif /* SDL 2.0 */
Jan 23, 2012
Jan 23, 2012
107
Aug 10, 2000
Aug 10, 2000
108
/* Functions to detect a file type, given a seekable source */
Jan 13, 2009
Jan 13, 2009
109
110
extern DECLSPEC int SDLCALL IMG_isICO(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isCUR(SDL_RWops *src);
Apr 13, 2002
Apr 13, 2002
111
112
113
114
extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
Feb 4, 2006
Feb 4, 2006
115
116
117
extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops *src);
Oct 22, 2017
Oct 22, 2017
118
extern DECLSPEC int SDLCALL IMG_isSVG(SDL_RWops *src);
Feb 4, 2006
Feb 4, 2006
119
120
121
122
extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src);
extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops *src);
Dec 30, 2011
Dec 30, 2011
123
extern DECLSPEC int SDLCALL IMG_isWEBP(SDL_RWops *src);
Aug 10, 2000
Aug 10, 2000
124
125
/* Individual loading functions */
Jan 13, 2009
Jan 13, 2009
126
127
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadICO_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadCUR_RW(SDL_RWops *src);
Apr 13, 2002
Apr 13, 2002
128
129
130
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops *src);
Feb 4, 2006
Feb 4, 2006
131
132
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops *src);
Apr 13, 2002
Apr 13, 2002
133
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src);
Feb 4, 2006
Feb 4, 2006
134
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops *src);
Oct 22, 2017
Oct 22, 2017
135
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadSVG_RW(SDL_RWops *src);
Apr 13, 2002
Apr 13, 2002
136
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops *src);
Feb 4, 2006
Feb 4, 2006
137
138
139
140
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src);
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops *src);
Dec 30, 2011
Dec 30, 2011
141
extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadWEBP_RW(SDL_RWops *src);
Apr 13, 2002
Apr 13, 2002
142
143
extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm);
Apr 28, 2001
Apr 28, 2001
144
Jun 3, 2013
Jun 3, 2013
145
146
147
/* Individual saving functions */
extern DECLSPEC int SDLCALL IMG_SavePNG(SDL_Surface *surface, const char *file);
extern DECLSPEC int SDLCALL IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst);
Sep 12, 2017
Sep 12, 2017
148
149
extern DECLSPEC int SDLCALL IMG_SaveJPG(SDL_Surface *surface, const char *file, int quality);
extern DECLSPEC int SDLCALL IMG_SaveJPG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst, int quality);
Jun 3, 2013
Jun 3, 2013
150
Aug 10, 2000
Aug 10, 2000
151
/* We'll use SDL for reporting errors */
May 22, 2013
May 22, 2013
152
153
#define IMG_SetError SDL_SetError
#define IMG_GetError SDL_GetError
Aug 10, 2000
Aug 10, 2000
154
155
156
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
Feb 17, 2001
Feb 17, 2001
157
}
Aug 10, 2000
Aug 10, 2000
158
159
160
#endif
#include "close_code.h"
Dec 2, 2016
Dec 2, 2016
161
#endif /* SDL_IMAGE_H_ */