gemini feat: optimize drawing performance by caching layer styles during strokes and improve UI/UX for layer styles and menus, improved drop shadow

This commit is contained in:
2026-07-13 14:37:22 +03:00
parent 356fac571d
commit 2284a7d81f
50 changed files with 777 additions and 239 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
use std::path::Path;
fn main() {
let path = Path::new("/home/hc/Pictures/_psd_stil_test/sultan.psd");
let path = Path::new("_images/_psd_stil_test/sultan.psd");
if !path.exists() {
println!("File not found");
return;
+2 -2
View File
@@ -7,7 +7,7 @@ use image;
fn main() {
// Load PSD
let psd_path = "/home/hc/Pictures/_test_images/example3/Example3-mini.psd";
let psd_path = "_images/_test_images/example3/Example3-mini.psd";
let layers: Vec<hcie_protocol::Layer> = match hcie_psd::import_psd(std::path::Path::new(psd_path)) {
Ok(l) => l,
Err(e) => {
@@ -234,7 +234,7 @@ fn main() {
println!("Saved composite to {}", out_path);
// Diff against reference PNG
let ref_path = "/home/hc/Pictures/_test_images/example3/Example3-mini.png";
let ref_path = "_images/_test_images/example3/Example3-mini.png";
if std::path::Path::new(ref_path).exists() {
let ref_img = image::open(ref_path).unwrap().to_rgba8();
let ref_pixels = ref_img.as_raw();
+1 -1
View File
@@ -204,7 +204,7 @@ fn main() {
println!("Compositing layers...");
let composited = hcie_composite::composite_layers(&comp_layers, w, h);
let output_psd = "/home/hc/Pictures/_psd_stil_test/base_test_generated.psd";
let output_psd = "_images/_psd_stil_test/base_test_generated.psd";
println!("Saving to {}...", output_psd);
match hcie_psd::save_psd(&layers, w, h, &composited, Path::new(output_psd)) {
Ok(()) => println!("Successfully created and saved base PSD test file."),
+1 -1
View File
@@ -1,7 +1,7 @@
use std::path::Path;
fn main() {
let path = Path::new("/home/hc/Pictures/_psd_stil_test/sultan.psd");
let path = Path::new("_images/_psd_stil_test/sultan.psd");
if !path.exists() {
println!("File not found: {}", path.display());
return;
+1 -1
View File
@@ -1,5 +1,5 @@
fn main() {
let base = "/home/hc/Pictures/_psd_stil_test/sultan_test/sultan";
let base = "_images/_psd_stil_test/sultan_test/sultan";
// Load Layer 2 our output and reference
let layers = hcie_psd::import_psd(std::path::Path::new(&format!("{}/sultan_0003_Layer 2.psd", base))).unwrap();
+1 -1
View File
@@ -1,5 +1,5 @@
fn main() {
let base = "/home/hc/Pictures/_psd_stil_test/sultan_test/sultan";
let base = "_images/_psd_stil_test/sultan_test/sultan";
let layers = hcie_psd::import_psd(std::path::Path::new(&format!("{}/sultan_0003_Layer 2.psd", base))).unwrap();
let comp_layers: Vec<hcie_composite::Layer> = layers.iter().map(|l| hcie_composite::Layer {
+1 -1
View File
@@ -1,6 +1,6 @@
fn main() {
use std::io::Write;
let base = "/home/hc/Pictures/_psd_stil_test";
let base = "_images/_psd_stil_test";
let tests = [
("outer_glow", "outer_glow"),
+1 -1
View File
@@ -84,7 +84,7 @@ fn debug_pixels(psd_path: &str, ref_path: &str, label: &str) {
}
fn main() {
let base = "/home/hc/Pictures/_psd_stil_test/sultan_test/sultan";
let base = "_images/_psd_stil_test/sultan_test/sultan";
debug_pixels(
&format!("{}/sultan_0003_Layer 2.psd", base),
+1 -1
View File
@@ -2,7 +2,7 @@ use image;
fn main() {
let out_path = "/tmp/composite_output.png";
let ref_path = "/home/hc/Pictures/_test_images/example3/Example3-mini.png";
let ref_path = "_images/_test_images/example3/Example3-mini.png";
if !std::path::Path::new(out_path).exists() || !std::path::Path::new(ref_path).exists() {
println!("Images not found.");
+1 -1
View File
@@ -1,6 +1,6 @@
fn main() {
let psd_path = "/home/hc/Pictures/_psd_stil_test/blend.psd";
let psd_path = "_images/_psd_stil_test/blend.psd";
let layers = match hcie_psd::import_psd(std::path::Path::new(psd_path)) {
Ok(l) => l,
Err(e) => {
+7 -7
View File
@@ -1,12 +1,12 @@
fn main() {
let paths = [
"/home/hc/Pictures/_psd_stil_test/test_2/Emboss.psd",
"/home/hc/Pictures/_psd_stil_test/test_2/inner bevel.psd",
"/home/hc/Pictures/_psd_stil_test/test_2/drop shadow.psd",
"/home/hc/Pictures/_psd_stil_test/test_2/inner glow.psd",
"/home/hc/Pictures/_psd_stil_test/test_2/inner shadow.psd",
"/home/hc/Pictures/_psd_stil_test/test_2/stroke.psd",
"/home/hc/Pictures/_psd_stil_test/test_2/test_2.psd",
"_images/_psd_stil_test/test_2/Emboss.psd",
"_images/_psd_stil_test/test_2/inner bevel.psd",
"_images/_psd_stil_test/test_2/drop shadow.psd",
"_images/_psd_stil_test/test_2/inner glow.psd",
"_images/_psd_stil_test/test_2/inner shadow.psd",
"_images/_psd_stil_test/test_2/stroke.psd",
"_images/_psd_stil_test/test_2/test_2.psd",
];
for path in &paths {
println!("\n=== {} ===", std::path::Path::new(path).file_name().unwrap().to_str().unwrap());
+1 -1
View File
@@ -1,5 +1,5 @@
fn main() {
let path = std::path::Path::new("/home/hc/Pictures/_psd_stil_test/blend.psd");
let path = std::path::Path::new("_images/_psd_stil_test/blend.psd");
let bytes = std::fs::read(path).unwrap();
let parsed = hcie_psd::parse_psd_sequential(&bytes).unwrap();
println!("=== Sequential Parser Output ===");
+2 -2
View File
@@ -1,7 +1,7 @@
fn main() {
for path_str in [
"/home/hc/Pictures/_psd_stil_test/hc_drop_shadow.psd",
"/home/hc/Pictures/_psd_stil_test/fx_drop_shadow.psd",
"_images/_psd_stil_test/hc_drop_shadow.psd",
"_images/_psd_stil_test/fx_drop_shadow.psd",
] {
println!("\n========================================\nFILE: {}", path_str);
let path = std::path::Path::new(path_str);
+1 -1
View File
@@ -1,6 +1,6 @@
fn main() {
let psd_path = "/home/hc/Pictures/_psd_stil_test/blend.psd";
let psd_path = "_images/_psd_stil_test/blend.psd";
let layers = hcie_psd::import_psd(std::path::Path::new(psd_path)).unwrap();
for (i, layer) in layers.iter().enumerate() {
println!("Layer {}: '{}' size={}x{}", i, layer.name, layer.width, layer.height);
+1 -1
View File
@@ -42,7 +42,7 @@ fn save_png(path: &str, pixels: &[u8], w: u32, h: u32) {
}
fn main() {
let out_dir = "/home/hc/Pictures/_psd_stil_test";
let out_dir = "_images/_psd_stil_test";
let w: u32 = 512;
let h: u32 = 512;
+1 -1
View File
@@ -74,7 +74,7 @@ impl Default for HcieIoApp {
checked_path: String::new(),
layer_id_counter: 0,
selected_layer: None,
load_on_start: Some(std::path::PathBuf::from("/home/hc/Pictures/_psd_stil_test/sultan_test/sultan.psd")),
load_on_start: Some(std::path::PathBuf::from("_images/_psd_stil_test/sultan_test/sultan.psd")),
curve_channel: 0,
curve_drag_knot: None,
ref_texture: None,
+1 -1
View File
@@ -1,5 +1,5 @@
fn main() {
let path = std::path::Path::new("/home/hc/Pictures/_psd_stil_test/blend.psd");
let path = std::path::Path::new("_images/_psd_stil_test/blend.psd");
let bytes = std::fs::read(path).unwrap();
let parsed = hcie_psd::parse_psd_sequential(&bytes).unwrap();
println!("Parsed {} layers:", parsed.len());
+1 -1
View File
@@ -1,6 +1,6 @@
fn main() {
for filename in &["blend.psd", "emboss.psd", "inner_bevel.psd", "base_test_generated_2.psd"] {
let path_str = format!("/home/hc/Pictures/_psd_stil_test/{}", filename);
let path_str = format!("_images/_psd_stil_test/{}", filename);
let path = std::path::Path::new(&path_str);
let layers = match hcie_psd::import_psd(path) {
Ok(l) => l,
+1 -1
View File
@@ -1,5 +1,5 @@
fn main() {
let path = std::path::Path::new("/home/hc/Pictures/_psd_stil_test/base_test_generated_2.psd");
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 ===");
+4 -4
View File
@@ -90,8 +90,8 @@ fn test_file(psd_path: &str, ref_path: &str, out_path: &str) {
fn main() {
test_file(
"/home/hc/Pictures/_psd_stil_test/test_2/test_2.psd",
"/home/hc/Pictures/_psd_stil_test/test_2/test_2.png",
"_images/_psd_stil_test/test_2/test_2.psd",
"_images/_psd_stil_test/test_2/test_2.png",
"/tmp/test_2_out.png",
);
let tests = [
@@ -103,8 +103,8 @@ fn main() {
("stroke", "stroke"),
];
for (_label, sub) in &tests {
let psd = format!("/home/hc/Pictures/_psd_stil_test/test_2/{}.psd", sub);
let ref_path = format!("/home/hc/Pictures/_psd_stil_test/test_2/{}.png", sub);
let psd = format!("_images/_psd_stil_test/test_2/{}.psd", sub);
let ref_path = format!("_images/_psd_stil_test/test_2/{}.png", sub);
test_file(&psd, &ref_path, &format!("/tmp/test2_{}.png", sub.replace(' ', "_")));
}
}
+6 -6
View File
@@ -1,11 +1,11 @@
fn main() {
let tests = [
("drop shadow", "/home/hc/Pictures/_psd_stil_test/test_2/drop shadow.psd", "/home/hc/Pictures/_psd_stil_test/test_2/drop shadow.png"),
("inner shadow", "/home/hc/Pictures/_psd_stil_test/test_2/inner shadow.psd", "/home/hc/Pictures/_psd_stil_test/test_2/inner shadow.png"),
("inner bevel", "/home/hc/Pictures/_psd_stil_test/test_2/inner bevel.psd", "/home/hc/Pictures/_psd_stil_test/test_2/inner bevel.png"),
("Emboss", "/home/hc/Pictures/_psd_stil_test/test_2/Emboss.psd", "/home/hc/Pictures/_psd_stil_test/test_2/Emboss.png"),
("inner glow", "/home/hc/Pictures/_psd_stil_test/test_2/inner glow.psd", "/home/hc/Pictures/_psd_stil_test/test_2/inner glow.png"),
("stroke", "/home/hc/Pictures/_psd_stil_test/test_2/stroke.psd", "/home/hc/Pictures/_psd_stil_test/test_2/stroke.png"),
("drop shadow", "_images/_psd_stil_test/test_2/drop shadow.psd", "_images/_psd_stil_test/test_2/drop shadow.png"),
("inner shadow", "_images/_psd_stil_test/test_2/inner shadow.psd", "_images/_psd_stil_test/test_2/inner shadow.png"),
("inner bevel", "_images/_psd_stil_test/test_2/inner bevel.psd", "_images/_psd_stil_test/test_2/inner bevel.png"),
("Emboss", "_images/_psd_stil_test/test_2/Emboss.psd", "_images/_psd_stil_test/test_2/Emboss.png"),
("inner glow", "_images/_psd_stil_test/test_2/inner glow.psd", "_images/_psd_stil_test/test_2/inner glow.png"),
("stroke", "_images/_psd_stil_test/test_2/stroke.psd", "_images/_psd_stil_test/test_2/stroke.png"),
];
for (label, psd_path, ref_path) in &tests {
+6 -6
View File
@@ -2,12 +2,12 @@ use hcie_protocol::effects::LayerEffect;
fn main() {
for path in [
"/home/hc/Pictures/_psd_stil_test/sultan.psd",
"/home/hc/Pictures/_psd_stil_test/drop_shadow.psd",
"/home/hc/Pictures/_psd_stil_test/emboss.psd",
"/home/hc/Pictures/_psd_stil_test/inner_bevel.psd",
"/home/hc/Pictures/_psd_stil_test/inner_shadow.psd",
"/home/hc/Pictures/_test_images/example3/Example3-mini.psd",
"_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",
] {
println!("\n========================================");
println!("File: {}", path);
+6 -6
View File
@@ -95,18 +95,18 @@ fn test_file(psd_path: &str, ref_path: &str, out_path: &str) {
fn main() {
test_file(
"/home/hc/Pictures/_psd_stil_test/sultan.psd",
"/home/hc/Pictures/_psd_stil_test/sultan.png",
"_images/_psd_stil_test/sultan.psd",
"_images/_psd_stil_test/sultan.png",
"/tmp/sultan_out.png",
);
test_file(
"/home/hc/Pictures/_psd_stil_test/inner_shadow.psd",
"/home/hc/Pictures/_psd_stil_test/inner_shadow.png",
"_images/_psd_stil_test/inner_shadow.psd",
"_images/_psd_stil_test/inner_shadow.png",
"/tmp/inner_shadow_out.png",
);
test_file(
"/home/hc/Pictures/_psd_stil_test/inner_bevel.psd",
"/home/hc/Pictures/_psd_stil_test/inner_bevel.png",
"_images/_psd_stil_test/inner_bevel.psd",
"_images/_psd_stil_test/inner_bevel.png",
"/tmp/inner_bevel_out.png",
);
}
+1 -1
View File
@@ -115,7 +115,7 @@ fn main() {
use std::io::BufWriter;
let out_file = std::env::var("SULTAN_RESULTS_FILE").unwrap_or_else(|_| "sultan_results.txt".to_string());
let mut writer = BufWriter::new(File::create(out_file).unwrap());
let base = "/home/hc/Pictures/_psd_stil_test/sultan_test";
let base = "_images/_psd_stil_test/sultan_test";
let sultan_dir = format!("{}/sultan", base);
let layers = [
+2 -2
View File
@@ -4,7 +4,7 @@ use hcie_composite;
use std::path::Path;
fn main() {
let psd_path = "/home/hc/Pictures/Forest Text Effect/Text.psd";
let psd_path = "_images/Forest Text Effect/Text.psd";
let layers: Vec<hcie_protocol::Layer> = match hcie_psd::import_psd(Path::new(psd_path)) {
Ok(l) => l,
Err(e) => {
@@ -120,7 +120,7 @@ fn main() {
}
}
let ref_path = "/home/hc/Pictures/Forest Text Effect/Text.png";
let ref_path = "_images/Forest Text Effect/Text.png";
if Path::new(ref_path).exists() {
let ref_img = image::open(ref_path).unwrap().to_rgba8();
let ref_w = ref_img.width();
+2 -2
View File
@@ -3,8 +3,8 @@ use std::io::Write;
const RESULTS_FILE: &str = "/mnt/extra/00_PROJECTS/hcie-rust-v4/color_overlay_results.txt";
fn main() {
let psd_path = "/home/hc/Pictures/_psd_stil_test/color_overlay.psd";
let ref_path = "/home/hc/Pictures/_psd_stil_test/color_overlay.png";
let psd_path = "_images/_psd_stil_test/color_overlay.psd";
let ref_path = "_images/_psd_stil_test/color_overlay.png";
let ref_img = image::open(ref_path).expect("open color_overlay.png").to_rgba8();
let (w, h) = (ref_img.width(), ref_img.height());
+1 -1
View File
@@ -2,7 +2,7 @@
use std::io::Write;
const SHADOW_RS: &str = "hcie-fx/src/emboss.rs";
const PSD_BASE: &str = "/home/hc/Pictures/_psd_stil_test/sultan_test/sultan";
const PSD_BASE: &str = "_images/_psd_stil_test/sultan_test/sultan";
const RESULTS_FILE: &str = "/mnt/extra/00_PROJECTS/hcie-rust-v4/emboss_results.txt";
fn main() {
@@ -3,8 +3,8 @@ use std::io::Write;
const RESULTS_FILE: &str = "/mnt/extra/00_PROJECTS/hcie-rust-v4/gradient_overlay_results.txt";
fn main() {
let psd_path = "/home/hc/Pictures/_psd_stil_test/gradient_overlay.psd";
let ref_path = "/home/hc/Pictures/_psd_stil_test/gradient_overlay.png";
let psd_path = "_images/_psd_stil_test/gradient_overlay.psd";
let ref_path = "_images/_psd_stil_test/gradient_overlay.png";
let ref_img = image::open(ref_path).expect("open gradient_overlay.png").to_rgba8();
let (w, h) = (ref_img.width(), ref_img.height());
+2 -2
View File
@@ -2,8 +2,8 @@
use std::io::Write;
const SHADOW_RS: &str = "hcie-fx/src/tuned.rs";
const PSD_PATH: &str = "/home/hc/Pictures/_psd_stil_test/inner_shadow.psd";
const REF_PATH: &str = "/home/hc/Pictures/_psd_stil_test/inner_shadow.png";
const PSD_PATH: &str = "_images/_psd_stil_test/inner_shadow.psd";
const REF_PATH: &str = "_images/_psd_stil_test/inner_shadow.png";
const RESULTS_FILE: &str = "/mnt/extra/00_PROJECTS/hcie-rust-v4/inner_shadow_results.txt";
fn main() {
+2 -2
View File
@@ -1,8 +1,8 @@
use std::io::Write;
const SHADOW_RS: &str = "hcie-fx/src/outer_glow.rs";
const PSD_PATH: &str = "/home/hc/Pictures/_psd_stil_test/outer_glow_3.psd";
const REF_PATH: &str = "/home/hc/Pictures/_psd_stil_test/outer_glow_3.png";
const PSD_PATH: &str = "_images/_psd_stil_test/outer_glow_3.psd";
const REF_PATH: &str = "_images/_psd_stil_test/outer_glow_3.png";
const RESULTS_FILE: &str = "/mnt/extra/00_PROJECTS/hcie-rust-v4/outer_glow_results.txt";
fn main() {
+2 -2
View File
@@ -3,8 +3,8 @@ use std::io::Write;
const RESULTS_FILE: &str = "/mnt/extra/00_PROJECTS/hcie-rust-v4/satin_results.txt";
fn main() {
let psd_path = "/home/hc/Pictures/_psd_stil_test/satin.psd";
let ref_path = "/home/hc/Pictures/_psd_stil_test/satin.png";
let psd_path = "_images/_psd_stil_test/satin.psd";
let ref_path = "_images/_psd_stil_test/satin.png";
let ref_img = image::open(ref_path).expect("open satin.png").to_rgba8();
let (w, h) = (ref_img.width(), ref_img.height());
+2 -2
View File
@@ -2,8 +2,8 @@
use std::io::Write;
const SHADOW_RS: &str = "hcie-fx/src/tuned.rs";
const PSD_PATH: &str = "/home/hc/Pictures/_psd_stil_test/drop_shadow.psd";
const REF_PATH: &str = "/home/hc/Pictures/_psd_stil_test/drop_shadow.png";
const PSD_PATH: &str = "_images/_psd_stil_test/drop_shadow.psd";
const REF_PATH: &str = "_images/_psd_stil_test/drop_shadow.png";
const RESULTS_FILE: &str = "/mnt/extra/00_PROJECTS/hcie-rust-v4/shadow_results.txt";
fn main() {
+3 -3
View File
@@ -3,9 +3,9 @@ use std::io::Write;
const SHADOW_RS: &str = "hcie-fx/src/shadow.rs";
const LOG_PATH: &str = "/tmp/sultan_tune_log.txt";
const PSD_BASE: &str = "/home/hc/Pictures/_psd_stil_test/sultan_test/sultan";
const SULTAN_PSD: &str = "/home/hc/Pictures/_psd_stil_test/sultan_test/sultan.psd";
const SULTAN_REF: &str = "/home/hc/Pictures/_psd_stil_test/sultan_test/sultan.png";
const PSD_BASE: &str = "_images/_psd_stil_test/sultan_test/sultan";
const SULTAN_PSD: &str = "_images/_psd_stil_test/sultan_test/sultan.psd";
const SULTAN_REF: &str = "_images/_psd_stil_test/sultan_test/sultan.png";
fn main() {
let original = std::fs::read_to_string(SHADOW_RS).expect("read shadow.rs");