Open Source Tomb Raider Engine
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

png.h 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. /*!
  10. * \brief Check if a file is a valid PNG image
  11. * \param filename path of file to read
  12. * \returns 0 on success
  13. */
  14. int pngCheck(const char *filename);
  15. /*!
  16. * \brief Load a PNG image file into an RGBA buffer
  17. * \param filename path of file to read
  18. * \param image place where allocated buffer of size (width * height * 4) will be allocated
  19. * \param width place where image width will be stored
  20. * \param height place where image height will be stored
  21. * \param mode place where Color Mode of image will be stored
  22. * \param bpp place where pixel width will be stored (8, 24, 32)
  23. * \returns 0 on success
  24. */
  25. int pngLoad(const char *filename, unsigned char **image,
  26. unsigned int *width, unsigned int *height, ColorMode *mode, unsigned int *bpp);
  27. /*!
  28. * \brief Create a PNG image file from an RGBA buffer
  29. * \param filename path of file to create
  30. * \param image buffer of size (width * height * 4)
  31. * \param width image width
  32. * \param height image height
  33. * \param mode color mode
  34. * \param bpp bits per pixel (8, 24, 32)
  35. * \returns 0 on success
  36. */
  37. int pngSave(const char *filename, unsigned char *image,
  38. unsigned int width, unsigned int height, ColorMode mode, unsigned int bpp);
  39. #endif