esp32-sk6812/include/Bitmap.h
Thomas Kolb d5357b2021 Show IP address on startup
To accomplish this, the following changes were made:

- Added an image-scrolling animation
- Implemented a bitmap font engine to generate an image from text
- On startup, an image-scrolling animation is set up with an image
  generated from the local IP address
2019-12-23 19:56:33 +01:00

34 lines
542 B
C++

#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);
};