PNGReader.h 800 B

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