26 lines
529 B
C++
26 lines
529 B
C++
#pragma once
|
|
|
|
namespace ui {
|
|
|
|
class Image
|
|
{
|
|
std::unique_ptr<uint8_t[]> m_data;
|
|
public:
|
|
int width = 0;
|
|
int height = 0;
|
|
int comp = 4;
|
|
bool load(std::string filename);
|
|
const uint8_t* data() const { return m_data.get(); }
|
|
int size() const { return width * height * comp; }
|
|
void create(int w, int h)
|
|
{
|
|
width = w;
|
|
height = h;
|
|
comp = 4;
|
|
m_data = std::make_unique<uint8_t[]>(size());
|
|
}
|
|
void create() { m_data = std::make_unique<uint8_t[]>(size()); }
|
|
};
|
|
|
|
}
|