feat(app-iced): M93 r2 —— 背景图真图直出 + 面板 α 收敛到 Ui::layer
复审前补齐两处(tower 扩 scope:Cargo.toml / pages/frame.* / theme.rs / presenter::prefs)。 1) 背景图**真图直出** - `iced` 开 `image-without-codecs`(刻意不用 `image`:后者会打开 `image/default` 全套编解码器); 编解码能力由本 crate 的 `image` features 决定,补了 `jpeg` / `bmp`(用户挑的背景图/壁纸多半是 jpg)。 - `pages/appearance/picture.rs`:`Cover`/`Contain` 走渲染器 `ContentFit`,`Tile` 按 `background::tiles` 算行列(上限 64 块)真的铺 N 个图块;暗化 = 一层「版面底色 @ α=dim」叠在图上。 - 36dp 马赛克那条路**已删除**(不再是主路径,也不留死代码)。 - 踩坑记录:`Handle::from_bytes` 的纹理分配赶不上截图第 3 帧(实测画面全空),改用 `Handle::from_path`(渲染器自己解码),已在 `picture::image_handle` 的文档里写明。 2) 面板 α **收敛到唯一来源** - `Ui::layer()` 直接乘上面板 α(新增 `Ui::panel_alpha` / `with_panel_alpha`,默认 1.0、 `scale_alpha(1.0)` 逐字节不变),`app::rebuild_ui` 注入生效值。 - 于是外壳(根容器/标题栏/导航轨)、`frame::card`(实例/下载/日志三页卡片)、 `frame::header_bar`(新增底色)、外观分组卡片、空态图标块**全部同源**, 调用点不再有任何 `panel_color(..)` 自乘(该 helper 已删)。 - 有背景图时根容器不再盖一层实色画布(否则 panel α=1 时背景图整块被挡)。 3) `presenter::prefs` 补重导出 `PANEL_ALPHA_MIN` / `BG_DIM_MAX`,app-iced 里两份 0.4 / 0.95 字面量改为转发常量。 验收:11+3 张图(`C:\Temp\ull-shots\wt-93\r2-*.png`)——三档填充肉眼可分、`.jpg` 能加载、 GPU 档 panel55 时卡片/分组卡/页头带都透出背景、CPU 档仍强制 1.0 且背景在面板空隙可见; 另附实例/下载/日志三页 panel55 各一张,证明三页都吃到同一个 α。
This commit is contained in:
1 parent
b8ab46662c
commit
22e4c423fa
18 files changed
+399
-535
No files matched your search
@@ -130,7 +130,7 @@ fn a_broken_background_path_falls_back_silently_but_says_why() {
|
||||
.apply(Change::BgImage("D:/definitely/not/here.png".to_owned()));
|
||||
|
||||
assert!(!app.appearance.background_active());
|
||||
assert!(app.appearance.mosaic((1180.0, 760.0), [0, 0, 0]).is_none());
|
||||
assert!(app.appearance.image().is_none(), "解码失败 ⇒ 没有可用图");
|
||||
assert_eq!(app.appearance.diagnostics().len(), 1, "恰好一条诊断");
|
||||
assert!(
|
||||
app.appearance.diagnostics()[0].contains("could not be read"),
|
||||
@@ -169,11 +169,11 @@ fn a_decodable_png_makes_the_background_and_the_palette_active() {
|
||||
app.rebuild_ui();
|
||||
|
||||
assert!(app.appearance.background_active());
|
||||
let mosaic = app
|
||||
.appearance
|
||||
.mosaic((1180.0, 760.0), [0, 0, 0])
|
||||
.expect("有背景层");
|
||||
assert!(mosaic.cols > 1 && mosaic.rows > 1);
|
||||
assert!(app.appearance.image().is_some(), "解码成功 ⇒ 有可用图");
|
||||
assert!(
|
||||
!app.appearance.bg_path.trim().is_empty(),
|
||||
"渲染器按路径解码(见 picture::image_handle)"
|
||||
);
|
||||
assert_eq!(app.appearance.diagnostics().len(), 0, "成功时没有诊断");
|
||||
assert_eq!(app.appearance.palette_level(), "background-image");
|
||||
assert!(
|
||||
@@ -286,5 +286,5 @@ fn a_fresh_state_is_the_factory_appearance() {
|
||||
assert_eq!(state.effective_panel_alpha(), 1.0);
|
||||
assert!(!state.background_active());
|
||||
assert!(state.diagnostics().is_empty());
|
||||
assert!(state.mosaic((1180.0, 760.0), [0, 0, 0]).is_none());
|
||||
assert!(state.image().is_none());
|
||||
}
|
||||
Reference in new issue
Block a user