2026-07-09 02:59:53 +03:00
|
|
|
use hcie_protocol::effects::LayerEffect;
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
for path in [
|
2026-07-13 14:37:22 +03:00
|
|
|
"_images/_psd_stil_test/sultan.psd",
|
|
|
|
|
"_images/_psd_stil_test/drop_shadow.psd",
|
|
|
|
|
"_images/_psd_stil_test/emboss.psd",
|
|
|
|
|
"_images/_psd_stil_test/inner_bevel.psd",
|
|
|
|
|
"_images/_psd_stil_test/inner_shadow.psd",
|
|
|
|
|
"_images/_test_images/example3/Example3-mini.psd",
|
2026-07-09 02:59:53 +03:00
|
|
|
] {
|
|
|
|
|
println!("\n========================================");
|
|
|
|
|
println!("File: {}", path);
|
|
|
|
|
let layers = match hcie_psd::import_psd(std::path::Path::new(path)) {
|
|
|
|
|
Ok(l) => l,
|
|
|
|
|
Err(e) => {
|
|
|
|
|
println!("import_psd failed: {}", e);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (i, layer) in layers.iter().enumerate() {
|
|
|
|
|
let effs = if layer.effects.is_empty() { "no effects".to_string() } else {
|
|
|
|
|
format!("{} effects: {}", layer.effects.len(), layer.effects.iter().map(|e| format!("{}({})", e.effect_name(), if e.is_enabled() {"on"} else {"off"})).collect::<Vec<_>>().join(", "))
|
|
|
|
|
};
|
|
|
|
|
let nonzero = layer.pixels.iter().filter(|v| **v > 0).count();
|
|
|
|
|
println!("Layer {}: '{}' {}x{} visible={} opacity={:.2} blend={:?} nonzero_pixels={} {}",
|
|
|
|
|
i, layer.name, layer.width, layer.height, layer.visible, layer.opacity, layer.blend_mode, nonzero, effs);
|
|
|
|
|
for fx in &layer.effects {
|
|
|
|
|
match fx {
|
|
|
|
|
LayerEffect::BevelEmboss { depth, size, angle, altitude, highlight_color, shadow_color, style, technique, direction, .. } => {
|
|
|
|
|
println!(" style={:?} technique={:?} direction={:?} depth={} size={} angle={} altitude={} hl={:?} sh={:?}",
|
|
|
|
|
style, technique, direction, depth, size, angle, altitude, highlight_color, shadow_color);
|
|
|
|
|
}
|
|
|
|
|
LayerEffect::InnerShadow { color, opacity, angle, distance, size, .. } => {
|
|
|
|
|
println!(" color={:?} opacity={} angle={} distance={} size={}",
|
|
|
|
|
color, opacity, angle, distance, size);
|
|
|
|
|
}
|
|
|
|
|
LayerEffect::DropShadow { color, opacity, angle, distance, size, .. } => {
|
|
|
|
|
println!(" color={:?} opacity={} angle={} distance={} size={}",
|
|
|
|
|
color, opacity, angle, distance, size);
|
|
|
|
|
}
|
|
|
|
|
LayerEffect::Satin { color, opacity, angle, distance, size, .. } => {
|
|
|
|
|
println!(" color={:?} opacity={} angle={} distance={} size={}",
|
|
|
|
|
color, opacity, angle, distance, size);
|
|
|
|
|
}
|
|
|
|
|
LayerEffect::OuterGlow { color, opacity, size, spread, .. } => {
|
|
|
|
|
println!(" color={:?} opacity={} size={} spread={}",
|
|
|
|
|
color, opacity, size, spread);
|
|
|
|
|
}
|
|
|
|
|
LayerEffect::InnerGlow { color, opacity, size, .. } => {
|
|
|
|
|
println!(" color={:?} opacity={} size={}",
|
|
|
|
|
color, opacity, size);
|
|
|
|
|
}
|
|
|
|
|
_ => {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|