aboutsummaryrefslogtreecommitdiff
path: root/src/PNGImage.h
diff options
context:
space:
mode:
authorBossCode45 <boss@tehbox.org>2025-06-27 17:58:36 +1200
committerBossCode45 <boss@tehbox.org>2025-07-24 12:48:21 +1200
commit078b4e08fe3bccb7424dac76e158bf8bf48a182d (patch)
treea4f84f3fc346053c1c41990be4cc0867ab206cf5 /src/PNGImage.h
parenteed164fa72297efb69b624f3c58cb5deb339a974 (diff)
downloadtehimage-078b4e08fe3bccb7424dac76e158bf8bf48a182d.tar.gz
tehimage-078b4e08fe3bccb7424dac76e158bf8bf48a182d.zip
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
Diffstat (limited to 'src/PNGImage.h')
-rw-r--r--src/PNGImage.h12
1 files changed, 9 insertions, 3 deletions
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 <cstddef>
#include <cstdint>
#include <map>
+#include <memory>
#include <string>
#include <vector>
@@ -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<std::derived_from<Image> 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;
};