esp32-sk6812/include/Bitmap.h

34 lines
542 B
C
Raw Normal View History

#pragma once
#include "Fader.h"
class Bitmap
{
public:
std::vector<Fader::Color> m_pixdata;
uint32_t width;
uint32_t height;
Bitmap(uint32_t w, uint32_t h)
: m_pixdata(w * h, Fader::Color{0, 0, 0, 0}),
width(w),
height(h)
{
}
Bitmap() : Bitmap(0, 0) {}
Fader::Color &pixel(uint32_t x, uint32_t y)
{
return m_pixdata[idx(x, y)];
}
uint32_t idx(uint32_t x, uint32_t y)
{
return x * height + y;
}
void resize(uint32_t w, uint32_t h);
};