From 078b4e08fe3bccb7424dac76e158bf8bf48a182d Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Fri, 27 Jun 2025 17:58:36 +1200 Subject: feat: Made it so that you can now convert between image subclasses Also added the bitmap image subclass note: this is pretty hacky in how it works --- src/PNGImage.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/PNGImage.h') diff --git a/src/PNGImage.h b/src/PNGImage.h index 23c32a0..e937212 100644 --- a/src/PNGImage.h +++ b/src/PNGImage.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -13,15 +14,20 @@ #define REGISTER_CHUNK_READER(X) chunkReaders.insert({#X, &PNGImage::X}) #define DEFINE_CHUNK_READER(X) void PNGImage::X(uint32_t chunkSize) -class PNGImage : Image +class PNGImage : public Image { private: ZLibInflator zlib; uint8_t* idatData; unsigned long idatDataSize; public: - PNGImage(std::string filename); + PNGImage(); ~PNGImage(); + + template T> PNGImage(const T& other) : Image(other) { } + + int readFromFile(std::string filename) override; + int writeToFile(std::string filename) override; // sRGB uint8_t renderingIntent; @@ -56,5 +62,5 @@ private: bool end = false; - Reader reader; + Reader *reader; }; -- cgit v1.2.3