77 lines
2.7 KiB
C++
77 lines
2.7 KiB
C++
|
|
#ifndef ESP32DISPLAYTEST_EXTENDEDSCREEN_H
|
|
#define ESP32DISPLAYTEST_EXTENDEDSCREEN_H
|
|
|
|
|
|
#include "Adafruit_GFX.h"
|
|
#include "colors.h"
|
|
#include "bitmap.h"
|
|
|
|
#include <cstdint>
|
|
|
|
class ExtendedScreen : public Adafruit_GFX {
|
|
private:
|
|
Adafruit_GFX *_screen;
|
|
|
|
void drawPixel(int16_t x, int16_t y, uint16_t color) override {
|
|
_screen->drawPixel(x, y, color);
|
|
}
|
|
|
|
public:
|
|
explicit ExtendedScreen(Adafruit_GFX *actualScreen) : Adafruit_GFX(actualScreen->width(), actualScreen->height()) {
|
|
this->_screen = actualScreen;
|
|
}
|
|
|
|
void drawTransparentBitmap(int16_t x, int16_t y, const bitmap_t& bitmap, const RGB& foreground, const RGB& background);
|
|
void drawTransparentBitmap(int16_t x, int16_t y, const bitmap_t& bitmap, const RGB& foreground, const RGB& background, const rect_t& rect);
|
|
|
|
|
|
// forward possibly-overridden virtual methods to the actual screen class
|
|
void startWrite() override { _screen->startWrite(); };
|
|
|
|
void writePixel(int16_t x, int16_t y, uint16_t color) override { _screen->writePixel(x, y, color); };
|
|
|
|
void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
|
uint16_t color) override { _screen->writeFillRect(x, y, w, h, color); };
|
|
|
|
void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override {
|
|
_screen->writeFastVLine(x, y, h, color);
|
|
};
|
|
|
|
void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override {
|
|
_screen->writeFastHLine(x, y, w, color);
|
|
};
|
|
|
|
void writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
|
uint16_t color) override { _screen->writeLine(x0, y0, x1, y1, color); };
|
|
|
|
void endWrite() override { _screen->endWrite(); };
|
|
|
|
void setRotation(uint8_t r) override { _screen->setRotation(r); };
|
|
|
|
void invertDisplay(bool i) override { _screen->invertDisplay(i); };
|
|
|
|
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override {
|
|
_screen->drawFastVLine(x, y, h, color);
|
|
};
|
|
|
|
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override {
|
|
_screen->drawFastHLine(x, y, w, color);
|
|
};
|
|
|
|
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
|
uint16_t color) override { _screen->fillRect(x, y, w, h, color); };
|
|
|
|
void fillScreen(uint16_t color) override { _screen->fillScreen(color); };
|
|
|
|
void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
|
|
uint16_t color) override { _screen->drawLine(x0, y0, x1, y1, color); };
|
|
|
|
void drawRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
|
uint16_t color) override { _screen->drawRect(x, y, w, h, color); };
|
|
|
|
};
|
|
|
|
|
|
#endif //ESP32DISPLAYTEST_EXTENDEDSCREEN_H
|