b09795ccff
- Add `persistence.rs` for stable serialization of dock layouts without runtime identifiers. - Introduce `preview.rs` for geometry handling of dock drop previews. - Create `sizing.rs` to manage content-aware sizing policies and constraint solving for dock panels. - Implement `welcome.rs` to provide a welcome surface when no documents are open, featuring New and Open actions.
39 lines
1.1 KiB
Rust
39 lines
1.1 KiB
Rust
use image::GenericImageView;
|
|
|
|
fn main() {
|
|
let ref_img = image::open("_images/_psd_stil_test/test_2/Emboss.png")
|
|
.unwrap()
|
|
.to_rgba8();
|
|
let test_img = image::open("/tmp/test2_Emboss.png").unwrap().to_rgba8();
|
|
|
|
let mut diff_sum = 0.0;
|
|
let mut max_diff = 0;
|
|
let mut px = 0;
|
|
|
|
let mut printed = 0;
|
|
|
|
for y in 0..ref_img.height() {
|
|
for x in 0..ref_img.width() {
|
|
let rp = ref_img.get_pixel(x, y);
|
|
let tp = test_img.get_pixel(x, y);
|
|
|
|
let d = (rp[0] as i32 - tp[0] as i32).abs()
|
|
+ (rp[1] as i32 - tp[1] as i32).abs()
|
|
+ (rp[2] as i32 - tp[2] as i32).abs()
|
|
+ (rp[3] as i32 - tp[3] as i32).abs();
|
|
|
|
diff_sum += d as f64;
|
|
max_diff = max_diff.max(d);
|
|
px += 4;
|
|
|
|
if d > 100 && printed < 20 {
|
|
println!("x: {}, y: {} | REF: {:?} | TEST: {:?}", x, y, rp, tp);
|
|
printed += 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
println!("Avg diff per channel: {:.2}", diff_sum / px as f64);
|
|
println!("Max pixel diff: {}", max_diff);
|
|
}
|