Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
DisplayInterface.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <Def/Def.hpp>
5#include <Print.h>
6
8
16class DisplayInterface : public Print {
17 protected:
18 DisplayInterface() = default;
19
20 public:
21 virtual ~DisplayInterface() = default;
22
24 virtual void begin();
25
27 virtual void clear() = 0;
29 virtual void drawBackground() {}
33 virtual void display() = 0;
34
36 virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
37
39 virtual void setTextColor(uint16_t color) = 0;
41 virtual void setTextSize(uint8_t size) = 0;
43 virtual void setCursor(int16_t x, int16_t y) = 0;
44
52 size_t write(uint8_t c) override = 0;
53
55 virtual void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
56 uint16_t color) = 0;
58 virtual void drawFastVLine(int16_t x, int16_t y, int16_t h,
59 uint16_t color) = 0;
61 virtual void drawFastHLine(int16_t x, int16_t y, int16_t w,
62 uint16_t color) = 0;
63
65 virtual void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
66 int16_t w, int16_t h, uint16_t color) = 0;
67
69 virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
70 uint16_t color);
71
73 virtual void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
74
76 virtual void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
77
84 clear();
86 }
87};
88
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
An interface for displays.
virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)=0
Draw a horizontal line.
virtual void drawPixel(int16_t x, int16_t y, uint16_t color)=0
Paint a single pixel with the given color.
virtual void setTextColor(uint16_t color)=0
Set the text color.
void clearAndDrawBackground()
Clear the frame buffer, and draw the custom background.
virtual void setCursor(int16_t x, int16_t y)=0
Set the cursor position.
virtual void clear()=0
Clear the frame buffer or clear the display.
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.
virtual void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
Draw a disk (filled circle).
virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Draw a filled rectangle.
virtual void display()=0
Write the frame buffer to the display.
DisplayInterface()=default
virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)=0
Draw a vertical line.
size_t write(uint8_t c) override=0
Write a character to the display.
virtual void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)=0
Draw a line between two points.
virtual void begin()
Initialize the display.
virtual void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color)
Draw a circle.
virtual ~DisplayInterface()=default
virtual void setTextSize(uint8_t size)=0
Set the text size.
virtual void drawBackground()
Draw a custom background.