diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2026-01-02 22:42:31 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2026-01-02 22:42:31 +0100 |
| commit | 6ed8f5151719fbc14ec0ac6d28a346d1f74cf2ca (patch) | |
| tree | ebe7588e89e1aa2ae5376acf85f3a3a7b2ec7e10 /src/image.hh | |
Diffstat (limited to 'src/image.hh')
| -rw-r--r-- | src/image.hh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/image.hh b/src/image.hh new file mode 100644 index 0000000..8191393 --- /dev/null +++ b/src/image.hh @@ -0,0 +1,62 @@ +#ifndef IMAGE_HH +#define IMAGE_HH + +#include "size.hh" + +#include <cstddef> +#include <cstdint> +#include <memory> + +class Image { + public: + enum class Format : uint8_t { + RGBA_8888, + ARGB_8888, + BGRA_8888, + ABGR_8888, + }; + + [[nodiscard]] + Size const& size() const { + return size_; + } + + [[nodiscard]] + uint32_t width() const { + return size_.width; + } + + [[nodiscard]] + uint32_t height() const { + return size_.height; + } + + [[nodiscard]] + Format format() const { + return format_; + } + + [[nodiscard]] + size_t scanline() const { + return scanline_; + } + + [[nodiscard]] + uint8_t const* data() const { + return pixels_.get(); + } + + Image(Format format, Size size, size_t scanline, + std::unique_ptr<uint8_t[]> pixels); + + private: + Image(Image const&) = delete; + Image& operator=(Image const&) = delete; + + Format const format_; + Size const size_; + size_t const scanline_; + std::unique_ptr<uint8_t[]> pixels_; +}; + +#endif // IMAGE_HH |
