PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Bevel & Emboss: keep the Gloss Contour's Anti-aliased (antialiasGloss)
varanus-salvator92aa5047cd88
diff --git a/crates/compose/src/effects.rs b/crates/compose/src/effects.rsindex 5acdd7931..a3d1bd998 100644--- a/crates/compose/src/effects.rs+++ b/crates/compose/src/effects.rs@@ -2462,6 +2462,7 @@ mod tests {altitude: 30.0,use_global_light: false,gloss_contour: Contour::Linear,+ gloss_anti_alias: false,highlight: photocraft_doc::FxCommon::new(BlendMode::Screen, 0.75),highlight_color: photocraft_color::Color::WHITE,shadow: photocraft_doc::FxCommon::new(BlendMode::Multiply, 0.75),diff --git a/crates/compose/src/tests.rs b/crates/compose/src/tests.rsindex eb4b25072..66a2947c1 100644--- a/crates/compose/src/tests.rs+++ b/crates/compose/src/tests.rs@@ -1122,6 +1122,7 @@ fn satin_and_bevel_stay_inside_shape() {altitude: 30.0,use_global_light: false,gloss_contour: photocraft_doc::Contour::Linear,+ gloss_anti_alias: false,highlight: FxCommon::new(photocraft_color::BlendMode::Screen, 0.75),highlight_color: Color::WHITE,shadow: FxCommon::new(photocraft_color::BlendMode::Multiply, 0.75),@@ -1298,6 +1299,7 @@ fn bevel_fx(style: photocraft_doc::BevelStyle, soften: f32) -> Effect {altitude: 30.0,use_global_light: false,gloss_contour: photocraft_doc::Contour::Linear,+ gloss_anti_alias: false,highlight: FxCommon::new(photocraft_color::BlendMode::Screen, 0.75),highlight_color: Color::WHITE,shadow: FxCommon::new(photocraft_color::BlendMode::Multiply, 0.75),@@ -1538,6 +1540,7 @@ fn emboss_shades_the_composited_layer() {altitude: 30.0,use_global_light: false,gloss_contour: photocraft_doc::Contour::Linear,+ gloss_anti_alias: false,highlight: FxCommon::new(photocraft_color::BlendMode::Normal, 1.0),highlight_color: Color::WHITE,shadow: FxCommon::new(photocraft_color::BlendMode::Multiply, 0.0),@@ -2547,6 +2550,7 @@ fn nested_parallel_fx_doc() -> Document {altitude: 32.0,use_global_light: false,gloss_contour: Contour::Linear,+ gloss_anti_alias: false,highlight: FxCommon::new(BlendMode::Screen, 0.75),highlight_color: Color::WHITE,shadow: FxCommon::new(BlendMode::Multiply, 0.75),diff --git a/crates/doc/src/effects.rs b/crates/doc/src/effects.rsindex 6ae790e26..d242e0e51 100644--- a/crates/doc/src/effects.rs+++ b/crates/doc/src/effects.rs@@ -213,6 +213,9 @@ pub struct Bevel {pub altitude: f32,pub use_global_light: bool,pub gloss_contour: Contour,+ /// Gloss Contour › Anti-aliased (PSD `antialiasGloss`).+ #[serde(default)]+ pub gloss_anti_alias: bool,pub highlight: FxCommon,pub highlight_color: Color,pub shadow: FxCommon,diff --git a/crates/engine/src/layer_style.rs b/crates/engine/src/layer_style.rsindex 95b547685..19d19db26 100644--- a/crates/engine/src/layer_style.rs+++ b/crates/engine/src/layer_style.rs@@ -98,7 +98,7 @@ pub fn effect_defaults(kind: &str) -> Value {}"patternOverlay" => json!({"blend": "Normal", "opacity": 100, "pattern": "", "angle": 0, "scale": 100, "link": true}),"bevelEmboss" => {- json!({"style": "inner", "technique": "smooth", "depth": 100, "direction": "up", "size": 5, "soften": 0, "angle": 120, "useGlobalLight": true, "altitude": 30, "glossContour": "Linear", "contour": false, "contourName": "Linear", "contourRange": 50, "contourAntiAlias": false})+ json!({"style": "inner", "technique": "smooth", "depth": 100, "direction": "up", "size": 5, "soften": 0, "angle": 120, "useGlobalLight": true, "altitude": 30, "glossContour": "Linear", "glossAntiAlias": false, "contour": false, "contourName": "Linear", "contourRange": 50, "contourAntiAlias": false})}"satin" => {json!({"blend": "Multiply", "color": "#000000", "opacity": 50, "angle": 19, "distance": 11, "size": 14, "contour": "Linear", "antiAlias": true, "invert": true})@@ -544,6 +544,7 @@ fn fresh_effect(kind: &str) -> Option<Effect> {altitude: 30.0,use_global_light: true,gloss_contour: Contour::Linear,+ gloss_anti_alias: false,highlight: FxCommon::new(BlendMode::Screen, 0.75),highlight_color: Color::WHITE,shadow: FxCommon::new(BlendMode::Multiply, 0.75),@@ -789,6 +790,7 @@ pub fn overlay_effect(fx: &mut Effect, p: &Value) {bv.use_global_light = x;}set_contour(p, "glossContour", &mut bv.gloss_contour);+ set_bool(p, "glossAntiAlias", &mut bv.gloss_anti_alias);// The Contour element: `contour` turns it on/off; its curve, Range and// Anti-aliased edit the element in place, so an imported curve survives.match b_of(p, "contour") {@@ -1021,7 +1023,7 @@ pub fn specs() -> Vec<CommandSpec> {style_cmd!("bevelEmboss","Bevel & Emboss…",- r##"{"style":"inner|outer|emboss|pillow|stroke","technique":"smooth|chiselHard|chiselSoft","contour":bool,"contourName":name|curve,"contourRange":1..100=50,"contourAntiAlias":bool,"glossContour":name|curve,"texture":pattern id|name?,"textureScale":1..1000=100,"textureDepth":-1000..1000=100,"textureInvert":bool,"textureLink":bool=true,"depth":1..1000=100,"direction":"up|down","size":px=5,"soften":px,"angle":deg,"altitude":deg,"add":bool}"##+ r##"{"style":"inner|outer|emboss|pillow|stroke","technique":"smooth|chiselHard|chiselSoft","contour":bool,"contourName":name|curve,"contourRange":1..100=50,"contourAntiAlias":bool,"glossContour":name|curve,"glossAntiAlias":bool,"texture":pattern id|name?,"textureScale":1..1000=100,"textureDepth":-1000..1000=100,"textureInvert":bool,"textureLink":bool=true,"depth":1..1000=100,"direction":"up|down","size":px=5,"soften":px,"angle":deg,"altitude":deg,"add":bool}"##),style_cmd!("satin",@@ -1137,6 +1139,17 @@ mod tests {assert_eq!((t.name.as_str(), t.depth, t.invert), ("Bubbles", -2.0, true));}+ #[test]+ fn bevel_gloss_anti_alias_is_a_param() {+ let mut s = session();+ s.execute("layer.layerStyle.bevelEmboss", json!({"glossContour": "Ring - Double", "glossAntiAlias": true})).unwrap();+ let Effect::BevelEmboss(b) = &effects(&s)[0] else { panic!() };+ assert!(b.gloss_anti_alias);+ s.execute("layer.layerStyle.bevelEmboss", json!({"glossAntiAlias": false})).unwrap();+ let Effect::BevelEmboss(b) = &effects(&s)[0] else { panic!() };+ assert!(!b.gloss_anti_alias);+ }+#[test]fn every_style_command_adds_its_effect() {for kind in ["dropShadow", "innerShadow", "outerGlow", "innerGlow", "stroke", "colorOverlay", "gradientOverlay", "bevelEmboss", "satin"] {diff --git a/crates/format/tests/roundtrip.rs b/crates/format/tests/roundtrip.rsindex f78e93947..28236cf5c 100644--- a/crates/format/tests/roundtrip.rs+++ b/crates/format/tests/roundtrip.rs@@ -579,6 +579,7 @@ fn channel_restrictions_and_bevel_elements_roundtrip() {altitude: 40.0,use_global_light: false,gloss_contour: Contour::Linear,+ gloss_anti_alias: false,highlight: photocraft_doc::FxCommon::new(photocraft_color::BlendMode::Screen, 0.7),highlight_color: photocraft_color::Color::WHITE,shadow: photocraft_doc::FxCommon::new(photocraft_color::BlendMode::Multiply, 0.6),diff --git a/crates/gpu/tests/parity.rs b/crates/gpu/tests/parity.rsindex 84d3d0e93..9e3643fde 100644--- a/crates/gpu/tests/parity.rs+++ b/crates/gpu/tests/parity.rs@@ -1330,6 +1330,7 @@ fn bevel(style: BevelStyle, up: bool, size: f32, soften: f32) -> Bevel {altitude: 35.0,use_global_light: true,gloss_contour: Contour::Linear,+ gloss_anti_alias: false,highlight: FxCommon::new(BlendMode::Screen, 0.8),highlight_color: Color::rgb(1.0, 1.0, 0.9),shadow: FxCommon::new(BlendMode::Multiply, 0.7),diff --git a/crates/io/src/effects_map.rs b/crates/io/src/effects_map.rsindex 00815e2c8..b8de5a5c3 100644--- a/crates/io/src/effects_map.rs+++ b/crates/io/src/effects_map.rs@@ -239,6 +239,7 @@ fn parse_bevel(d: &Descriptor) -> Bevel {altitude: f(d, "Lald", 30.0),use_global_light: !matches!(d.get("uglg"), Some(Value::Boolean(false))),gloss_contour: contour(d, "TrnS"),+ gloss_anti_alias: bool_of(d, "antialiasGloss"),highlight: FxCommon { enabled: true, blend: blend_of(d, "hglM", BlendMode::Screen), opacity: pct(d, "hglO", 0.75) },highlight_color: get_desc(d, "hglC").and_then(color_from_desc).unwrap_or(Color::WHITE),shadow: FxCommon { enabled: true, blend: blend_of(d, "sdwM", BlendMode::Multiply), opacity: pct(d, "sdwO", 0.75) },@@ -482,6 +483,7 @@ fn write_one(e: &Effect) -> (&'static str, Descriptor) {.with("blur", unit(b"#Pxl", b.size)).with("bvlD", Value::Enumerated { type_id: Id::new("BESs"), value: Id::new(if b.up { "In " } else { "Out " }) }).with("TrnS", contour_value(&b.gloss_contour))+ .with("antialiasGloss", Value::Boolean(b.gloss_anti_alias)).with("Sftn", unit(b"#Pxl", b.soften));let d = match &b.contour {Some(c) => d@@ -720,6 +722,7 @@ mod tests {altitude: 40.0,use_global_light: false,gloss_contour: Contour::Linear,+ gloss_anti_alias: true,highlight: FxCommon::new(BlendMode::Screen, 0.75),highlight_color: Color::WHITE,shadow: FxCommon::new(BlendMode::Multiply, 0.6),diff --git a/crates/ui-egui/examples/bevel_bench.rs b/crates/ui-egui/examples/bevel_bench.rsindex 5d2d09dc6..15c76e6d3 100644--- a/crates/ui-egui/examples/bevel_bench.rs+++ b/crates/ui-egui/examples/bevel_bench.rs@@ -52,6 +52,7 @@ fn bevel(size: f32) -> Effect {altitude: 32.0,use_global_light: false,gloss_contour: Contour::Linear,+ gloss_anti_alias: false,highlight: FxCommon::new(BlendMode::Screen, 0.75),highlight_color: Color::WHITE,shadow: FxCommon::new(BlendMode::Multiply, 0.75),diff --git a/crates/ui-egui/examples/fx_bench.rs b/crates/ui-egui/examples/fx_bench.rsindex aa2bf61b1..7e7744993 100644--- a/crates/ui-egui/examples/fx_bench.rs+++ b/crates/ui-egui/examples/fx_bench.rs@@ -59,6 +59,7 @@ fn effects() -> Vec<Effect> {altitude: 30.0,use_global_light: true,gloss_contour: Contour::Linear,+ gloss_anti_alias: false,highlight: FxCommon::new(BlendMode::Screen, 0.75),highlight_color: Color::WHITE,shadow: FxCommon::new(BlendMode::Multiply, 0.75),diff --git a/crates/ui-egui/src/layer_style.rs b/crates/ui-egui/src/layer_style.rsindex d876c1827..1e8402b78 100644--- a/crates/ui-egui/src/layer_style.rs+++ b/crates/ui-egui/src/layer_style.rs@@ -172,7 +172,7 @@ fn spec(kind: &str) -> &'static [(&'static str, &'static str, P)] {("angle", "Angle", P::Angle),("useGlobalLight", "Use Global Light", P::Check),("altitude", "Altitude", P::Slider(0.0, 90.0, "°")),- ("glossContour", "Gloss Contour", P::Contour(None)),+ ("glossContour", "Gloss Contour", P::Contour(Some("glossAntiAlias"))),// Bevel & Emboss › Contour element.("contour", "Contour", P::Check),("contourName", "", P::Contour(Some("contourAntiAlias"))),@@ -355,6 +355,7 @@ fn values_of(e: &Effect, light: f32) -> Value {set(&mut v, "altitude", json!(b.altitude));set(&mut v, "direction", json!(if b.up { "up" } else { "down" }));set(&mut v, "glossContour", photocraft_engine::layer_style::contour_param(&b.gloss_contour));+ set(&mut v, "glossAntiAlias", json!(b.gloss_anti_alias));set(&mut v, "contour", json!(b.contour.is_some()));if let Some(c) = &b.contour {set(&mut v, "contourName", photocraft_engine::layer_style::contour_param(&c.contour));@@ -1634,6 +1635,24 @@ mod tests {);}+ #[test]+ fn bevel_gloss_anti_alias_survives_the_dialog() {+ let mut s = session();+ s.execute("layer.layerStyle.bevelEmboss", json!({"glossContour": "Ring - Double", "glossAntiAlias": true})).unwrap();+ let st = s.active().unwrap();+ let id = st.active_layer.unwrap();+ let mut f = initial_fields(st.doc.layer(id).unwrap(), None, st.doc.global_light.angle);+ assert_eq!(effects_of(&f)[0]["params"]["glossAntiAlias"], json!(true));+ // Editing another setting keeps the gloss contour's Anti-aliased.+ set_param(&mut f, "fx1", "size", json!(12));+ apply(&f, |cmd, p| s.execute(cmd, p).map_err(|e| e.to_string())).unwrap();+ let st = s.active().unwrap();+ let items = &st.doc.layer(id).unwrap().effects.items;+ let Some(photocraft_doc::Effect::BevelEmboss(b)) = items.first() else { panic!("{items:?}") };+ assert_eq!(b.size, 12.0);+ assert!(b.gloss_anti_alias);+ }+#[test]fn preview_applies_the_style_without_touching_the_document() {let s = session();diff --git a/docs/file-format-parity.md b/docs/file-format-parity.mdindex ba7462370..fe0283845 100644--- a/docs/file-format-parity.md+++ b/docs/file-format-parity.md@@ -142,6 +142,7 @@ remaining gaps in #1606 stay tracked with per-sample corpus ceilings.| Date | Change | Summary ||---|---|---|+| 2026-10-15 | minor | Bevel & Emboss Gloss Contour › Anti-aliased (`antialiasGloss`) is read and written, set by `glossAntiAlias` and shown in the Layer Style dialog; a PSD whose bevel is edited no longer loses it. Rendering still ignores contour anti-aliasing, as for the other effects' contours || 2026-10-14 | minor | PSD smart filter masks: Photoshop stores a smart object's filtered pixels without its filter mask and mixes the unfiltered ones (`FEid`) back in; import now mixes them and export writes them that way, so sf-filter-mask-hard, -gradient and sf-stack-blend-and-mask pass; Photoshop-oracle floor 185 → 188 of 258 || 2026-10-13 | minor | Lossy DNG (compression 34892) decodes: 8-bit baseline JPEG tiles and strips, CFA and LinearRaw, partial edge tiles; the stored values take the normal levels and LinearizationTable (FILE-215-11, lossy DNG part) || 2026-10-14 | minor | Corpus floors raised to the measured results of the CMYK, Lab, 32-bit, Levels, Threshold, Posterize, feather and pass-through fixes landed together: Photoshop-authored 165 → 185 of 258, io 146 → 148 of 170, psd-tools 242 → 249 of 309 |