diff options
| author | Dylan <boss@tehbox.org> | 2025-10-07 18:45:28 +1300 |
|---|---|---|
| committer | Dylan <boss@tehbox.org> | 2025-10-07 19:31:32 +1300 |
| commit | 328e2464c81b0dfce623d4fbe9617ef79d6ed3c1 (patch) | |
| tree | ecccb3c6583640af4792efa93ff280f17b4f707a /src/PNGImage.h | |
| parent | 308b65134bd9d185741a612bfad3cca80ddddc48 (diff) | |
| download | tehimage-328e2464c81b0dfce623d4fbe9617ef79d6ed3c1.tar.gz tehimage-328e2464c81b0dfce623d4fbe9617ef79d6ed3c1.zip | |
feat: Added cpp namespacev0.0.2
All functions and classes are now behind the cpp namespace `TehImage`
Diffstat (limited to 'src/PNGImage.h')
| -rw-r--r-- | src/PNGImage.h | 87 |
1 files changed, 46 insertions, 41 deletions
diff --git a/src/PNGImage.h b/src/PNGImage.h index 31ed429..3c1bf1f 100644 --- a/src/PNGImage.h +++ b/src/PNGImage.h @@ -14,54 +14,59 @@ #define REGISTER_CHUNK_READER(X) chunkReaders.insert({#X, &PNGImage::X}) #define DEFINE_CHUNK_READER(X) void PNGImage::X(uint32_t chunkSize) -class PNGImage : public Image +namespace TehImage { -private: - ZLibInflator zlib; - uint8_t* idatData; - unsigned long idatDataSize; -public: - PNGImage(); - ~PNGImage(); - // template<std::derived_from<Image> T> PNGImage(const T& other) : Image(other) { } - PNGImage(const Image& other) : Image(other) {} + class PNGImage : public Image + { + private: + ZLibInflator zlib; + uint8_t* idatData; + unsigned long idatDataSize; + public: + PNGImage(); + ~PNGImage(); - int readFromFile(std::string filename) override; - int writeToFile(std::string filename) override; + // template<std::derived_from<Image> T> PNGImage(const T& other) : Image(other) { } + PNGImage(const Image& other) : Image(other) {} + + int readFromFile(std::string filename) override; + int writeToFile(std::string filename) override; - // sRGB - uint8_t renderingIntent; + // sRGB + uint8_t renderingIntent; - // pHYs - uint32_t pixelsPerX; - uint32_t pixelsPerY; - uint8_t unit; + // pHYs + uint32_t pixelsPerX; + uint32_t pixelsPerY; + uint8_t unit; - // tIME - uint16_t year; - uint8_t month; - uint8_t day; - uint8_t hour; - uint8_t minute; - uint8_t second; + // tIME + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hour; + uint8_t minute; + uint8_t second; - bool readNextChunk(); + bool readNextChunk(); -private: - std::map<std::string, void(PNGImage::*)(uint32_t chunkSize)> chunkReaders; - CHUNK_READER(IHDR); - CHUNK_READER(iCCP); - CHUNK_READER(sRGB); - CHUNK_READER(eXIf); - CHUNK_READER(iDOT); - CHUNK_READER(pHYs); - CHUNK_READER(tIME); - CHUNK_READER(tEXt); - CHUNK_READER(IDAT); - CHUNK_READER(IEND); + private: + std::map<std::string, void(PNGImage::*)(uint32_t chunkSize)> chunkReaders; + CHUNK_READER(IHDR); + CHUNK_READER(iCCP); + CHUNK_READER(sRGB); + CHUNK_READER(eXIf); + CHUNK_READER(iDOT); + CHUNK_READER(pHYs); + CHUNK_READER(tIME); + CHUNK_READER(tEXt); + CHUNK_READER(IDAT); + CHUNK_READER(IEND); + + bool end = false; - bool end = false; + Reader *reader; + }; - Reader *reader; -}; +} |
