mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-08-18 18:32:30 +02:00
Fix image problem with 1Bit images
This commit is contained in:
@@ -147,6 +147,34 @@ LGFX & getdisplay();
|
||||
#define PAGE_UPDATE 1 // page wants display to update
|
||||
#define PAGE_HIBERNATE 2 // page wants displey to hibernate
|
||||
|
||||
// Draw monochrome bitmap on both E-Ink and TFT displays
|
||||
// Konvertiert 1-Bit Bilder automatisch zu RGB565 für Farbdisplays
|
||||
inline void drawMonochromeBitmap(
|
||||
int16_t x, int16_t y,
|
||||
const uint8_t *bitmap,
|
||||
int16_t w, int16_t h,
|
||||
uint16_t color) {
|
||||
|
||||
#ifdef DISPLAY_ST7796
|
||||
// Für RGB565 TFT: Konvertierung von 1-Bit zu Pixel-Zeichnung
|
||||
for (int row = 0; row < h; row++) {
|
||||
for (int col = 0; col < w; col++) {
|
||||
int byteIdx = (row * ((w + 7) / 8)) + (col / 8);
|
||||
int bitIdx = col % 8;
|
||||
uint8_t byte = bitmap[byteIdx];
|
||||
|
||||
// LSB-first format (Adafruit standard)
|
||||
if (byte & (1 << bitIdx)) {
|
||||
getdisplay().drawPixel(x + col, y + row, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Für E-Ink Displays: direkt drawBitmap verwenden
|
||||
getdisplay().drawBitmap(x, y, bitmap, w, h, color);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Display wrapper functions for E-Ink/TFT compatibility
|
||||
inline void displayFirstPage() {
|
||||
#ifdef DISPLAY_ST7796
|
||||
|
||||
Reference in New Issue
Block a user