feat: Add EPUB embedded image support (JPEG/PNG)

Cherry-pick merge from pablohc/crosspoint-reader@2d8cbcf, based on
upstream PR #556 by martinbrook with pablohc's refresh optimization.

- Add JPEG decoder (picojpeg) and PNG decoder (PNGdec) with 4-level
  grayscale Bayer dithering for e-ink display
- Add pixel caching system (.pxc files) for fast image re-rendering
- Integrate image extraction from EPUB HTML parser (<img> tag support)
- Add ImageBlock/PageImage types with serialization support
- Add image-aware refresh optimization (double FAST_REFRESH technique)
- Add experimental displayWindow() partial refresh support
- Bump section cache version 12->13 to invalidate stale caches
- Resolve TAG_PageImage=3 to avoid conflict with mod's TAG_PageTableRow=2

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cottongin
2026-02-15 17:29:39 -05:00
parent f90aebc891
commit 19004eefaa
26 changed files with 1984 additions and 30 deletions

View File

@@ -32,6 +32,13 @@ void HalDisplay::displayBuffer(HalDisplay::RefreshMode mode, bool turnOffScreen)
einkDisplay.displayBuffer(convertRefreshMode(mode), turnOffScreen);
}
// EXPERIMENTAL: Display only a rectangular region
void HalDisplay::displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h,
HalDisplay::RefreshMode mode, bool turnOffScreen) {
(void)mode; // EInkDisplay::displayWindow does not take mode yet
einkDisplay.displayWindow(x, y, w, h, turnOffScreen);
}
void HalDisplay::refreshDisplay(HalDisplay::RefreshMode mode, bool turnOffScreen) {
einkDisplay.refreshDisplay(convertRefreshMode(mode), turnOffScreen);
}

View File

@@ -34,6 +34,10 @@ class HalDisplay {
void displayBuffer(RefreshMode mode = RefreshMode::FAST_REFRESH, bool turnOffScreen = false);
void refreshDisplay(RefreshMode mode = RefreshMode::FAST_REFRESH, bool turnOffScreen = false);
// EXPERIMENTAL: Display only a rectangular region
void displayWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h,
RefreshMode mode = RefreshMode::FAST_REFRESH, bool turnOffScreen = false);
// Power management
void deepSleep();