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/image.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/image.h')
| -rw-r--r-- | src/image.h | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/src/image.h b/src/image.h index 7a7ba31..d6fec04 100644 --- a/src/image.h +++ b/src/image.h @@ -5,34 +5,39 @@ #include <memory> #include <string> -struct Pixel +namespace TehImage { - uint8_t r, g, b, a; -}; -class Image -{ -protected: - std::unique_ptr<Pixel[]> pixels; - // uint8_t* imageData; - uint8_t colorValues; - uint8_t bpp; -public: - Image() = default; - - // template<std::derived_from<Image> T> - Image(const Image& other); - - virtual int readFromFile(std::string filename) = 0; - virtual int writeToFile(std::string filename) = 0; + struct Pixel + { + uint8_t r, g, b, a; + }; + + class Image + { + protected: + std::unique_ptr<Pixel[]> pixels; + // uint8_t* imageData; + uint8_t colorValues; + uint8_t bpp; + public: + Image() = default; + + // template<std::derived_from<Image> T> + Image(const Image& other); + + virtual int readFromFile(std::string filename) = 0; + virtual int writeToFile(std::string filename) = 0; - Pixel& operator[](int x, int y); - - uint32_t width = 0; - uint32_t height = 0; - uint8_t bitDepth; - uint8_t colorType; - uint8_t compressionMethod; - uint8_t filterMethod; - uint8_t interlaceMethod; -}; + Pixel& operator[](int x, int y); + + uint32_t width = 0; + uint32_t height = 0; + uint8_t bitDepth; + uint8_t colorType; + uint8_t compressionMethod; + uint8_t filterMethod; + uint8_t interlaceMethod; + }; + +} |
