Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Layer Style: user contour library with New…, Load/Replace/Save Contours (#4391)

vangel7699ba7f2688a7
diff --git a/crates/engine/src/commands.rs b/crates/engine/src/commands.rs
index 5524388c7..c445532b1 100644
--- a/crates/engine/src/commands.rs
+++ b/crates/engine/src/commands.rs
@@ -1178,6 +1178,7 @@ fn build() -> Vec<CommandSpec> {
});
}
v.extend(crate::layer_style::specs());
+ v.extend(crate::contour_lib_cmds::specs());
v.extend(crate::filters::specs());
v.extend(crate::filters_ext::specs());
v.extend(crate::color_to_alpha_cmds::specs());
diff --git a/crates/engine/src/contour_lib_cmds.rs b/crates/engine/src/contour_lib_cmds.rs
new file mode 100644
index 000000000..4b1b0a0a2
--- /dev/null
+++ b/crates/engine/src/contour_lib_cmds.rs
@@ -0,0 +1,300 @@
+//! The user contour library of the Layer Style dialog (`layer.layerStyle.contours.*`).
+//!
+//! Photoshop's Contour Editor "New…" saves the edited curve under a name, and the contour picker
+//! lists those contours after its standard ones (picker menu: Load, Save and Replace Contours).
+//! The library is [`PresetState::contours`](crate::presets::PresetState); like the other preset
+//! sets it lives in the preferences document and changes the preferences, not a document's
+//! history. A user contour is applied to an effect as a `contour` curve object (see
+//! [`contour_param`]); `.shc` files go through `photocraft_psd::shc` (see [`contours_from_shc`]).
+
+use photocraft_doc::Contour;
+use photocraft_doc::adjust::CurvePoint;
+use serde_json::{Value, json};
+
+use crate::commands::CommandSpec;
+use crate::layer_style::{builtin_contour, contour_from_param, contour_param, contour_to_shc_all, contours_from_shc};
+use crate::presets::{always, bad, str_param};
+use crate::{Result, Session};
+
+/// Most user contours kept (further ones are refused / dropped on load).
+pub const MAX_USER_CONTOURS: usize = 1000;
+/// Longest contour name kept, in characters.
+pub const MAX_NAME: usize = 255;
+
+fn name_of(c: &Contour) -> &str {
+ match c {
+ Contour::Linear => "Linear",
+ Contour::Custom { name, .. } => name,
+ }
+}
+
+fn clip(s: &str) -> String {
+ s.chars().take(MAX_NAME).collect()
+}
+
+/// `c` as a named custom contour (Linear becomes the identity curve), so it can be stored.
+fn named(c: Contour, name: &str) -> Contour {
+ match c {
+ Contour::Linear => Contour::Custom {
+ name: name.to_string(),
+ points: vec![CurvePoint { input: 0.0, output: 0.0 }, CurvePoint { input: 1.0, output: 1.0 }],
+ corners: Vec::new(),
+ },
+ Contour::Custom { points, corners, .. } => Contour::Custom { name: name.to_string(), points, corners },
+ }
+}
+
+/// `base`, or `base 2`, `base 3`… so a name is neither a standard contour's nor a user contour's
+/// (a name alone selects a standard contour, so a user contour may not shadow one).
+fn unique(lib: &[Contour], base: &str) -> String {
+ let taken = |n: &str| builtin_contour(n).is_some() || lib.iter().any(|c| name_of(c) == n);
+ if !taken(base) {
+ return base.to_string();
+ }
+ (2..).map(|i| format!("{base} {i}")).find(|n| !taken(n)).unwrap_or_else(|| base.to_string())
+}
+
+/// Adds `c` under `name` (made unique); the stored name.
+fn add(lib: &mut Vec<Contour>, c: Contour, name: &str) -> String {
+ let n = unique(lib, &clip(name));
+ lib.push(named(c, &n));
+ n
+}
+
+/// The library as saved with the preferences.
+pub fn to_json(lib: &[Contour]) -> Value {
+ Value::Array(lib.iter().map(contour_param).collect())
+}
+
+/// Restores a saved library, skipping entries that aren't usable contours; never refuses.
+pub fn from_json(v: &Value) -> Vec<Contour> {
+ let mut lib = Vec::new();
+ for e in v.as_array().into_iter().flatten().take(MAX_USER_CONTOURS) {
+ // Entries are curve objects; a bare name would only name a standard contour.
+ if let Some(c) = e.is_object().then(|| contour_from_param(e)).flatten() {
+ add(&mut lib, c.clone(), name_of(&c));
+ }
+ }
+ lib
+}
+
+fn list(s: &mut Session, _: &Value) -> Result<Value> {
+ let lib = &s.presets.contours;
+ Ok(json!({"count": lib.len(), "contours": lib.iter().map(|c| json!({"name": name_of(c), "contour": contour_param(c)})).collect::<Vec<_>>()}))
+}
+
+fn new(s: &mut Session, p: &Value) -> Result<Value> {
+ const CMD: &str = "layer.layerStyle.contours.new";
+ let c = contour_from_param(p.get("contour").ok_or_else(|| bad(CMD, "missing `contour` (a standard contour's name or a curve object)"))?)
+ .ok_or_else(|| bad(CMD, "`contour` is not a usable contour (unknown name, or a curve with fewer than 2 or more than 64 points)"))?;
+ if s.presets.contours.len() >= MAX_USER_CONTOURS {
+ return Err(bad(CMD, format!("the contour library is full ({MAX_USER_CONTOURS} contours)")));
+ }
+ let name = match p.get("name") {
+ None | Some(Value::Null) => format!("Contour {}", s.presets.contours.len() + 1),
+ Some(Value::String(n)) if !n.trim().is_empty() => n.trim().to_string(),
+ Some(_) => return Err(bad(CMD, "`name` must be a non-empty string")),
+ };
+ let name = add(&mut s.presets.contours, c, &name);
+ s.presets_changed();
+ let contour = s.presets.contours.last().map(contour_param).unwrap_or(Value::Null);
+ Ok(json!({"name": name, "contour": contour, "count": s.presets.contours.len()}))
+}
+
+fn delete(s: &mut Session, p: &Value) -> Result<Value> {
+ const CMD: &str = "layer.layerStyle.contours.delete";
+ let name = str_param(p, "name").ok_or_else(|| bad(CMD, "missing `name`"))?;
+ let at = s
+ .presets
+ .contours
+ .iter()
+ .position(|c| name_of(c) == name)
+ .ok_or_else(|| bad(CMD, format!("no user contour \"{name}\" (see layer.layerStyle.contours.list)")))?;
+ s.presets.contours.remove(at);
+ s.presets_changed();
+ Ok(json!({"deleted": name, "count": s.presets.contours.len()}))
+}
+
+fn load(s: &mut Session, p: &Value) -> Result<Value> {
+ const CMD: &str = "layer.layerStyle.contours.load";
+ let replace = match str_param(p, "mode") {
+ None | Some("append") => false,
+ Some("replace") => true,
+ Some(m) => return Err(bad(CMD, format!("unknown mode `{m}` (append|replace)"))),
+ };
+ let (bytes, _) = crate::preset_import_cmds::file_bytes(p, CMD, ".shc file")?;
+ let found = contours_from_shc(&bytes)?;
+ let loaded: Vec<Contour> = found.iter().filter_map(contour_from_param).collect();
+ if loaded.is_empty() {
+ return Err(bad(CMD, "the file holds no usable contours"));
+ }
+ let mut lib = if replace { Vec::new() } else { s.presets.contours.clone() };
+ let mut names = Vec::new();
+ for c in loaded {
+ if lib.len() >= MAX_USER_CONTOURS {
+ break;
+ }
+ let n = name_of(&c).to_string();
+ names.push(add(&mut lib, c, &n));
+ }
+ s.presets.contours = lib;
+ s.presets_changed();
+ Ok(json!({"loaded": names, "count": s.presets.contours.len(), "skipped": found.len() - names.len()}))
+}
+
+fn save(s: &mut Session, p: &Value) -> Result<Value> {
+ const CMD: &str = "layer.layerStyle.contours.save";
+ let lib: Vec<&Contour> = match p.get("names") {
+ None | Some(Value::Null) => s.presets.contours.iter().collect(),
+ Some(Value::Array(a)) => {
+ let mut v = Vec::new();
+ for n in a {
+ let n = n.as_str().ok_or_else(|| bad(CMD, "`names` must be strings"))?;
+ v.push(s.presets.contours.iter().find(|c| name_of(c) == n).ok_or_else(|| bad(CMD, format!("no user contour \"{n}\"")))?);
+ }
+ v
+ }
+ Some(_) => return Err(bad(CMD, "`names` must be a list of contour names")),
+ };
+ if lib.is_empty() {
+ return Err(bad(CMD, "there are no user contours to save"));
+ }
+ let bytes = contour_to_shc_all(&lib)?;
+ let mut out = json!({"count": lib.len(), "bytes": bytes.len()});
+ match str_param(p, "path") {
+ Some(path) => {
+ crate::file_cmds::write_file(path, &bytes)?;
+ out["path"] = json!(path);
+ }
+ None => out["data"] = json!(photocraft_paint::tile::b64_encode(&bytes)),
+ }
+ Ok(out)
+}
+
+/// Contour library command specs.
+pub fn specs() -> Vec<CommandSpec> {
+ vec![
+ CommandSpec {
+ id: "layer.layerStyle.contours.list",
+ label: "List User Contours",
+ menu: &[],
+ shortcut: None,
+ params: "{} → {count, contours:[{name, contour: curve object usable as any `contour` param}]}",
+ enabled: always,
+ run: list,
+ journal: false,
+ },
+ CommandSpec {
+ id: "layer.layerStyle.contours.new",
+ label: "New Contour…",
+ menu: &[],
+ shortcut: None,
+ params: r##"{"contour":name|{"name":str,"points":[[in 0..1,out 0..1],…],"corners":[bool,…]},"name":str?="Contour N"} → {name (made unique, never a standard contour's name), contour, count} (Contour Editor › New…)"##,
+ enabled: always,
+ run: new,
+ journal: true,
+ },
+ CommandSpec {
+ id: "layer.layerStyle.contours.delete",
+ label: "Delete Contour",
+ menu: &[],
+ shortcut: None,
+ params: r##"{"name":str} → {deleted, count}"##,
+ enabled: always,
+ run: delete,
+ journal: true,
+ },
+ CommandSpec {
+ id: "layer.layerStyle.contours.load",
+ label: "Load Contours…",
+ menu: &[],
+ shortcut: None,
+ params: r##"{"path":".shc file"?,"data":base64 bytes?,"mode":"append"|"replace"="append"} → {loaded, count, skipped} (picker menu: Load Contours… / Replace Contours…)"##,
+ enabled: always,
+ run: load,
+ journal: true,
+ },
+ CommandSpec {
+ id: "layer.layerStyle.contours.save",
+ label: "Save Contours…",
+ menu: &[],
+ shortcut: None,
+ params: r##"{"path":".shc file"?,"names":[str]?=all} → {count, bytes, path | data (base64 when no path)}"##,
+ enabled: always,
+ run: save,
+ journal: false,
+ },
+ ]
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn curve(name: &str) -> Value {
+ json!({"name": name, "points": [[0.0, 0.0], [0.3, 0.9], [1.0, 1.0]], "corners": [false, true, false]})
+ }
+
+ #[test]
+ fn new_save_load_round_trips_and_names_stay_unique() {
+ let mut s = Session::new();
+ let r = new(&mut s, &json!({"contour": curve("x"), "name": "Ramp"})).unwrap();
+ assert_eq!(r["name"], "Ramp");
+ // A standard contour's name can't be shadowed; repeats get a suffix.
+ assert_eq!(new(&mut s, &json!({"contour": curve("x"), "name": "Cone"})).unwrap()["name"], "Cone 2");
+ assert_eq!(new(&mut s, &json!({"contour": "Ring", "name": "Ramp"})).unwrap()["name"], "Ramp 2");
+ let saved = save(&mut s, &json!({})).unwrap();
+ let data = saved["data"].clone();
+ assert_eq!(saved["count"], 3);
+ // Replace swaps the library for the file's contours; the curve and its corner survive.
+ delete(&mut s, &json!({"name": "Ramp"})).unwrap();
+ let r = load(&mut s, &json!({"data": data, "mode": "replace"})).unwrap();
+ assert_eq!(r["count"], 3);
+ let c = contour_from_param(&list(&mut s, &json!({})).unwrap()["contours"][0]["contour"]).unwrap();
+ assert!(c.is_corner(1));
+ // Appending the same file again keeps every name unique.
+ let r = load(&mut s, &json!({"data": data})).unwrap();
+ assert_eq!(r["count"], 6);
+ let names: std::collections::HashSet<_> = s.presets.contours.iter().map(|c| name_of(c).to_string()).collect();
+ assert_eq!(names.len(), 6);
+ }
+
+ #[test]
+ fn library_persists_with_the_presets() {
+ let mut s = Session::new();
+ new(&mut s, &json!({"contour": curve("x"), "name": "Mine"})).unwrap();
+ let saved = s.presets.to_json(&s);
+ let mut t = Session::new();
+ t.load_presets_json(saved);
+ assert_eq!(t.presets.contours.len(), 1);
+ assert_eq!(name_of(&t.presets.contours[0]), "Mine");
+ assert_eq!(t.presets.contours, s.presets.contours);
+ }
+
+ #[test]
+ fn bad_params_are_errors_not_panics() {
+ let mut s = Session::new();
+ for p in
+ [json!({}), json!({"contour": 5}), json!({"contour": "Nope"}), json!({"contour": {"points": [[0, 0]]}}), json!({"contour": curve("x"), "name": 3})]
+ {
+ assert!(new(&mut s, &p).is_err(), "{p}");
+ }
+ assert!(delete(&mut s, &json!({"name": "ghost"})).is_err());
+ assert!(delete(&mut s, &json!({})).is_err());
+ assert!(save(&mut s, &json!({})).is_err(), "empty library");
+ for p in [
+ json!({}),
+ json!({"data": 3}),
+ json!({"data": "!!"}),
+ json!({"data": "AAAA"}),
+ json!({"data": "AAAA", "mode": "x"}),
+ json!({"path": "/nonexistent/x.shc"}),
+ ] {
+ assert!(load(&mut s, &p).is_err(), "{p}");
+ }
+ assert!(s.presets.contours.is_empty());
+ let big = from_json(&json!([{"points": [[0, 0]]}, "Ring", 7, {"name": "Cone", "points": [[0, 0], [1, 1]]}]));
+ assert_eq!(big.len(), 1);
+ assert_eq!(name_of(&big[0]), "Cone 2");
+ }
+}
diff --git a/crates/engine/src/layer_style.rs b/crates/engine/src/layer_style.rs
index 878bcaca0..5ea402840 100644
--- a/crates/engine/src/layer_style.rs
+++ b/crates/engine/src/layer_style.rs
@@ -448,16 +448,27 @@ pub fn contours_from_shc(bytes: &[u8]) -> Result<Vec<Value>> {
/// An `.shc` file holding `contour` (Contour Editor › Save…).
pub fn contour_to_shc(contour: &Contour) -> Result<Vec<u8>> {
- let (name, points) = match contour {
- Contour::Linear => ("Linear".to_string(), vec![CurvePoint { input: 0.0, output: 0.0 }, CurvePoint { input: 1.0, output: 1.0 }]),
- Contour::Custom { name, points, .. } => (name.clone(), points.clone()),
- };
- let points = points
+ contour_to_shc_all(&[contour])
+}
+
+/// An `.shc` file holding every contour of `list` (Save Contours…).
+pub fn contour_to_shc_all(list: &[&Contour]) -> Result<Vec<u8>> {
+ let file: Vec<photocraft_psd::shc::ShcContour> = list
.iter()
- .enumerate()
- .map(|(i, p)| photocraft_psd::shc::ShcPoint { input: p.input * 255.0, output: p.output * 255.0, continuous: !contour.is_corner(i) })
+ .map(|contour| {
+ let (name, points) = match contour {
+ Contour::Linear => ("Linear".to_string(), vec![CurvePoint { input: 0.0, output: 0.0 }, CurvePoint { input: 1.0, output: 1.0 }]),
+ Contour::Custom { name, points, .. } => (name.clone(), points.clone()),
+ };
+ let points = points
+ .iter()
+ .enumerate()
+ .map(|(i, p)| photocraft_psd::shc::ShcPoint { input: p.input * 255.0, output: p.output * 255.0, continuous: !contour.is_corner(i) })
+ .collect();
+ photocraft_psd::shc::ShcContour { name, points }
+ })
.collect();
- photocraft_psd::shc::write(&[photocraft_psd::shc::ShcContour { name, points }]).map_err(|e| EngineError::Other(format!("can't write the contour: {e}")))
+ photocraft_psd::shc::write(&file).map_err(|e| EngineError::Other(format!("can't write the contour: {e}")))
}
/// An effect of `kind` with its factory settings (before params are applied).
diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs
index c9cb72551..e0b7f199f 100644
--- a/crates/engine/src/lib.rs
+++ b/crates/engine/src/lib.rs
@@ -28,6 +28,7 @@ pub mod color_cmds;
pub mod color_to_alpha_cmds;
pub mod commands;
pub mod comps_cmds;
+pub mod contour_lib_cmds;
pub mod cutout_cmds;
pub mod display_color;
pub mod distort_cmds;
diff --git a/crates/engine/src/presets/mod.rs b/crates/engine/src/presets/mod.rs
index 5a72f781f..8d8f61d5b 100644
--- a/crates/engine/src/presets/mod.rs
+++ b/crates/engine/src/presets/mod.rs
@@ -89,6 +89,8 @@ pub struct PresetState {
pub layer_defaults: BTreeMap<String, Value>,
/// Swatches panel library.
pub swatches: Vec<Group<swatches::Swatch>>,
+ /// The user contour library of the Layer Style dialog (`layer.layerStyle.contours.*`).
+ pub contours: Vec<photocraft_doc::Contour>,
/// Bumped on every preset change (UIs key thumbnail caches on it).
pub rev: u64,
}
@@ -108,6 +110,7 @@ impl Default for PresetState {
clone: Default::default(),
layer_defaults: BTreeMap::new(),
swatches: swatches::builtin(),
+ contours: Vec::new(),
rev: 0,
}
}
@@ -139,6 +142,9 @@ struct Persisted {
#[serde(default)]
layer_defaults: Option<BTreeMap<String, Value>>,
swatches: Option<Vec<Group<swatches::Swatch>>>,
+ // Read entry by entry: a bad contour must not discard the other presets.
+ #[serde(default)]
+ contours: Option<Value>,
}
impl PresetState {
@@ -156,6 +162,7 @@ impl PresetState {
custom_shapes: Some(s.edit_state.custom_shapes.clone()),
layer_defaults: Some(self.layer_defaults.clone()),
swatches: Some(self.swatches.clone()),
+ contours: Some(crate::contour_lib_cmds::to_json(&self.contours)),
};
serde_json::to_value(p).unwrap_or(Value::Null)
}
@@ -202,6 +209,9 @@ impl Session {
crate::swatch_cmds::cap_library(&mut g);
self.presets.swatches = g;
}
+ if let Some(c) = p.contours {
+ self.presets.contours = crate::contour_lib_cmds::from_json(&c);
+ }
self.presets.rev += 1;
}
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index e7de3409a..10e403c3e 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -3665,3 +3665,9 @@ navigator Zoom Zvětšení
Remove after each stroke Odstranit po každém tahu
Apply the removal ({key}) Použít odstranění ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Tahy k odstranění: {n} (Enter použije, Esc zruší)
+ Load Contours… Načíst obrysy…
+ Replace Contours… Nahradit obrysy…
+ Save Contours… Uložit obrysy…
+ Delete Contour Smazat obrys
+ Loaded contours from {file} Obrysy načteny ze souboru {file}
+ Saved contours to {file} Obrysy uloženy do souboru {file}
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index ac313154d..84bd096dd 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -2691,3 +2691,9 @@ curves Smooth Glätten
Remove after each stroke Nach jedem Strich entfernen
Apply the removal ({key}) Entfernen anwenden ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Striche zum Entfernen: {n} (Eingabe wendet an, Esc bricht ab)
+ Load Contours… Konturen laden…
+ Replace Contours… Konturen ersetzen…
+ Save Contours… Konturen speichern…
+ Delete Contour Kontur löschen
+ Loaded contours from {file} Konturen aus {file} geladen
+ Saved contours to {file} Konturen in {file} gespeichert
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index e5be10559..21d9817f8 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -3749,3 +3749,9 @@ curves Smooth Εξομάλυνση
Remove after each stroke Αφαίρεση μετά από κάθε πινελιά
Apply the removal ({key}) Εφαρμογή της αφαίρεσης ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Πινελιές προς αφαίρεση: {n} (Enter εφαρμόζει, Esc ακυρώνει)
+ Load Contours… Φόρτωση περιγραμμάτων…
+ Replace Contours… Αντικατάσταση περιγραμμάτων…
+ Save Contours… Αποθήκευση περιγραμμάτων…
+ Delete Contour Διαγραφή περιγράμματος
+ Loaded contours from {file} Φορτώθηκαν περιγράμματα από {file}
+ Saved contours to {file} Τα περιγράμματα αποθηκεύτηκαν στο {file}
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index b98695654..188e5396b 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -2732,3 +2732,9 @@ curves Smooth Suavizar
Remove after each stroke Eliminar después de cada trazo
Apply the removal ({key}) Aplicar la eliminación ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Trazos por eliminar: {n} (Intro aplica, Esc cancela)
+ Load Contours… Cargar contornos…
+ Replace Contours… Reemplazar contornos…
+ Save Contours… Guardar contornos…
+ Delete Contour Eliminar contorno
+ Loaded contours from {file} Contornos cargados de {file}
+ Saved contours to {file} Contornos guardados en {file}
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index f426b28c5..f51b1f008 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -3052,3 +3052,9 @@ curves Smooth Lisser
Remove after each stroke Supprimer après chaque trait
Apply the removal ({key}) Appliquer la suppression ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Traits à supprimer : {n} (Entrée applique, Échap annule)
+ Load Contours… Charger des contours…
+ Replace Contours… Remplacer les contours…
+ Save Contours… Enregistrer les contours…
+ Delete Contour Supprimer le contour
+ Loaded contours from {file} Contours chargés depuis {file}
+ Saved contours to {file} Contours enregistrés dans {file}
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index 080e204aa..e198e47d0 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -3970,3 +3970,9 @@ cameraRaw Yellow Sárga
Transform On Drop Átalakítás elengedéskor
Vanishing Point is not active Az Enyészpont nem aktív
Vanishing Point: click four corners to create a plane Enyészpont: sík létrehozásához kattintson a négy sarokra
+ Load Contours… Kontúrok betöltése…
+ Replace Contours… Kontúrok cseréje…
+ Save Contours… Kontúrok mentése…
+ Delete Contour Kontúr törlése
+ Loaded contours from {file} Kontúrok betöltve: {file}
+ Saved contours to {file} Kontúrok mentve: {file}
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 420600cf3..51ecd6305 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -3039,3 +3039,9 @@ curves Smooth Haluskan
Remove after each stroke Hapus setelah setiap goresan
Apply the removal ({key}) Terapkan penghapusan ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Goresan untuk dihapus: {n} (Enter menerapkan, Esc membatalkan)
+ Load Contours… Muat kontur…
+ Replace Contours… Ganti kontur…
+ Save Contours… Simpan kontur…
+ Delete Contour Hapus kontur
+ Loaded contours from {file} Kontur dimuat dari {file}
+ Saved contours to {file} Kontur disimpan ke {file}
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index 410ab8f60..b102959d2 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -4015,3 +4015,9 @@ navigator Zoom Zoom
Remove after each stroke Rimuovi dopo ogni tratto
Apply the removal ({key}) Applica la rimozione ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Tratti da rimuovere: {n} (Invio applica, Esc annulla)
+ Load Contours… Carica profili…
+ Replace Contours… Sostituisci profili…
+ Save Contours… Salva profili…
+ Delete Contour Elimina profilo
+ Loaded contours from {file} Profili caricati da {file}
+ Saved contours to {file} Profili salvati in {file}
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 7e5e65a63..7fcf17895 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -3661,3 +3661,9 @@ curves Smooth スムーズ
Remove after each stroke ストロークごとに削除
Apply the removal ({key}) 削除を適用 ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) 削除するストローク: {n}(Enter で適用、Esc で取り消し)
+ Load Contours… カーブを読み込み…
+ Replace Contours… カーブを置き換え…
+ Save Contours… カーブを保存…
+ Delete Contour カーブを削除
+ Loaded contours from {file} {file} からカーブを読み込みました
+ Saved contours to {file} カーブを {file} に保存しました
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index f48633c2c..447ef4bfb 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -3221,3 +3221,9 @@ curves Smooth 매끄럽게
Remove after each stroke 획마다 제거
Apply the removal ({key}) 제거 적용 ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) 제거할 획: {n} (Enter 적용, Esc 취소)
+ Load Contours… 윤곽선 불러오기…
+ Replace Contours… 윤곽선 바꾸기…
+ Save Contours… 윤곽선 저장…
+ Delete Contour 윤곽선 삭제
+ Loaded contours from {file} {file}에서 윤곽선을 불러왔습니다
+ Saved contours to {file} 윤곽선을 {file}에 저장했습니다
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index 3778a8a1d..9340e71b3 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -3811,3 +3811,9 @@ curves Smooth Vloeiend maken
Remove after each stroke Verwijderen na elke streek
Apply the removal ({key}) Verwijdering toepassen ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Streken om te verwijderen: {n} (Enter past toe, Esc annuleert)
+ Load Contours… Contouren laden…
+ Replace Contours… Contouren vervangen…
+ Save Contours… Contouren opslaan…
+ Delete Contour Contour verwijderen
+ Loaded contours from {file} Contouren geladen uit {file}
+ Saved contours to {file} Contouren opgeslagen in {file}
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index ce9387b62..c51d0aeaa 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -3648,3 +3648,9 @@ curves Smooth Wygładź
Remove after each stroke Usuwaj po każdym pociągnięciu
Apply the removal ({key}) Zastosuj usuwanie ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Pociągnięcia do usunięcia: {n} (Enter stosuje, Esc anuluje)
+ Load Contours… Wczytaj kontury…
+ Replace Contours… Zamień kontury…
+ Save Contours… Zapisz kontury…
+ Delete Contour Usuń kontur
+ Loaded contours from {file} Wczytano kontury z {file}
+ Saved contours to {file} Zapisano kontury w {file}
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 92e9c238b..e70106ce8 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -3841,3 +3841,9 @@ layerLabel No Color Sem cor
Remove after each stroke Remover após cada traço
Apply the removal ({key}) Aplicar a remoção ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Traços a remover: {n} (Enter aplica, Esc cancela)
+ Load Contours… Carregar contornos…
+ Replace Contours… Substituir contornos…
+ Save Contours… Salvar contornos…
+ Delete Contour Excluir contorno
+ Loaded contours from {file} Contornos carregados de {file}
+ Saved contours to {file} Contornos salvos em {file}
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 7e1d12bbb..b5e27f5f5 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -2996,3 +2996,9 @@ curves Smooth Сгладить
Remove after each stroke Удалять после каждого штриха
Apply the removal ({key}) Применить удаление ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Штрихов к удалению: {n} (Enter применяет, Esc отменяет)
+ Load Contours… Загрузить контуры…
+ Replace Contours… Заменить контуры…
+ Save Contours… Сохранить контуры…
+ Delete Contour Удалить контур
+ Loaded contours from {file} Контуры загружены из {file}
+ Saved contours to {file} Контуры сохранены в {file}
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index 617ad81fd..85b8ac944 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -3782,3 +3782,9 @@ cameraData Lens Lens
@plural {n} step|{n} steps {n} adım
@plural {warning} (+{n} more brush preset warning)|{warning} (+{n} more brush preset warnings) {warning} (+{n} fırça ön ayarı uyarısı daha)
@plural {what} with {n} warning|{what} with {n} warnings {what}, {n} uyarı ile
+ Load Contours… Konturları yükle…
+ Replace Contours… Konturları değiştir…
+ Save Contours… Konturları kaydet…
+ Delete Contour Konturu sil
+ Loaded contours from {file} Konturlar {file} dosyasından yüklendi
+ Saved contours to {file} Konturlar {file} dosyasına kaydedildi
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index 11a4caa9c..3fbeb9bca 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -3749,3 +3749,9 @@ curves Smooth Згладити
Remove after each stroke Видаляти після кожного штриха
Apply the removal ({key}) Застосувати видалення ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Штрихів для видалення: {n} (Enter застосовує, Esc скасовує)
+ Load Contours… Завантажити контури…
+ Replace Contours… Замінити контури…
+ Save Contours… Зберегти контури…
+ Delete Contour Видалити контур
+ Loaded contours from {file} Контури завантажено з {file}
+ Saved contours to {file} Контури збережено в {file}
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index ca091c14d..2762fb3e1 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -3535,3 +3535,9 @@ curves Smooth Làm mượt
Remove after each stroke Xóa sau mỗi nét vẽ
Apply the removal ({key}) Áp dụng việc xóa ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) Nét vẽ cần xóa: {n} (Enter áp dụng, Esc hủy)
+ Load Contours… Tải đường viền…
+ Replace Contours… Thay thế đường viền…
+ Save Contours… Lưu đường viền…
+ Delete Contour Xóa đường viền
+ Loaded contours from {file} Đã tải đường viền từ {file}
+ Saved contours to {file} Đã lưu đường viền vào {file}
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index d0309166c..36c742cd5 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -2656,3 +2656,9 @@ curves Smooth 平滑
Remove after each stroke 每次描边后移除
Apply the removal ({key}) 应用移除 ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) 待移除的描边:{n}(Enter 应用,Esc 取消)
+ Load Contours… 载入等高线…
+ Replace Contours… 替换等高线…
+ Save Contours… 存储等高线…
+ Delete Contour 删除等高线
+ Loaded contours from {file} 已从 {file} 载入等高线
+ Saved contours to {file} 已将等高线存储到 {file}
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index 8698dfc07..dd4261db8 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -2641,3 +2641,9 @@ curves Smooth 平滑
Remove after each stroke 每次描邊後移除
Apply the removal ({key}) 套用移除 ({key})
Strokes to remove: {n} (Enter applies, Esc cancels) 待移除的描邊:{n}(Enter 套用,Esc 取消)
+ Load Contours… 載入等高線…
+ Replace Contours… 取代等高線…
+ Save Contours… 儲存等高線…
+ Delete Contour 刪除等高線
+ Loaded contours from {file} 已從 {file} 載入等高線
+ Saved contours to {file} 已將等高線儲存到 {file}
diff --git a/crates/ui-egui/src/layer_style.rs b/crates/ui-egui/src/layer_style.rs
index b350cef52..c8cd96cd4 100644
--- a/crates/ui-egui/src/layer_style.rs
+++ b/crates/ui-egui/src/layer_style.rs
@@ -987,7 +987,7 @@ pub fn body(app: &mut PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<String, Valu
}
});
}
- P::Contour(aa) => contour::row(ui, f, &selected, key, label, aa, &mut disp),
+ P::Contour(aa) => contour::row(app, ui, f, &selected, key, label, aa, &mut disp),
P::Check => {
let mut b = disp.get(key).and_then(Value::as_bool).unwrap_or(false);
if widgets::checkbox(ui, &mut b, label).changed() {
diff --git a/crates/ui-egui/src/layer_style/contour.rs b/crates/ui-egui/src/layer_style/contour.rs
index 2f43c676c..d6e8eb490 100644
--- a/crates/ui-egui/src/layer_style/contour.rs
+++ b/crates/ui-egui/src/layer_style/contour.rs
@@ -70,13 +70,36 @@ fn picker_target(effect: &str, key: &str) -> Value {
/// Picks a preset for `effect`'s `key` (the picker's click).
pub(super) fn pick(f: &mut Map<String, Value>, effect: &str, key: &str, name: &str) {
- set_param(f, effect, key, json!(name));
+ pick_param(f, effect, key, json!(name));
+}
+
+/// Picks a contour param (a preset name, or a user contour's curve object).
+pub(super) fn pick_param(f: &mut Map<String, Value>, effect: &str, key: &str, param: Value) {
+ set_param(f, effect, key, param);
f.remove(PICKER);
}
+/// What the picker's menu asked for (Photoshop's Load, Save and Replace Contours).
+#[derive(Clone, Copy, PartialEq)]
+enum Act {
+ Load,
+ Replace,
+ Save,
+}
+
/// The Contour row of an effect page: label, thumbnail (opens the Contour Editor), the preset
/// picker arrow and, when the effect has one, Anti-aliased.
-pub(super) fn row(ui: &mut egui::Ui, f: &mut Map<String, Value>, effect: &str, key: &str, label: &str, aa_key: Option<&str>, disp: &mut Value) {
+#[allow(clippy::too_many_arguments)]
+pub(super) fn row(
+ app: &mut PhotocraftApp,
+ ui: &mut egui::Ui,
+ f: &mut Map<String, Value>,
+ effect: &str,
+ key: &str,
+ label: &str,
+ aa_key: Option<&str>,
+ disp: &mut Value,
+) {
let t = Tokens::get(ui.ctx());
ui.horizontal(|ui| {
if label.is_empty() {
@@ -105,6 +128,10 @@ pub(super) fn row(ui: &mut egui::Ui, f: &mut Map<String, Value>, effect: &str, k
open = !open;
}
let mut chosen: Option<&str> = None;
+ let mut chosen_user: Option<Value> = None;
+ let mut delete: Option<String> = None;
+ let mut act: Option<Act> = None;
+ let user = app.session.presets.contours.clone();
egui::Popup::from_response(&arrow).open_bool(&mut open).close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside).show(|ui| {
ui.spacing_mut().item_spacing = vec2(4.0, 4.0);
egui::Grid::new(("contour-presets", effect, key)).spacing(vec2(4.0, 4.0)).show(ui, |ui| {
@@ -123,7 +150,55 @@ pub(super) fn row(ui: &mut egui::Ui, f: &mut Map<String, Value>, effect: &str, k
}
}
});
+ // The user's own contours follow the standard ones (Contour Editor › New…).
+ if !user.is_empty() {
+ ui.add_space(4.0);
+ egui::Grid::new(("contour-user", effect, key)).spacing(vec2(4.0, 4.0)).show(ui, |ui| {
+ for (i, u) in user.iter().enumerate() {
+ let (r, resp) = ui.allocate_exact_size(vec2(40.0, 40.0), Sense::click());
+ draw(ui.painter(), r, u, t.text, &t);
+ if *u == c || resp.hovered() {
+ ui.painter().rect_stroke(r, 0.0, Stroke::new(1.5, t.accent), StrokeKind::Outside);
+ }
+ let name = name_of(u).to_string();
+ let resp = resp.on_hover_text(name.as_str());
+ if resp.clicked() {
+ chosen_user = Some(contour_param(u));
+ }
+ resp.context_menu(|ui| {
+ if ui.button(tl!("Delete Contour")).clicked() {
+ delete = Some(name.clone());
+ ui.close();
+ }
+ });
+ if i % 4 == 3 {
+ ui.end_row();
+ }
+ }
+ });
+ }
+ ui.separator();
+ if ui.button(tl!("Load Contours…")).clicked() {
+ act = Some(Act::Load);
+ }
+ if ui.button(tl!("Replace Contours…")).clicked() {
+ act = Some(Act::Replace);
+ }
+ if ui.add_enabled(!user.is_empty(), egui::Button::new(tl!("Save Contours…"))).clicked() {
+ act = Some(Act::Save);
+ }
});
+ if let Some(name) = delete {
+ let r = app.run("layer.layerStyle.contours.delete", json!({"name": name}));
+ report(app, r);
+ }
+ if let Some(act) = act {
+ library_action(app, act);
+ }
+ if let Some(param) = chosen_user {
+ disp[key] = param.clone();
+ pick_param(f, effect, key, param);
+ }
if let Some(name) = chosen {
disp[key] = json!(name);
pick(f, effect, key, name);
@@ -259,6 +334,10 @@ pub(super) fn editor(app: &mut PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<Str
let mut close: Option<bool> = None;
let mut load = false;
let mut save = false;
+ let naming_id = mem.with("naming");
+ let mut naming: Option<String> = ctx.data(|d| d.get_temp(naming_id));
+ let mut new_clicked = false;
+ let mut commit_name = false;
let mut preset: Option<String> = None;
let modal = egui::Modal::new(mem.with("modal")).show(&ctx, |ui| {
ui.label(RichText::new(tl!("Contour Editor")).font(crate::theme::semibold(14.0)).color(t.text));
@@ -321,6 +400,20 @@ pub(super) fn editor(app: &mut PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<Str
}
}
ui.add_space(6.0);
+ if let Some(name) = naming.as_mut() {
+ ui.horizontal(|ui| {
+ ui.label(RichText::new(tl!("Name:")).color(t.text_dim));
+ let r = widgets::text_field(ui, mem.with("name-field"), name, "", 150.0, false);
+ r.request_focus();
+ if r.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter)) {
+ commit_name = true;
+ }
+ if widgets::primary_button(ui, tl!("OK"), 60.0).clicked() {
+ commit_name = true;
+ }
+ });
+ ui.add_space(6.0);
+ }
let sel = st.selected.filter(|i| *i < pts.len());
ui.horizontal(|ui| {
let (mut vi, mut vo) = sel.and_then(|i| pts.get(i)).map_or((0.0, 0.0), |q| ((q[0] / 2.55).round(), (q[1] / 2.55).round()));
@@ -355,17 +448,38 @@ pub(super) fn editor(app: &mut PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<Str
load = widgets::secondary_button(ui, tl!("Load…"), 84.0).clicked();
ui.add_space(4.0);
save = widgets::secondary_button(ui, tl!("Save…"), 84.0).clicked();
+ ui.add_space(4.0);
+ new_clicked = widgets::secondary_button(ui, tl!("New…"), 84.0).clicked();
});
});
});
ctx.data_mut(|d| d.insert_temp(mem, st));
+ if new_clicked && naming.is_none() {
+ // Photoshop asks for the new contour's name; "Contour N" is its suggestion.
+ naming = Some(format!("Contour {}", app.session.presets.contours.len() + 1));
+ }
+ if commit_name && let Some(name) = naming.take() {
+ let name = if name.trim().is_empty() { "Contour".to_string() } else { name };
+ match app.run("layer.layerStyle.contours.new", json!({"contour": contour_param(&shown_contour(&pts, &corners, name_of(&c))), "name": name})) {
+ Ok(v) => set_param(f, &effect, &key, v["contour"].clone()),
+ Err(e) => report(app, Err(e)),
+ }
+ }
+ ctx.data_mut(|d| match &naming {
+ Some(n) => {
+ d.insert_temp(naming_id, n.clone());
+ }
+ None => {
+ d.remove_temp::<String>(naming_id);
+ }
+ });
if let Some(name) = preset {
set_param(f, &effect, &key, json!(name));
}
if close.is_none() && modal.should_close() {
close = Some(false);
}
- if close.is_none() && ctx.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Enter)) {
+ if close.is_none() && naming.is_none() && !commit_name && ctx.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Enter)) {
close = Some(true);
}
if let Some(keep) = close {
@@ -396,6 +510,42 @@ pub(super) fn editor(app: &mut PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<Str
}
}
+/// The edited curve (levels `0..=255`) as a contour.
+fn shown_contour(pts: &[[f32; 2]], corners: &[bool], name: &str) -> Contour {
+ Contour::Custom {
+ name: name.to_string(),
+ points: pts.iter().map(|q| CurvePoint { input: q[0] / 255.0, output: q[1] / 255.0 }).collect(),
+ corners: corners.to_vec(),
+ }
+}
+
+/// Load, Replace or Save Contours: the library lives in the session, the file is an `.shc`.
+fn library_action(app: &mut PhotocraftApp, act: Act) {
+ let r = match act {
+ Act::Load | Act::Replace => app.pick_file_bytes_filtered(&["shc"], move |app, name, bytes| {
+ let mut p = crate::swatches_ui::source(&name, &bytes);
+ p["mode"] = json!(if act == Act::Replace { "replace" } else { "append" });
+ let r = app.run("layer.layerStyle.contours.load", p)?;
+ let template = "Loaded contours from {file}";
+ app.ui.status_error = false;
+ app.ui.status = crate::i18n::fmt(tl!(template), &[("file", &crate::file_open::display_name(&name))]);
+ Ok(r)
+ }),
+ Act::Save => app.run("layer.layerStyle.contours.save", json!({})).and_then(|r| {
+ let bytes = r["data"].as_str().and_then(photocraft_engine::paint::tile::b64_decode).ok_or("the export returned no data")?;
+ app.pick_save("Contours.shc", move |app, path| {
+ let write = app.services.write.as_mut().ok_or("no writer configured")?;
+ write(&path, &bytes)?;
+ let template = "Saved contours to {file}";
+ app.ui.status_error = false;
+ app.ui.status = crate::i18n::fmt(tl!(template), &[("file", &crate::file_open::display_name(&path))]);
+ Ok(json!({"path": path}))
+ })
+ }),
+ };
+ report(app, r);
+}
+
fn report(app: &mut PhotocraftApp, r: Result<Value, String>) {
if let Err(e) = r
&& e != crate::file_dialog::CANCELLED
diff --git a/crates/ui-egui/src/swatches_ui.rs b/crates/ui-egui/src/swatches_ui.rs
index 3215f187b..276d40f13 100644
--- a/crates/ui-egui/src/swatches_ui.rs
+++ b/crates/ui-egui/src/swatches_ui.rs
@@ -140,7 +140,7 @@ fn new_group(app: &mut PhotocraftApp) {
/// Command params for a picked file: a real path keeps the journal small; browser files arrive
/// as bytes.
-fn source(name: &str, bytes: &[u8]) -> Value {
+pub(crate) fn source(name: &str, bytes: &[u8]) -> Value {
#[cfg(not(target_arch = "wasm32"))]
if std::path::Path::new(name).is_absolute() && std::path::Path::new(name).is_file() {
return json!({"path": name});
diff --git a/docs/scorecard.md b/docs/scorecard.md
index 78a086454..675185c53 100644
--- a/docs/scorecard.md
+++ b/docs/scorecard.md
@@ -112,7 +112,7 @@ Corpus floors (`crates/io/tests/corpus.rs`): the enforced minimums; the corpus t
| FILE-215-12 | Camera Raw dialog shows a histogram; settings persist as a PSD Smart Filter | partial | [#215](https://github.com/storytold/photocraft/issues/215) | Interactive RGB/Lab scopes. PSD WB/Light/Presence, curves, HSL, grading, sharpening/noise detail, grain and numeric vignette controls mapped with descriptor preservation. Active manual Optics and unverified vignette style keep the updated ACR 18.4 fixture opaque; PSD/.pcraft saves preserve it. HDR, remaining settings and Photoshop acceptance still open |
| FILE-215-13 | Video layer frames persist in .pcraft; PSD video layers mapped | partial | [#215](https://github.com/storytold/photocraft/issues/215) | format convert.rs:89 + tests/roundtrip.rs:282 persist frames; no PSD video mapping |
| FILE-215-14 | User swatch model with ACO/ASE import and export | done | [#215](https://github.com/storytold/photocraft/issues/215) | engine presets/swatches.rs (RGB/HSB/CMYK/Lab/Gray + verbatim colour books, persisted in prefs) + swatch_cmds.rs (swatches.*); psd aco.rs (v1/v2) and ase.rs (groups, spot/global) read+write; ui swatches_ui.rs, Color Picker Add to Swatches |
-| FILE-215-15 | Layer Style contour picker, curve editor, presets, .shc import/export | partial | [#2912](https://github.com/storytold/photocraft/issues/2912) | Layer Style dialog: contour thumbnail + preset picker (12 standard shapes, own control points) and Anti-aliased on Drop/Inner Shadow, Outer/Inner Glow, Satin, Bevel Gloss Contour and Contour element; Contour Editor (add/drag/delete, Corner, Input/Output, Preset, Load…/Save… .shc per Adobe's public spec, psd shc.rs); corner points render (compose contour_curve_lut) and map to PSD Cnty. Missing: a user contour library (New…, picker Load/Save/Replace Contours), Anti-aliased doesn't change the render yet, .shc not yet checked against a Photoshop-written file |
+| FILE-215-15 | Layer Style contour picker, curve editor, presets, .shc import/export | partial | [#2912](https://github.com/storytold/photocraft/issues/2912) | Layer Style dialog: contour thumbnail + preset picker (12 standard shapes, own control points) and Anti-aliased on Drop/Inner Shadow, Outer/Inner Glow, Satin, Bevel Gloss Contour and Contour element; Contour Editor (add/drag/delete, Corner, Input/Output, Preset, Load…/Save… .shc per Adobe's public spec, psd shc.rs); corner points render (compose contour_curve_lut) and map to PSD Cnty. User contour library: Contour Editor New… saves the curve under a name (layer.layerStyle.contours.new/list/delete/load/save, kept with the preferences), the picker lists user contours after the standard ones and has Load/Replace/Save Contours… (.shc). Missing: Anti-aliased doesn't change the render yet, .shc not yet checked against a Photoshop-written file |
| FILE-215-16 | Advanced Blending (knockout, blend as group, mask hides effects) end to end | partial | [#215](https://github.com/storytold/photocraft/issues/215) | doc advanced.rs + .pcraft + PSD/layered TIFF (knko infx clbl tsly lmgm vmgm), CPU compose advanced.rs (GPU falls back), blendingOptions command + dialog; 7 psd-tools knockout oracles now pass; knockout-isolated-groups (0.45 % AA edges), advanced-blending, blend-and-clipping still differ |
| FILE-215-17 | CMYK/RGB documents preview spot inks; spot plates export (TIFF extra samples, PDF) | missing | [#215](https://github.com/storytold/photocraft/issues/215) | compose multichannel.rs:1 spot preview for Multichannel only |
| FILE-215-18 | Save for Web per-slice settings remembered; Export As remembers and offers nearest scaling | partial | [#215](https://github.com/storytold/photocraft/issues/215) | file_ui.rs:188 last_web in-session only; export_dialog.rs:16 fixed defaults |
diff --git a/scorecard/file_compat.toml b/scorecard/file_compat.toml
index e6943b578..5b2c55471 100644
--- a/scorecard/file_compat.toml
+++ b/scorecard/file_compat.toml
@@ -108,7 +108,7 @@ id = "FILE-215-15"
target = "Layer Style contour picker, curve editor, presets, .shc import/export"
status = "partial"
issue = 2912
-note = "Layer Style dialog: contour thumbnail + preset picker (12 standard shapes, own control points) and Anti-aliased on Drop/Inner Shadow, Outer/Inner Glow, Satin, Bevel Gloss Contour and Contour element; Contour Editor (add/drag/delete, Corner, Input/Output, Preset, Load…/Save… .shc per Adobe's public spec, psd shc.rs); corner points render (compose contour_curve_lut) and map to PSD Cnty. Missing: a user contour library (New…, picker Load/Save/Replace Contours), Anti-aliased doesn't change the render yet, .shc not yet checked against a Photoshop-written file"
+note = "Layer Style dialog: contour thumbnail + preset picker (12 standard shapes, own control points) and Anti-aliased on Drop/Inner Shadow, Outer/Inner Glow, Satin, Bevel Gloss Contour and Contour element; Contour Editor (add/drag/delete, Corner, Input/Output, Preset, Load…/Save… .shc per Adobe's public spec, psd shc.rs); corner points render (compose contour_curve_lut) and map to PSD Cnty. User contour library: Contour Editor New… saves the curve under a name (layer.layerStyle.contours.new/list/delete/load/save, kept with the preferences), the picker lists user contours after the standard ones and has Load/Replace/Save Contours… (.shc). Missing: Anti-aliased doesn't change the render yet, .shc not yet checked against a Photoshop-written file"
[[item]]
id = "FILE-215-16"