From 6ed8f5151719fbc14ec0ac6d28a346d1f74cf2ca Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Fri, 2 Jan 2026 22:42:31 +0100 Subject: Initial commit --- src/image.hh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/image.hh (limited to 'src/image.hh') 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 +#include +#include + +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 pixels); + + private: + Image(Image const&) = delete; + Image& operator=(Image const&) = delete; + + Format const format_; + Size const size_; + size_t const scanline_; + std::unique_ptr pixels_; +}; + +#endif // IMAGE_HH -- cgit v1.2.3-70-g09d2