The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
savepng.h
Go to the documentation of this file.
1 #ifndef _SDL_SAVEPNG
2 #define _SDL_SAVEPNG
3 /*
4  * SDL_SavePNG -- libpng-based SDL_Surface writer.
5  *
6  * This code is free software, available under zlib/libpng license.
7  * http://www.libpng.org/pub/png/src/libpng-LICENSE.txt
8  */
9 #include <SDL_video.h>
10 /*
11  * Save an SDL_Surface as a PNG file.
12  *
13  * Returns 0 success or -1 on failure, the error message is then retrievable
14  * via SDL_GetError().
15  */
16 #define SDL_SavePNG(surface, file) \
17  SDL_SavePNG_RW(surface, SDL_RWFromFile(file, "wb"), 1)
18 //
19 //TODO: filesystem::load_RWops is only for reading, would like a writing version also
20 
21 /*
22  * Save an SDL_Surface as a PNG file, using writable RWops.
23  *
24  * surface - the SDL_Surface structure containing the image to be saved
25  * dst - a data stream to save to
26  * freedst - non-zero to close the stream after being written
27  *
28  * Returns 0 success or -1 on failure, the error message is then retrievable
29  * via SDL_GetError().
30  */
31 extern int SDL_SavePNG_RW(SDL_Surface *surface, SDL_RWops *rw, int freedst);
32 
33 /*
34  * Return new SDL_Surface with a format suitable for PNG output.
35  */
36 extern SDL_Surface *SDL_PNGFormatAlpha(SDL_Surface *src);
37 
38 #endif
GLenum src
Definition: glew.h:2392
int SDL_SavePNG_RW(SDL_Surface *surface, SDL_RWops *rw, int freedst)
Definition: savepng.cpp:65
SDL_Surface * SDL_PNGFormatAlpha(SDL_Surface *src)
Definition: savepng.cpp:44