Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
BitmapDisplay.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <AH/STL/utility> // std::forward
7
9
16template <class Value_t = Interfaces::IValue &>
18 public:
20 const XBitmap &xbm, PixelLocation loc, uint16_t color)
21 : DisplayElement(display), value(std::forward<Value_t>(value)),
22 xbm(xbm), x(loc.x), y(loc.y), color(color) {}
23
24 void draw() override {
25 if (value.getValue())
26 display.drawXBitmap(x, y, xbm.bits, xbm.width, xbm.height, color);
27 value.clearDirty();
28 }
29
30 bool getDirty() const override { return value.getDirty(); }
31
32 private:
33 Value_t value;
34 const XBitmap &xbm;
35 int16_t x, y;
36 uint16_t color;
37};
38
39template <class Value_t = Interfaces::IValue>
40using NoteBitmapDisplay [[deprecated("Use BitmapDisplay instead")]] =
42
BitmapDisplay< Value_t > NoteBitmapDisplay
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A class that displays a bitmap depending on the state of a MIDINote or any other object that has a ge...
bool getDirty() const override
Check if this DisplayElement has to be re-drawn.
BitmapDisplay(DisplayInterface &display, Value_t &&value, const XBitmap &xbm, PixelLocation loc, uint16_t color)
void draw() override
Draw this DisplayElement to the display buffer.
DisplayElement(DisplayInterface &display)
Create a new DisplayElement.
DisplayInterface & display
An interface for displays.
A simple struct representing a pixel with integer coordinates.
Definition Def.hpp:64
A struct containing X Bitmap width, height and data.
Definition XBitmaps.hpp:18