Files
hcie-rust-v3.05/hcie-io/examples/quick_check.rs

22 lines
1001 B
Rust

fn main() {
let path = std::path::Path::new("_images/_psd_stil_test/base_test_generated_2.psd");
let layers = hcie_psd::import_psd(path).unwrap();
println!("=== LAYER DETAILS FOR base_test_generated_2.psd ===");
for (i, layer) in layers.iter().enumerate() {
let nonzero_pixels = layer.pixels.chunks_exact(4)
.filter(|c| c[3] > 0)
.count();
let sample = layer.pixels.chunks_exact(4)
.find(|c| c[3] > 0)
.map(|c| [c[0], c[1], c[2], c[3]])
.unwrap_or([0, 0, 0, 0]);
println!("Layer {}: '{}' ({}x{}) visible={} opacity={:.2} blend={:?}",
i, layer.name, layer.width, layer.height, layer.visible, layer.opacity, layer.blend_mode);
println!(" Nonzero alpha pixels: {}/{} ({:.2}%)",
nonzero_pixels, layer.width * layer.height, 100.0 * nonzero_pixels as f32 / (layer.width * layer.height) as f32);
println!(" First opaque pixel sample: RGBA {:?}", sample);
}
}