PNGReader.h 781 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef PNGREADER_H
  2. #define PNGREADER_H
  3. #include <png.h>
  4. #include "utils/Color.h"
  5. #include "utils/Error.h"
  6. class PNGReader final {
  7. const char* path;
  8. int width;
  9. int height;
  10. int channels;
  11. int bitDepth;
  12. int rowBytes;
  13. FILE* file;
  14. png_structp read;
  15. png_infop info;
  16. ColorChannel** rowPointers;
  17. public:
  18. PNGReader();
  19. ~PNGReader();
  20. PNGReader(const PNGReader& other) = delete;
  21. PNGReader(PNGReader&& other) = delete;
  22. PNGReader& operator=(const PNGReader& other) = delete;
  23. PNGReader& operator=(PNGReader&& other) = delete;
  24. Error load(const char* path);
  25. int getWidth() const;
  26. int getHeight() const;
  27. int getChannels() const;
  28. int getBufferSize() const;
  29. Error readData(ColorChannel* buffer);
  30. };
  31. #endif