Control Surface main
MIDI Control Surface library for Arduino
BitmapDisplay.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <AH/STL/utility> // std::forward
7
9
15template <class Value_t = Interfaces::IValue &>
17 public:
19 const XBitmap &xbm, PixelLocation loc, uint16_t color)
20 : DisplayElement(display), value(std::forward<Value_t>(value)),
21 xbm(xbm), x(loc.x), y(loc.y), color(color) {}
22
23 void draw() override {
24 if (value.getValue())
26 value.clearDirty();
27 }
28
29 bool getDirty() const override { return value.getDirty(); }
30
31 private:
32 Value_t value;
33 const XBitmap &xbm;
34 int16_t x, y;
35 uint16_t color;
36};
37
38template <class Value_t = Interfaces::IValue>
39using NoteBitmapDisplay [[deprecated("Use BitmapDisplay instead")]] =
41
A simple struct representing a pixel with integer coordinates.
Definition: Def.hpp:62
#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)
const XBitmap & xbm
void draw() override
Draw this DisplayElement to the display buffer.
An interface for elements that draw to a display.
DisplayInterface & display
An interface for displays.
virtual void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color)=0
Draw a bitmap to the display.
A struct containing X Bitmap width, height and data.
Definition: XBitmaps.hpp:12
const uint8_t * bits
Definition: XBitmaps.hpp:17
uint16_t height
Definition: XBitmaps.hpp:16
uint16_t width
Definition: XBitmaps.hpp:15