Merge PR #5990: Bevel & Emboss: keep the Gloss Contour's Anti-aliased (antialiasGloss)

This commit is contained in:
David Mann committed 2026-10-21 11:29:05 +02:00
commit a492716367
11 files changed
+61 -3

No files matched your search

+1
View File
@@ -2521,6 +2521,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),
+4
View File
@@ -1339,6 +1339,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),
@@ -1515,6 +1516,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),
@@ -1755,6 +1757,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),
@@ -2764,6 +2767,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),
+3
View File
@@ -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,
+15 -2
View File
@@ -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),
@@ -792,6 +793,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") {
@@ -1028,7 +1030,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",
@@ -1144,6 +1146,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"] {
+1
View File
@@ -602,6 +602,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),
+1
View File
@@ -1448,6 +1448,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),
+13
View File
@@ -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),
@@ -736,6 +739,16 @@ mod tests {
assert_eq!(write_lfx2(true, a), write_lfx2(true, b));
}
/// `approx` compares re-serialized bytes, so a field the writer drops looks equal on both
/// sides: read the Gloss Contour's Anti-aliased back directly.
#[test]
fn bevel_gloss_anti_alias_is_written() {
let fx: Vec<Effect> = sample_effects().into_iter().filter(|e| matches!(e, Effect::BevelEmboss(_))).collect();
assert!(matches!(fx.as_slice(), [Effect::BevelEmboss(b)] if b.gloss_anti_alias));
let (_, back) = parse_lfx2(&write_lfx2(false, &fx)).unwrap();
assert!(matches!(back.as_slice(), [Effect::BevelEmboss(b)] if b.gloss_anti_alias), "{back:?}");
}
#[test]
fn lfx2_roundtrip_all_kinds() {
let fx = sample_effects();
+1
View File
@@ -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),
+1
View File
@@ -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),
+20 -1
View File
@@ -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();
+1
View File
@@ -145,6 +145,7 @@ remaining gaps in #1606 stay tracked with per-sample corpus ceilings.
| 2026-10-15 | minor | DDS textures save (#1327): uncompressed or BC1/BC2/BC3 (DXT1/3/5) from a clean-room block encoder, optional box-filtered mip chain, legacy header; DDS Options in Save As and Save a Copy, `ddsCompression`/`ddsMipmaps` for scripts, the CLI and MCP |
| 2026-10-15 | minor | PNG: a stereo PNG's `sTER` pairing (PNG Extensions 1.4.0 §3.6) is read on open and written back on save, so the file still says it is a stereo pair (#6063) |
| 2026-10-15 | minor | PSD guides: image resource 1092 (guides v2) gives guides their own colours on import; 1092 and 1097 (guide GUIDs) are written back only while they still describe the document's guides, so an edit no longer leaves Photoshop a stale second guide list (#5966) |
| 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 |