Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

png.h 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*!
  2. * \file include/utils/png.h
  3. * \brief PNG image reader
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _UTILS_PNG_H_
  8. #define _UTILS_PNG_H_
  9. #include "TextureManager.h"
  10. /*!
  11. * \brief Check if a file is a valid PNG image
  12. * \param filename path of file to read
  13. * \returns 0 on success
  14. */
  15. int pngCheck(const char* filename);
  16. /*!
  17. * \brief Load a PNG image file into an RGBA buffer
  18. * \param filename path of file to read
  19. * \param image place where allocated buffer of size (width * height * 4) will be allocated
  20. * \param width place where image width will be stored
  21. * \param height place where image height will be stored
  22. * \param mode place where Color Mode of image will be stored
  23. * \param bpp place where pixel width will be stored (8, 24, 32)
  24. * \returns 0 on success
  25. */
  26. int pngLoad(const char* filename, unsigned char** image,
  27. unsigned int* width, unsigned int* height,
  28. TextureManager::ColorMode* mode, unsigned int* bpp);
  29. /*!
  30. * \brief Create a PNG image file from an RGBA buffer
  31. * \param filename path of file to create
  32. * \param image buffer of size (width * height * 4)
  33. * \param width image width
  34. * \param height image height
  35. * \param mode color mode
  36. * \param bpp bits per pixel (8, 24, 32)
  37. * \returns 0 on success
  38. */
  39. int pngSave(const char* filename, unsigned char* image,
  40. unsigned int width, unsigned int height,
  41. TextureManager::ColorMode mode, unsigned int bpp);
  42. #endif