完成数字人模式 UI 的"背景图叠加 + 实时字幕"功能。所有改动基于 EAF 框架(Phase 10 commit 31982ba),保持 0 个 lv_* UI 函数链接进固件。 Step 1: JPG 背景图叠加 - ai_chat_ui_eaf.c 加 esp_jpeg 解码 Background_360x360.jpg → RGB565 buffer (252KB PSRAM) → gfx_img_create 作为底层 - z-index 通过创建顺序控制: 背景 → 数字人 anim → 字幕 label - 选项 A 保留 JPG (~20KB SPIFFS) 比选项 B (252KB .bin) 省 232KB 数字人透明: esp_emote_gfx local patch (gfx_anim.c::gfx_anim_render_24bit_pixels) - 根因: 在线 EAF Packer 默认导出 24-bit 模式,工具不暴露 bit_depth 选项,alpha 滑块拉到 0 无法保存,导致 GIF 透明像素被烘焙成屏幕背景 色 (黑色 RGB888 #000000) - 解决: 在 24-bit 渲染函数加 chroma key,跳过近黑像素让背景图露出 - 阈值演化 v1 (0x0000) → v3 (16) → v4 (24),最终 RGB888 ≤ (24,24,24) - 保留 R/G/B AND 关系(三分量都小才透明),保护数字人本体暗色不破洞 - 双字节序判定,兼容 disp_config_t.flags.swap = true Step 2: 中文字幕 (gfx_label + LVGL bitmap font 方案 A) - 字体方案对比 3 方案后选方案 A(C 数组 XIP from Flash): • A: 1.4MB Flash + 0 RAM (推荐) • B: xiaozhi-fonts .bin 1.18MB SPIFFS + 1.18MB PSRAM • C: 自转 .bin ~2.8MB 总占用 - extern const lv_font_t font_puhui_20_4 → gfx_label_set_font 直接喂 - linker 副作用: 仅引入 7 个 LVGL 函数 ~2.2KB(lv_font_get_bitmap_fmt_txt / lv_mem_* 幽灵符号),无 lv_obj/lv_disp/lv_indev 等 UI 框架函数 - 字幕参数: 300×56 (2 行限制) + 行间距 4 + 贴底 y_ofs=-4 - GFX_LABEL_LONG_WRAP 字符级断行(中文友好),CENTER 居中 - 流式 TTS 节流 50ms(比 LVGL 100ms 短,EAF 渲染更快) 工具脚本 (tools/patch_eaf_transparency.py) - 探索性脚本:解析 hiyori-assets.bin 尝试修补 EAF palette alpha - 实际未生效(工具导出 24-bit 无 palette),保留作为 EAF bin layout 解析参考 固件大小: 2.75MB → 4.30MB(+1.55MB = 字体 1.4MB + 字幕代码 + 背景图代码) 分区余量: 50% → 25% (1.42MB 空闲,安全) 完整踩坑经验已沉淀到 ~/.claude/CLAUDE.md §13 + 项目 memory。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ESP Emote GFX
面向嵌入式小屏设备的轻量 UI 图形库
Widgets · Text · Images · QR Codes · Animation · Motion Scenes
中文文档 | English Docs | Component Registry
把嵌入式小屏 UI 里常见的显示对象、图像、文本、动画、二维码和 Motion 场景,收进一套轻量图形库。
适合资源受限但仍需要流畅动效、清晰文字和轻量交互的小屏产品。
功能框架
模块说明
|
基础控件
提供图片、文本、按钮、二维码、动画和 Motion 场景等常用 UI 元素。 |
渲染与图像
覆盖软件绘制、图像资源、RGB565 / RGB565A8 数据,以及基于控制点的 mesh image 形变。 |
文本与字体
支持 LVGL bitmap font 和 FreeType TTF/OTF 字体渲染。 |
|
动画播放
负责 EAF 播放、分段控制、循环模式,以及 timer-driven 的状态更新。 |
Motion 场景
面向路径驱动的角色、表情和交互动效,支持生成式 asset、pose/action 切换和颜色/纹理绑定。 |
嵌入式集成
作为组件接入工程,连接显示刷新、输入、内存 buffer 和线程安全对象访问。 |
文档
详细安装、API、示例、Motion 架构和测试工程说明都放在在线文档里:
- 中文文档:https://espressif2022.github.io/esp_emote_gfx/zh_CN/index.html
- English docs: https://espressif2022.github.io/esp_emote_gfx/en/index.html
- Component Registry: https://components.espressif.com/components/espressif2022/esp_emote_gfx
English
ESP Emote GFX is a lightweight software-rendered graphics library for compact embedded displays that need expressive UI elements without pulling in a heavy graphics stack.
For installation, API references, examples, and motion architecture notes, please visit the online documentation:
- Documentation: https://espressif2022.github.io/esp_emote_gfx/en/index.html
- Component Registry: https://components.espressif.com/components/espressif2022/esp_emote_gfx
License
ESP Emote GFX is licensed under the Apache License 2.0. See LICENSE.