diff options
| author | Mel <einebeere@gmail.com> | 2022-10-21 01:03:18 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-10-21 01:03:18 +0200 |
| commit | 6ed978051668c08f5a957c97570f364dd580c807 (patch) | |
| tree | e3db93c52fcd86e26bc859d46e755290d2a7f40c /src/GFX/Image/RawImage.hpp | |
| parent | 0464a83dfaebaa75d6e2d3b7431e84ebd83fccfd (diff) | |
| download | meowcraft-6ed978051668c08f5a957c97570f364dd580c807.tar.zst meowcraft-6ed978051668c08f5a957c97570f364dd580c807.zip | |
Namespace and Folder refactor
Diffstat (limited to 'src/GFX/Image/RawImage.hpp')
| -rw-r--r-- | src/GFX/Image/RawImage.hpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/GFX/Image/RawImage.hpp b/src/GFX/Image/RawImage.hpp new file mode 100644 index 0000000..916671b --- /dev/null +++ b/src/GFX/Image/RawImage.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include <cstdint> +#include <cstddef> +#include <vector> + +namespace MC::GFX::Image { + +class RawImage { +public: + RawImage() : m_pixels(), m_width(0), m_height(0), m_channels(0) {}; + + explicit RawImage(size_t pixel_count, uint32_t width, uint32_t height, uint8_t channels) + : m_pixels(), m_width(width), m_height(height), m_channels(channels) { + m_pixels.reserve(pixel_count); + } + + struct Pixel { + uint8_t r, g, b; + }; + + void add(Pixel pixel); + + size_t size() const; + uint8_t* raw() const; + + uint32_t width() const; + uint32_t height() const; + uint8_t channels() const; +private: + std::vector<Pixel> m_pixels; + + uint32_t m_width, m_height; + uint8_t m_channels; +}; + +} |
