summaryrefslogtreecommitdiff
path: root/src/image.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/image.hh')
-rw-r--r--src/image.hh62
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