savepng.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #ifdef __cplusplus
  11. extern "C" { /* This helps CPP projects that include this header */
  12. #endif
  13. /*
  14. * Save an SDL_Surface as a PNG file.
  15. *
  16. * Returns 0 success or -1 on failure, the error message is then retrievable
  17. * via SDL_GetError().
  18. */
  19. #define SDL_SavePNG(surface, file) \
  20. SDL_SavePNG_RW(surface, SDL_RWFromFile(file, "wb"), 1)
  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. * Return new SDL_Surface with a format suitable for PNG output.
  34. */
  35. extern SDL_Surface *SDL_PNGFormatAlpha(SDL_Surface *src);
  36. #ifdef __cplusplus
  37. } /* extern "C" */
  38. #endif
  39. #endif