Control Surface stm32
MIDI Control Surface library for Arduino
DisplayInterface.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <Def/Def.hpp>
5#include <Print.h>
6
8
14class DisplayInterface : public Print {
15 protected:
16 DisplayInterface() = default;
17
18 public:
19 virtual ~DisplayInterface() = default;
20
22 virtual void begin();
23
25 virtual void clear() = 0;
27 virtual void drawBackground(){};
31 virtual void display() = 0;
32
34 virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
35
37 virtual void setTextColor(uint16_t color) = 0;
39 virtual void setTextSize(uint8_t size) = 0;
41 virtual void setCursor(int16_t x, int16_t y) = 0;
42
50 size_t write(uint8_t c) override = 0;
51
53 virtual void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
54 uint16_t color) = 0;
56 virtual void drawFastVLine(int16_t x, int16_t y, int16_t h,
57 uint16_t color) = 0;
59 virtual void drawFastHLine(int16_t x, int16_t y, int16_t w,
60 uint16_t color) = 0;
61
63 virtual void drawXBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
64 int16_t w, int16_t h, uint16_t color) = 0;
65
67 virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
68 uint16_t color);
69
71 virtual void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
72
74 virtual void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color);
75
82 clear();
84 }
85};
86
#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.