| 123456789101112131415161718192021222324252627282930313233 |
- #pragma once
- // Minimal stand-in for the parts of Adafruit_GFX that GxEPD2_BW.h/
- // GxEPD2_3C.h's wrapper templates actually use (constructor(w,h), width()/
- // height(), rotation, fillScreen() looping drawPixel(), drawPixel() left
- // pure virtual for the wrapper to override). Not vendoring the real
- // Adafruit_GFX (fonts, shape-drawing, etc.) - none of that is exercised by
- // driving one full-screen update through firstPage()/nextPage().
- #include <cstdint>
- class Adafruit_GFX {
- public:
- Adafruit_GFX(int16_t w, int16_t h) : width_(w), height_(h) {}
- virtual ~Adafruit_GFX() = default;
- int16_t width() const { return rotation_ & 1 ? height_ : width_; }
- int16_t height() const { return rotation_ & 1 ? width_ : height_; }
- uint8_t getRotation() const { return rotation_; }
- void setRotation(uint8_t r) { rotation_ = r & 3; }
- virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
- void fillScreen(uint16_t color) {
- for (int16_t y = 0; y < height(); y++)
- for (int16_t x = 0; x < width(); x++)
- drawPixel(x, y, color);
- }
- protected:
- int16_t width_, height_;
- uint8_t rotation_{0};
- };
|