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#ifdef __cplusplus
12extern "C" { /* This helps CPP projects that include this header */
13#endif
14
15/*
16 * Save an SDL_Surface as a PNG file.
17 *
18 * Returns 0 success or -1 on failure, the error message is then retrievable
19 * via SDL_GetError().
20 */
21#define SDL_SavePNG(surface, file) \
22 SDL_SavePNG_RW(surface, SDL_RWFromFile(file, "wb"), 1)
23
24/*
25 * Save an SDL_Surface as a PNG file, using writable RWops.
26 *
27 * surface - the SDL_Surface structure containing the image to be saved
28 * dst - a data stream to save to
29 * freedst - non-zero to close the stream after being written
30 *
31 * Returns 0 success or -1 on failure, the error message is then retrievable
32 * via SDL_GetError().
33 */
34extern int SDL_SavePNG_RW(SDL_Surface *surface, SDL_RWops *rw, int freedst);
35
36/*
37 * Return new SDL_Surface with a format suitable for PNG output.
38 */
39extern SDL_Surface *SDL_PNGFormatAlpha(SDL_Surface *src);
40
41#ifdef __cplusplus
42} /* extern "C" */
43#endif
44
45#endif
46