This branch predates CI on `main`. `cargo fmt --all` only; no behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
53 lines
1.9 KiB
Rust
53 lines
1.9 KiB
Rust
//! What COLOUR is a primitive, and does any of them only make sense additively?
|
|
//!
|
|
//! `ui-prm-primitives.md` leaves blend mode open, and `forced_backdrop` assumes
|
|
//! straight alpha-over. A quad whose ARGB would tint the whole screen a colour no
|
|
//! screen shows is evidence against alpha-over for that quad.
|
|
use std::collections::BTreeMap;
|
|
use sylpheed_formats::{pak, ratc, ui_layout};
|
|
fn main() {
|
|
let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into());
|
|
let mut paks: Vec<_> = std::fs::read_dir(format!("{root}/dat"))
|
|
.expect("dat/")
|
|
.flatten()
|
|
.map(|e| e.path())
|
|
.filter(|p| p.extension().and_then(|s| s.to_str()) == Some("pak"))
|
|
.collect();
|
|
paks.sort();
|
|
let mut m: BTreeMap<String, BTreeMap<String, usize>> = BTreeMap::new();
|
|
for p in &paks {
|
|
let Ok(ar) = pak::PakArchive::open(p) else {
|
|
continue;
|
|
};
|
|
for e in ar.entries() {
|
|
let Ok(by) = ar.read(e) else { continue };
|
|
if !ratc::is_ratc(&by) {
|
|
continue;
|
|
}
|
|
let Some(b) = ui_layout::parse_build(&by) else {
|
|
continue;
|
|
};
|
|
for el in &b.elements {
|
|
if el.sprite.is_some() {
|
|
continue;
|
|
}
|
|
for k in &el.keyframes {
|
|
*m.entry(el.name.clone())
|
|
.or_default()
|
|
.entry(format!("{:08x}", k.fade))
|
|
.or_default() += 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
println!("{:>26} fade ARGB values (count)", "keyless element");
|
|
for (n, v) in &m {
|
|
let tot: usize = v.values().sum();
|
|
if tot < 4 {
|
|
continue;
|
|
}
|
|
let s: Vec<String> = v.iter().map(|(k, c)| format!("{k}x{c}")).collect();
|
|
println!(" {n:>24} {}", s.join(" "));
|
|
}
|
|
}
|