|
LCDGFX LCD display driver
1.2.0
Lightweight graphics library for SSD1306, SSD1325, SSD1327, SSD1331, SSD1351, SH1106, SH1107, IL9163, ST7735, ST7789, ILI9341, PCD8544 displays over I2C/SPI
|
GfxCompat is a thin, header-only adapter that exposes the familiar Adafruit_GFX drawing API on top of any lcdgfx display or canvas — with no external Adafruit_GFX library required. It lets existing Adafruit GFX sketches run on every display lcdgfx supports (OLED and colour TFT) while keeping lcdgfx's tiny footprint.
Header: src/canvas/gfx_compat.h (included by lcdgfx.h).
GfxCompat holds a reference to the display, so keep both objects in the same scope.
Colour is passed through exactly as in Adafruit_GFX:
0 = off, any non-zero = on. GfxCompat maps this to lcdgfx's internal 0x0000/0xFFFF mask automatically (the branch folds away at compile time — no runtime cost).RGB_COLOR16(255, 0, 0).| Category | Methods |
|---|---|
| Geometry | drawPixel, drawFastHLine, drawFastVLine, drawLine, drawRect, fillRect, fillScreen, drawCircle, fillCircle, drawTriangle, fillTriangle, drawRoundRect, fillRoundRect |
| Bitmaps | drawBitmap (1-bit, foreground colour) |
| Text | setCursor, setTextColor (fg / fg+bg), setTextSize, write, print (const char*, char, int, long), println, setFont(const GFXfont*) |
| Screen | width, height, setRotation, getRotation |
| Adafruit transaction API | startWrite, writePixel, endWrite (no-ops / forwarders) |
| Escape hatch | display() returns the wrapped lcdgfx object for native calls |
GFXfont)GfxCompat accepts Adafruit GFXfont structures produced by Adafruit's fontconvert tool. The GFXfont / GFXglyph types are defined in gfx_compat.h and are binary-compatible with Adafruit's gfxfont.h (guarded by _GFXFONT_H_, so including the real Adafruit_GFX alongside is safe).
Glyphs are repacked into lcdgfx's native column/page format and drawn with a single drawBitmap1 call, so custom fonts render correctly on paged monochrome OLEDs as well as colour panels. Fonts stored in PROGMEM (AVR) are handled transparently.
setTextSize > 1) is accepted for source compatibility but not applied — lcdgfx uses fixed-cell fonts; text renders at size 1.fillTriangle fills by vertical spans (one write per column) rather than Adafruit's horizontal scanlines. This is intentional: on bufferless paged monochrome displays a horizontal fill would clobber earlier rows sharing an 8-pixel page byte. The visual result matches on colour displays.width * ceil(height/8) > 128 bytes) are skipped to bound stack usage on small MCUs.GfxCompat is aimed at porting existing Adafruit GFX code.See the runnable example: examples/direct_draw/gfx_compat.