feat: Sleep screen letterbox fill and image upscaling
Some checks failed
CI (build) / clang-format (push) Has been cancelled
CI (build) / cppcheck (push) Has been cancelled
CI (build) / build (push) Has been cancelled
CI (build) / Test Status (push) Has been cancelled

Add configurable letterbox fill for sleep screen cover images that don't
match the display aspect ratio. Four fill modes are available: Solid
(single dominant edge shade), Blended (per-pixel edge colors), Gradient
(edge colors interpolated toward white/black), and None.

Enable upscaling of cover images smaller than the display in Fit mode by
modifying drawBitmap/drawBitmap1Bit to support both up and downscaling
via a unified block-fill approach.

Edge sampling data is cached to .crosspoint alongside the cover BMP to
avoid redundant bitmap scanning on subsequent sleeps. Cache is validated
against screen dimensions and auto-regenerated when stale.

New settings: Letterbox Fill (None/Solid/Blended/Gradient) and Gradient
Direction (To White/To Black).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cottongin
2026-02-09 11:52:55 -05:00
parent a85d5e627b
commit 4edb14bdd9
9 changed files with 582 additions and 63 deletions

View File

@@ -31,6 +31,14 @@ class CrossPointSettings {
INVERTED_BLACK_AND_WHITE = 2,
SLEEP_SCREEN_COVER_FILTER_COUNT
};
enum SLEEP_SCREEN_LETTERBOX_FILL {
LETTERBOX_NONE = 0,
LETTERBOX_SOLID = 1,
LETTERBOX_BLENDED = 2,
LETTERBOX_GRADIENT = 3,
SLEEP_SCREEN_LETTERBOX_FILL_COUNT
};
enum SLEEP_SCREEN_GRADIENT_DIR { GRADIENT_TO_WHITE = 0, GRADIENT_TO_BLACK = 1, SLEEP_SCREEN_GRADIENT_DIR_COUNT };
// Status bar display type enum
enum STATUS_BAR_MODE {
@@ -125,6 +133,10 @@ class CrossPointSettings {
uint8_t sleepScreenCoverMode = FIT;
// Sleep screen cover filter
uint8_t sleepScreenCoverFilter = NO_FILTER;
// Sleep screen letterbox fill mode (None / Solid / Blended / Gradient)
uint8_t sleepScreenLetterboxFill = LETTERBOX_GRADIENT;
// Sleep screen gradient direction (towards white or black)
uint8_t sleepScreenGradientDir = GRADIENT_TO_WHITE;
// Status bar settings
uint8_t statusBar = FULL;
// Text rendering settings