feat(lcd): animate fortune results with shared GFX layers

This commit is contained in:
chenjintao
2026-10-10 11:36:54 +08:00
parent bf06618848
commit ee32b4d63f
26 changed files with 3063 additions and 11 deletions
@@ -0,0 +1,32 @@
#pragma once
#include "lcd_emote_assets.h"
/* 平台私有图层与几何;领域仍选择资产序列,不引入业务状态机。 */
enum { LCD_FORTUNE_PILE, LCD_FORTUNE_BACK, LCD_FORTUNE_EDGE,
LCD_FORTUNE_FRONT, LCD_FORTUNE_QUESTION, LCD_FORTUNE_ROD,
LCD_FORTUNE_SHARED_COUNT, LCD_FORTUNE_RESULT_COUNT = 5 };
#define LCD_FORTUNE_X 56
#define LCD_FORTUNE_Y 20
#define LCD_FORTUNE_WIDTH 208U
#define LCD_FORTUNE_HEIGHT 220U
#define LCD_FORTUNE_MOTION_MS 2500U
#define LCD_FORTUNE_TOTAL_MS 4000U
#define LCD_FORTUNE_HOLD_MS 1500U
#define LCD_FORTUNE_STEP_MS 34U
typedef struct {
uint16_t width, height, x, y;
size_t compressed_size;
const uint8_t *data;
} lcd_fortune_asset_t;
extern const lcd_fortune_asset_t lcd_fortune_shared[LCD_FORTUNE_SHARED_COUNT];
extern const lcd_fortune_asset_t lcd_fortune_text[LCD_FORTUNE_RESULT_COUNT];
/* 有界 LZ4 block 解码,无动态内存;拒绝截断、无效回指及长度不符。 */
bool lcd_emote_fortune_decode(const uint8_t *src, size_t size, uint8_t *dst, size_t capacity);
extern const char *const lcd_fortune_result_dirs[LCD_FORTUNE_RESULT_COUNT];
/* RGB565 高字节在前 + 独立 A8;所有像素由调用方拥有。 */
typedef struct { uint16_t width, height; const uint8_t *pixels; } lcd_fortune_texture_t;
/* 输出不透明 RGB565,完整重画固定局部窗口,确保旧轮廓恢复而不残影。 */
bool lcd_emote_fortune_build_frame(uint8_t *dst, size_t capacity,
const lcd_fortune_texture_t shared[LCD_FORTUNE_SHARED_COUNT],
const lcd_fortune_texture_t *text, uint32_t time_ms);