From 328e2464c81b0dfce623d4fbe9617ef79d6ed3c1 Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 7 Oct 2025 18:45:28 +1300 Subject: feat: Added cpp namespace All functions and classes are now behind the cpp namespace `TehImage` --- src/image.h | 61 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 28 deletions(-) (limited to 'src/image.h') 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 #include -struct Pixel +namespace TehImage { - uint8_t r, g, b, a; -}; -class Image -{ -protected: - std::unique_ptr pixels; - // uint8_t* imageData; - uint8_t colorValues; - uint8_t bpp; -public: - Image() = default; - - // template 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 pixels; + // uint8_t* imageData; + uint8_t colorValues; + uint8_t bpp; + public: + Image() = default; + + // template 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; + }; + +} -- cgit v1.2.3