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.

tga.h 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*!
  2. * \file include/utils/tga.h
  3. * \brief TGA image reader/writer
  4. *
  5. * \author Mongoose
  6. * \author xythobuz
  7. */
  8. #ifndef _UTILS_TGA_H
  9. #define _UTILS_TGA_H
  10. /*!
  11. * \brief Check if a file is a valid TGA image
  12. * \param filename path to file
  13. * \returns 0 if valid, else error condition
  14. */
  15. int tgaCheck(const char* filename);
  16. /*!
  17. * \brief Load a TGA image from file
  18. * \param filename path to file
  19. * \param image Where the pixmap will be stored (or nullptr)
  20. * \param width where the width will be stored
  21. * \param height where the height will be stored
  22. * \param type where the type will be stored (tga_type_t)
  23. * \returns 0 on success, else error condition
  24. */
  25. int tgaLoad(const char* filename, unsigned char** image,
  26. unsigned int* width, unsigned int* height, char* type);
  27. /*!
  28. * \brief Save a pixel buffer into a file on disk
  29. * \param filename path to file
  30. * \param image pixmap to be stored
  31. * \param width width of pixmap/image
  32. * \param height height of pixmap/image
  33. * \param type tga type to use
  34. * \returns 0 on success, else error condition
  35. */
  36. int tgaSave(const char* filename, unsigned char* image,
  37. unsigned int width, unsigned int height, char type);
  38. #endif