This branch predates CI on `main`. `cargo fmt --all` only; no behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
37 lines
1.3 KiB
Rust
37 lines
1.3 KiB
Rust
// Leave-one-out over the elements that touch a band, dumping raw RGBA each time.
|
|
use sylpheed_formats::{pak, ui_layout};
|
|
fn main() {
|
|
let mut a = std::env::args().skip(1);
|
|
let pk = a.next().unwrap();
|
|
let bi: usize = a.next().unwrap().parse().unwrap();
|
|
let dir = a.next().unwrap();
|
|
let ar = pak::PakArchive::open(pk).unwrap();
|
|
let by = ar.read(&ar.entries()[bi]).unwrap();
|
|
let b = ui_layout::parse_build(&by).unwrap();
|
|
let o = ui_layout::ComposeOptions {
|
|
backdrop: [0, 0, 0, 255],
|
|
..Default::default()
|
|
};
|
|
let n = b.elements.len();
|
|
let base = ui_layout::compose(&b, &by, o.clone(), None);
|
|
std::fs::write(format!("{dir}/base.raw"), &base.rgba).unwrap();
|
|
println!("canvas {}x{} elements {n}", base.width, base.height);
|
|
for i in 0..n {
|
|
let e = &b.elements[i];
|
|
let Some(kf) = e.rest() else { continue };
|
|
// only bother with elements whose rest pose can touch the band
|
|
let mut v = vec![true; n];
|
|
v[i] = false;
|
|
let c = ui_layout::compose(&b, &by, o.clone(), Some(&v));
|
|
std::fs::write(format!("{dir}/wo-{i}.raw"), &c.rgba).unwrap();
|
|
println!(
|
|
"{i}\t{}\t{}\t({},{})\ta={}",
|
|
e.name,
|
|
e.sprite.clone().unwrap_or_default(),
|
|
kf.x,
|
|
kf.y,
|
|
kf.fade >> 24
|
|
);
|
|
}
|
|
}
|