summary refs log tree commit diff
path: root/src/GFX/Image/RawImage.hpp
blob: 5a95dad32f38541afaf040db06d6f527ab81a1ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include "../../Common/Sizes.hpp"
#include <string>
#include <vector>

namespace MC::GFX::Image {

class RawImage {
public:
    RawImage() : m_width(0), m_height(0) {}

    RawImage(U32 width, U32 height) : m_width(width), m_height(height) {
        m_pixels.reserve(width * height);
    }

    struct Pixel {
        U8 r, g, b, a;
    };

    void add(Pixel pixel);

    USize size() const;
    U8* raw() const;

    U32 width() const;
    U32 height() const;

    std::string string() const;
private:
    std::vector<Pixel> m_pixels;
    U32 m_width, m_height;
};

}