mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Map recorded Shear actions with measured curve settings
This commit is contained in:
1 parent
24d4f4db9f
commit
c9fc8458b4
5 files changed
+274
-5
No files matched your search
@@ -4,7 +4,7 @@ use super::descriptors::{desc, get_bool, get_ref, jbool, layer_ref, layer_target
|
||||
use super::fields::{F, Kind, Mapped, fields_from, fields_to, none, step};
|
||||
|
||||
use super::steps_channels::{match_color_from, match_color_to, merge_spot_from, merge_spot_to, split_from, split_to, trap_from, trap_to};
|
||||
use super::steps_distort::{PINCH, POLAR, SPHERIZE, TWIRL, ZIGZAG, keys_from, keys_to, wave_from, wave_to};
|
||||
use super::steps_distort::{PINCH, POLAR, SPHERIZE, TWIRL, ZIGZAG, keys_from, keys_to, shear_from, shear_to, wave_from, wave_to};
|
||||
use super::steps_doc::{
|
||||
align_from, align_to, canvas_size_from, canvas_size_to, close_from, close_to, conditional_from, conditional_to, convert_mode_from, convert_mode_to,
|
||||
crop_from, crop_to, export_from, export_to, image_size_from, image_size_to, merge_visible_from, merge_visible_to, open_from, open_to, paste_from, paste_to,
|
||||
@@ -382,6 +382,7 @@ pub(super) const EVENTS: &[Event] = &[
|
||||
&[F("Hrzn", "horizontal", Kind::Long), F("Vrtc", "vertical", Kind::Long), F("Fl ", "undefinedAreas", Kind::Enum("FlMd", OFFSET_FILL))]
|
||||
),
|
||||
// Distort (#10605): every key in recorded order, Photoshop's limits and defaults.
|
||||
Event { code: "Shr ", name: "shear", label: "Shear", ids: &["filter.distort.shear"], from: shear_from, to: shear_to },
|
||||
Event {
|
||||
code: "Pnch",
|
||||
name: "pinch",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Photoshop's Distort filter steps (#10605): Pinch, Polar Coordinates, Spherize, Twirl, Wave and
|
||||
//! Photoshop's Distort filter steps (#10605): Pinch, Polar Coordinates, Shear, Spherize, Twirl, Wave and
|
||||
//! ZigZag, each key in recorded order with the limits and defaults Photoshop measures.
|
||||
|
||||
use super::descriptors::{desc, enm, num, trimmed};
|
||||
@@ -219,3 +219,94 @@ pub(super) fn wave_to(_: &str, p: &Value) -> Option<Descriptor> {
|
||||
};
|
||||
Some(d.with("SclH", D::Integer(100)).with("SclV", D::Integer(100)).with("UndA", enm("UndA", undefined)).with("RndS", D::Integer(seed)))
|
||||
}
|
||||
|
||||
/// A curve must retain its order and points when the native renderer sorts and deduplicates it.
|
||||
fn shear_curve(points: &[[f64; 2]]) -> bool {
|
||||
points.len() >= 2
|
||||
&& points.iter().all(|p| p[0].is_finite() && (0.0..=1.0).contains(&p[0]) && (-1.0..=63.0 / 64.0).contains(&p[1]))
|
||||
&& points.windows(2).all(|p| p[1][0] as f32 - p[0][0] as f32 >= 1e-6)
|
||||
}
|
||||
|
||||
/// Recorded grid coordinates become native top-to-bottom positions and half-width offsets.
|
||||
fn shear_normalized(points: &[[f64; 2]]) -> Vec<[f64; 2]> {
|
||||
points.iter().map(|p| [(p[1] - 1.0) / 127.0, p[0] / 64.0]).collect()
|
||||
}
|
||||
|
||||
/// Read every measured point; an invalid entry must not disappear in the native list parser.
|
||||
fn shear_points(value: &D) -> Option<Vec<[f64; 2]>> {
|
||||
let D::List(values) = value else { return None };
|
||||
values
|
||||
.iter()
|
||||
.map(|v| {
|
||||
let D::Descriptor(point) = v else { return None };
|
||||
if trimmed(&point.class_id) != "Pnt" {
|
||||
return None;
|
||||
}
|
||||
let [(h, D::Double(x)), (v, D::Double(y))] = point.items.as_slice() else { return None };
|
||||
(trimmed(h) == "Hrzn" && trimmed(v) == "Vrtc" && x.is_finite() && y.is_finite()).then(|| [x.clamp(-64.0, 63.0), y.clamp(1.0, 128.0)])
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Import only the complete measured curve range, with dialog clamps and exact fractional save data.
|
||||
pub(super) fn shear_from(d: &Descriptor) -> Mapped {
|
||||
let mapped = || {
|
||||
if !only_keys(d, &["ShrP", "UndA", "ShrS", "ShrE"]) {
|
||||
return None;
|
||||
}
|
||||
let grid = setting(d, "ShrP", shear_points, vec![[0.0, 1.0], [0.0, 128.0]])?;
|
||||
let index = |v: &D| if let D::Integer(n) = v { Some(*n) } else { None };
|
||||
if setting(d, "ShrS", index, 0)? != 0 || setting(d, "ShrE", index, 1)? != i32::try_from(grid.len().checked_sub(1)?).ok()? {
|
||||
return None;
|
||||
}
|
||||
let points = shear_normalized(&grid);
|
||||
if !shear_curve(&points) {
|
||||
return None;
|
||||
}
|
||||
let undefined = setting(d, "UndA", enum_of("UndA"), "WrpA".into())?;
|
||||
let mut p = json!({"points": points, "undefinedAreas": lookup(WAVE_UNDEFINED, &undefined)?});
|
||||
// Dividing by 127 can lose a wire bit (for example Vrtc = 4.975609756097561).
|
||||
// Preserve only that case, and reject stale metadata on export after a point edit.
|
||||
if points.iter().zip(&grid).any(|(p, g)| [p[1] * 64.0, p[0] * 127.0 + 1.0] != *g) {
|
||||
p["_atnShearPoints"] = json!(grid);
|
||||
}
|
||||
Some(step("filter.distort.shear", p))
|
||||
};
|
||||
mapped().unwrap_or(Mapped::Unsupported { harmless: false })
|
||||
}
|
||||
|
||||
/// Export the effective native curve; settings without a faithful measured wire form are refused.
|
||||
pub(super) fn shear_to(_: &str, p: &Value) -> Option<Descriptor> {
|
||||
if !pixel_target(p) || !sets_only(p, &["points", "amount", "undefinedAreas", "target", "_atnShearPoints"]) {
|
||||
return None;
|
||||
}
|
||||
let points: Vec<[f64; 2]> = match p.get("points") {
|
||||
None | Some(Value::Null) => {
|
||||
let amount = match p.get("amount") {
|
||||
None | Some(Value::Null) => 0.0,
|
||||
Some(value) => value.as_f64().filter(|n| n.is_finite())?,
|
||||
};
|
||||
// Match the native command's f32 conversion and amount clamp.
|
||||
let amount = (amount as f32).clamp(-100.0, 100.0) / 100.0;
|
||||
vec![[0.0, 0.0], [0.5, f64::from(amount)], [1.0, 0.0]]
|
||||
}
|
||||
Some(value) => serde_json::from_value(value.clone()).ok()?,
|
||||
};
|
||||
if !shear_curve(&points) {
|
||||
return None;
|
||||
}
|
||||
let grid: Vec<[f64; 2]> = match p.get("_atnShearPoints") {
|
||||
None => points.iter().map(|p| [p[1] * 64.0, p[0] * 127.0 + 1.0]).collect(),
|
||||
Some(value) => serde_json::from_value(value.clone()).ok()?,
|
||||
};
|
||||
if grid.iter().any(|p| !(-64.0..=63.0).contains(&p[0]) || !(1.0..=128.0).contains(&p[1])) || shear_normalized(&grid) != points {
|
||||
return None;
|
||||
}
|
||||
let end = i32::try_from(grid.len().checked_sub(1)?).ok()?;
|
||||
let undefined = match p.get("undefinedAreas") {
|
||||
None | Some(Value::Null) => "WrpA",
|
||||
Some(value) => lookup_back(WAVE_UNDEFINED, value.as_str()?)?,
|
||||
};
|
||||
let grid = grid.into_iter().map(|p| D::Descriptor(desc("Pnt ").with("Hrzn", D::Double(p[0])).with("Vrtc", D::Double(p[1])))).collect();
|
||||
Some(desc("null").with("ShrP", D::List(grid)).with("UndA", enm("UndA", undefined)).with("ShrS", D::Integer(0)).with("ShrE", D::Integer(end)))
|
||||
}
|
||||
@@ -526,6 +526,7 @@ fn every_mapped_command_exports_and_imports_back() {
|
||||
("filter.blur.smartBlur", json!({"radius": 2.5, "threshold": 40, "quality": "medium", "mode": "overlayEdge"})),
|
||||
("filter.other.offset", json!({"horizontal": 10, "vertical": -5, "undefinedAreas": "wrap"})),
|
||||
("filter.blur.blur", json!({})),
|
||||
("filter.distort.shear", json!({"points": [[0,0], [0.5,0.25], [1,0]], "undefinedAreas": "repeat"})),
|
||||
("filter.distort.pinch", json!({"amount": -30})),
|
||||
("filter.distort.polarCoordinates", json!({"mode": "polarToRectangular"})),
|
||||
("filter.distort.spherize", json!({"amount": -50, "mode": "verticalOnly"})),
|
||||
@@ -5882,3 +5883,169 @@ fn a_move_to_an_ordinal_that_is_not_a_layer_is_kept() {
|
||||
assert_eq!(channel.unsupported.len(), 1, "{o} on a channel was mapped: {:?}", channel.actions[0].steps);
|
||||
}
|
||||
}
|
||||
|
||||
/// The measured Shear list uses ordered horizontal/vertical doubles inside point objects.
|
||||
fn shear_descriptor(points: &[[f64; 2]], undefined: &str) -> Descriptor {
|
||||
let list = points.iter().map(|p| D::Descriptor(desc("Pnt ").with("Hrzn", D::Double(p[0])).with("Vrtc", D::Double(p[1])))).collect();
|
||||
desc("null").with("ShrP", D::List(list)).with("UndA", enm("UndA", undefined)).with("ShrS", D::Integer(0)).with("ShrE", D::Integer(points.len() as i32 - 1))
|
||||
}
|
||||
|
||||
/// Both event identities, changed curves and missing-key defaults save every measured setting in order.
|
||||
#[test]
|
||||
fn shear_steps_roundtrip_curves_defaults_and_flags() {
|
||||
let factory = shear_descriptor(&[[0.0, 1.0], [0.0, 128.0]], "WrpA");
|
||||
for event in ["Shr ", "shear"] {
|
||||
for d in [factory.clone(), shear_descriptor(&[[-32.0, 1.0], [16.0, 64.5], [0.0, 128.0]], "RptE")] {
|
||||
let loaded = mapped_recording(event, d.clone());
|
||||
assert!(loaded.unsupported.is_empty());
|
||||
let action = &loaded.actions[0];
|
||||
assert_eq!(action.steps[0].0, "filter.distort.shear");
|
||||
let bytes = export("S", &[action], &[], false).unwrap().0;
|
||||
let saved = atn::parse(&bytes).unwrap();
|
||||
assert_eq!(saved.actions[0].items[0].event, AtnEvent::Code(*b"Shr "));
|
||||
assert_eq!(saved.actions[0].items[0].descriptor, Some(d));
|
||||
assert_eq!(import(&bytes).unwrap().actions[0].steps, action.steps);
|
||||
}
|
||||
}
|
||||
let loaded = mapped_recording("Shr ", desc("null"));
|
||||
assert!(loaded.unsupported.is_empty());
|
||||
assert_eq!(loaded.actions[0].steps[0].1, json!({"points":[[0,0],[1,0]],"undefinedAreas":"wrap"}));
|
||||
assert_eq!(export_item("filter.distort.shear", &loaded.actions[0].steps[0].1, "S").unwrap().descriptor, Some(factory));
|
||||
let mut step = item("Shr ", "Shear", Some(shear_descriptor(&[[0.0, 1.0], [0.0, 128.0]], "RptE")));
|
||||
step.enabled = false;
|
||||
step.with_dialog = true;
|
||||
let loaded = import(&atn::write(&one_action(vec![step.clone()])).unwrap()).unwrap();
|
||||
let bytes = export("S", &[&loaded.actions[0]], &[], false).unwrap().0;
|
||||
let saved = atn::parse(&bytes).unwrap();
|
||||
assert_eq!(saved.actions[0].items[0], step);
|
||||
}
|
||||
|
||||
/// Clamp hostile coordinates, but retain finite fractional wire values that division by127 cannot invert.
|
||||
#[test]
|
||||
fn shear_clamps_points_and_preserves_fractional_wire_values() {
|
||||
let raw = shear_descriptor(&[[-10000.0, -1000.0], [10000.0, 1000.0]], "WrpA");
|
||||
let loaded = mapped_recording("Shr ", raw);
|
||||
assert!(loaded.unsupported.is_empty());
|
||||
let p = &loaded.actions[0].steps[0].1;
|
||||
assert_eq!(p["points"], json!([[0, -1], [1, 63.0 / 64.0]]));
|
||||
assert_eq!(export_item("filter.distort.shear", p, "S").unwrap().descriptor, Some(shear_descriptor(&[[-64.0, 1.0], [63.0, 128.0]], "WrpA")));
|
||||
|
||||
let d = shear_descriptor(&[[0.0, 1.0], [7.97, 4.975609756097561], [0.0, 128.0]], "RptE");
|
||||
let loaded = mapped_recording("shear", d.clone());
|
||||
assert!(loaded.unsupported.is_empty());
|
||||
let mut p = loaded.actions[0].steps[0].1.clone();
|
||||
assert!(p.get("_atnShearPoints").is_some(), "the measured inverse loses a wire bit");
|
||||
assert_eq!(export_item("filter.distort.shear", &p, "S").unwrap().descriptor, Some(d));
|
||||
p["points"][1][1] = json!(0.25);
|
||||
assert!(export_item("filter.distort.shear", &p, "S").is_none(), "stale wire metadata must not replace a native edit");
|
||||
}
|
||||
|
||||
/// Unmeasured subranges, malformed points and repeated settings remain whole, including their flags.
|
||||
#[test]
|
||||
fn shear_unrepresentable_steps_stay_kept_without_partial_playback() {
|
||||
let full = shear_descriptor(&[[0.0, 1.0], [8.0, 64.5], [0.0, 128.0]], "WrpA");
|
||||
let mut missing_end = full.clone();
|
||||
missing_end.items.pop(); // Missing ShrE means1, not the supplied list's last index2.
|
||||
let mut invalid_start = full.clone();
|
||||
invalid_start.items[2].1 = D::Integer(1);
|
||||
let mut invalid_end = full.clone();
|
||||
invalid_end.items[3].1 = D::Integer(100);
|
||||
let mut wrong_type = full.clone();
|
||||
wrong_type.items[2].1 = D::Double(0.0);
|
||||
for d in [
|
||||
missing_end,
|
||||
invalid_start,
|
||||
invalid_end,
|
||||
wrong_type,
|
||||
full.clone().with("ShrS", D::Integer(0)),
|
||||
full.clone().with("extra", D::Boolean(true)),
|
||||
desc("null").with("ShrP", D::List(vec![])),
|
||||
desc("null").with("ShrP", D::List(vec![D::Integer(7)])),
|
||||
desc("null").with("ShrP", D::List(vec![D::Descriptor(desc("Pnt ").with("Hrzn", D::Double(0.0)))])),
|
||||
desc("null").with("UndA", enm("UndA", "Trns")),
|
||||
desc("null").with("UndA", enm("Other", "WrpA")),
|
||||
shear_descriptor(&[[0.0, 128.0], [0.0, 1.0]], "WrpA"),
|
||||
shear_descriptor(&[[0.0, 1.0], [8.0, 1.0], [0.0, 128.0]], "WrpA"),
|
||||
] {
|
||||
let step = item("Shr ", "Shear", Some(d));
|
||||
let loaded = import(&atn::write(&one_action(vec![step.clone()])).unwrap()).unwrap();
|
||||
assert_eq!(loaded.unsupported.len(), 1, "{step:?}");
|
||||
let bytes = export("S", &[&loaded.actions[0]], &[], false).unwrap().0;
|
||||
assert_eq!(atn::parse(&bytes).unwrap().actions[0].items[0], step);
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width":8,"height":8})).unwrap();
|
||||
let before = s.active().unwrap().doc.clone();
|
||||
let past = s.active().unwrap().history.past_len();
|
||||
let name = loaded.actions[0].name.clone();
|
||||
s.actions.list.extend(loaded.actions);
|
||||
let report = s.execute("actions.play", json!({"action":name})).unwrap();
|
||||
assert_eq!(report["ran"], 0);
|
||||
assert!(report.get("failed").is_some());
|
||||
assert_eq!(s.active().unwrap().doc, before);
|
||||
assert_eq!(s.active().unwrap().history.past_len(), past);
|
||||
}
|
||||
for n in [f64::NAN, f64::INFINITY, f64::NEG_INFINITY] {
|
||||
assert!(matches!(steps_distort::shear_from(&shear_descriptor(&[[n, 1.0], [0.0, 128.0]], "WrpA")), Mapped::Unsupported { .. }));
|
||||
}
|
||||
}
|
||||
|
||||
/// Native exports follow points-before-amount and refuse settings that the measured curve cannot carry.
|
||||
#[test]
|
||||
fn shear_native_exports_keep_effective_defaults_and_refuse_lossy_options() {
|
||||
for p in [json!({}), json!({"amount":25}), json!({"points":[[0,0],[1,0.5]],"amount":-80,"undefinedAreas":"repeat"})] {
|
||||
let item = export_item("filter.distort.shear", &p, "S").unwrap();
|
||||
let Mapped::Steps(steps) = steps_distort::shear_from(item.descriptor.as_ref().unwrap()) else { panic!("export did not map back") };
|
||||
assert_eq!(crate::filters_ext::params_for("filter.distort.shear", &steps[0].1), crate::filters_ext::params_for("filter.distort.shear", &p));
|
||||
}
|
||||
for p in [
|
||||
json!({"points":[]}),
|
||||
json!({"points":[[0,0],[1,"bad"]]}),
|
||||
json!({"points":[[1,0],[0,0]]}),
|
||||
json!({"points":[[0,0],[1,1]]}),
|
||||
json!({"amount":100}),
|
||||
json!({"undefinedAreas":"transparent"}),
|
||||
json!({"target":"mask"}),
|
||||
json!({"layer":1}),
|
||||
json!({"other":true}),
|
||||
json!({"points":[[0,0],[1,0]],"_atnShearPoints":[[0,1],[8,128]]}),
|
||||
] {
|
||||
assert!(export_item("filter.distort.shear", &p, "S").is_none(), "{p} exported");
|
||||
}
|
||||
}
|
||||
|
||||
/// A constant measured curve shifts pixels right by two, with independent wrap/repeat border and Undo oracles.
|
||||
#[test]
|
||||
fn shear_action_moves_real_pixels_and_undoes_at_each_depth() {
|
||||
for depth in [8, 16, 32] {
|
||||
for edge in ["WrpA", "RptE"] {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width":32,"height":8,"depth":depth,"background":"transparent"})).unwrap();
|
||||
s.edit("Pattern", |doc, _| {
|
||||
let surface = doc.layers[0].surface_mut().unwrap();
|
||||
let data: Vec<f32> = (0..8).flat_map(|y| (0..32).flat_map(move |x| [x as f32 / 31.0, y as f32 / 7.0, (x % 3) as f32 / 2.0, 1.0])).collect();
|
||||
surface.write_region(photocraft_geom::Rect::new(0, 0, 32, 8), &data);
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let before = s.active().unwrap().doc.clone();
|
||||
let pixels = photocraft_compose::flatten(&before);
|
||||
let bytes = atn::write(&one_action(vec![item("Shr ", "Shear", Some(shear_descriptor(&[[8.0, 1.0], [8.0, 128.0]], edge)))])).unwrap();
|
||||
let loaded = s.execute("actions.load", json!({"data":b64(&bytes)})).unwrap();
|
||||
assert_eq!(loaded["unsupported"], json!([]));
|
||||
let played = s.execute("actions.play", json!({"action":loaded["actions"][0]})).unwrap();
|
||||
assert_eq!(played["ran"], 1, "{played}");
|
||||
let output = photocraft_compose::flatten(&s.active().unwrap().doc);
|
||||
assert_ne!(output, pixels);
|
||||
for y in 0..8 {
|
||||
for x in 0..32 {
|
||||
let source = if edge == "WrpA" { (x - 2i32).rem_euclid(32) } else { (x - 2i32).max(0) };
|
||||
for (got, want) in output.get(x, y).into_iter().zip(pixels.get(source, y)) {
|
||||
assert!((got - want).abs() < 1e-5, "depth{depth} {edge} ({x},{y}):{got} != {want}");
|
||||
}
|
||||
}
|
||||
}
|
||||
assert!(s.undo());
|
||||
assert_eq!(s.active().unwrap().doc, before);
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -18,7 +18,7 @@ layers and documents, newer and older events and files, and a measured reference
|
||||
map yet, with everything needed to implement them without
|
||||
the reference application.
|
||||
|
||||
## Supported events (144)
|
||||
## Supported events (145)
|
||||
|
||||
| Code | String ID | Label | PhotoCraft command(s) |
|
||||
|---|---|---|---|
|
||||
@@ -127,6 +127,7 @@ the reference application.
|
||||
| (string ID only) | removeBackground | Remove Background | `layer.removeBackground` |
|
||||
| `RmvB` | removeBlackMatte | Remove Black Matte | `layer.matting.removeBlackMatte` |
|
||||
| `RmvW` | removeWhiteMatte | Remove White Matte | `layer.matting.removeWhiteMatte` |
|
||||
| `Shr ` | shear | Shear | `filter.distort.shear` |
|
||||
| `Rset` | reset | Reset | `tools.defaultColors` |
|
||||
| `RvlA` | revealAll | Reveal All | `image.revealAll` |
|
||||
| `Rvrt` | revert | Revert | `file.revert` |
|
||||
@@ -1318,6 +1319,14 @@ All commands exist in PhotoCraft (`filter.distort.*`); only the `.atn` mapping i
|
||||
- PhotoCraft command: `filter.distort.shear`
|
||||
- `shearPoints` is a list of curve points; keep their order and count.
|
||||
|
||||
Supported for complete curves: import clamps finite grid coordinates to the measured ranges below,
|
||||
maps them to the native top-to-bottom position `(Vrtc - 1) / 127` and half-width offset `Hrzn / 64`,
|
||||
and preserves fractional recorded coordinates exactly on save. Both edge modes are supported.
|
||||
Only `ShrS` 0 and `ShrE` equal to the last point's index map; an omitted `ShrE` still defaults to 1.
|
||||
Malformed settings, unknown keys, nonfinite values, and curves whose order or points the native
|
||||
renderer would change remain complete kept steps. Export refuses unrepresentable native options
|
||||
and mask targets. The native Shear renderer and its ordinary command behavior are unchanged.
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `ShrP` | shearPoints | list | | list[2] | list of `Pnt ` points (`Hrzn`, `Vrtc`) from top to bottom; default two points (0, 1) and (0, 128). The dialog writes whole numbers: `Hrzn` -64..63 (dragging past the grid edge clamps), `Vrtc` 1..128 with the first point at 1 and the last at 128; dragging a point out of the grid deletes it. A script run accepts any value without clamping (e.g. `Hrzn` ±10000, fractions) and crashed on a first point with `Vrtc` < 1: clamp to the dialog ranges on import |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# File-format parity
|
||||
|
||||
> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-31 · **Change:** minor (`.atn`: 144 supported events after Actions batch 12 (Groups A–I, command options, version 12 files, reference forms); the supported table and measured reference are in [atn.md](atn.md); TIFF: YCbCr images open as RGB, including JPEG-compressed scans with subsampled chroma, #10316; TIFFs up to 300,000 px a side open, decoded a group of rows at a time into the layer, #8169; embedded AI/PDF/EPS save-back retains native format with a source-bound SVG display preview; PSD Filter Gallery: Halftone Pattern dot/circle/line settings survive PSD/PSB saves (#8940); Save for Web writes WebP, lossy or lossless, #6391; Photoshop's `MTrn` merged-transparency marker, from a layered TIFF saved with Save Transparency, marks the merged transparency, #8877; layered TIFF writes the TySh text version and descriptor in PSD big-endian order while the header, matrix, warp and bounds keep container order, #9098; layered TIFF writes Photoshop's 14-byte global layer mask, so Photoshop opens the layers instead of only the composite, #9095; legacy PSD point text placed from the layout ink box after font resolution, #6094; `.atn`: a recorded Save As imports with its format and file (`file.saveAs`, `file.saveACopy` for As a Copy) instead of as a plain Save that wrote over the played file, #7102; folder destinations stop playback until #5430; `.asl` layer style libraries read and written, #1051; JPEG Options on File › Save, Save As and Save a Copy, FILE-215-19 partial (no Matte, progressive Scans or size preview); 32-bit Hue/Saturation unclipped and Colorize as Photoshop does them, Photoshop-oracle floor 190/258, #5781; JPEG Options on Save As and Save a Copy, FILE-215-19; TIFF compression for scripted saves, `tiffCompression`, #5301; the Nikon D4 white level follows the sample depth (12 and 14 bit), #5978; Apply Layer Comp action mapping, #7101; Cineon write: 10-bit gray/RGB; animated WebP frames load into video layers, #1198; Photoshop mixed-order TIFF type geometry, #4758; DDS textures save: uncompressed or BC1–BC3, optional mip chain, DDS Options in Save As (#1327); PSD smart filters: 53 filters (39 more: Pinch, Polar Coordinates, Ripple, Spherize, Twirl, Wave, ZigZag, Invert, Blur, Surface Blur, Smart Sharpen, Diffuse, Wind, Offset, Mezzotint, Clouds, Difference Clouds, Fibers, Lens Flare and others) plus Hue/Saturation and Perspective Warp mapped both ways, #6296, #6298, #6300, #6302, #6304, #6314, #6316, #6267, #6268, FILE-215-2; large-file fixtures: a 20 MP layered PSD, a 150-layer layout, a 2 GB PSD and a 4.4 GB PSB generated at test time and round-tripped, FILE-216-2 done, #5107; earlier: smart objects keep Photoshop's Cylinder warp through re-renders and saves, #4112; PNG `sTER` stereo pairing kept on save, #6063; PDF write one flattened page via Save As / Save a Copy / CLI, #3401; CMYK Invert, Posterize and Threshold on the inks; smart filter masks on PSD open and save; Photoshop-oracle floor 188/258; lossy DNG, compression 34892, decodes with its levels and LinearizationTable applied to the stored 8-bit samples, FILE-215-11; CMYK Hue/Saturation and Color Balance keep the black ink; CMYK Posterize on the stored values, psd-tools oracle floor 242/309; CMYK adjustment layers composite on the document's inks; Photoshop-oracle floor 165/258; CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; modern Brightness/Contrast's brightness curve; Photoshop-oracle floor 151/258; Lab documents composite on their stored L, a, b; Photoshop-oracle floor 152/258; Levels on whole levels at every step with Photoshop's shadow toe; Photoshop-oracle floor 146/258, psd-tools 238/309; 32-bit adjustments unclipped; Photoshop-oracle floor 149/258; mask feathers blur with their exact variance; Threshold splits on Photoshop's luminosity; a pass-through clipping base with an adjustment renders isolated; psd-tools oracle floor 240/309; 16-bit Posterize as Photoshop bins it; psd-tools oracle floor 241/309; Gradient Map luminosity; Photoshop-oracle floor 147/258; PSD: `Mt16`/`Mt32` merged transparency read; palette PNGs open in Indexed Color mode, #4804; 16-bit Lab Invert; Photoshop-oracle floor 145/258; `.atn` import maps 112 events; DDS textures open, #1327; DPX read and write, #1049; #2465 fixed: CS2 placed layers with only a `PlLd` block open their contents; Photoshop Actions `.atn` read and write; `.shc` contour files read and write; earlier the same day: indexed BMP palette mode; Save keeps a JPEG's quality and a WebP's encoding; Amiga IFF write: 24-plane ILBM, Save As `.iff`; PSD stores spot channels as Photoshop does, ink 0 = solid, and numbers them in 1053, #7415 split; TIFF writes and reads alpha and spot channels as extra samples with Photoshop's channel resources, PSD output unchanged, FILE-215-7, FILE-215-17's TIFF part, #7415; Photoshop's `MTrn` merged-transparency marker, from a layered TIFF saved with Save Transparency, marks the merged transpaLine truncated
|
||||
> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-31 · **Change:** minor (`.atn`: 145 supported events including Shear after Actions batch 12 (Groups A–I, command options, version 12 files, reference forms); the supported table and measured reference are in [atn.md](atn.md); TIFF: YCbCr images open as RGB, including JPEG-compressed scans with subsampled chroma, #10316; TIFFs up to 300,000 px a side open, decoded a group of rows at a time into the layer, #8169; embedded AI/PDF/EPS save-back retains native format with a source-bound SVG display preview; PSD Filter Gallery: Halftone Pattern dot/circle/line settings survive PSD/PSB saves (#8940); Save for Web writes WebP, lossy or lossless, #6391; Photoshop's `MTrn` merged-transparency marker, from a layered TIFF saved with Save Transparency, marks the merged transparency, #8877; layered TIFF writes the TySh text version and descriptor in PSD big-endian order while the header, matrix, warp and bounds keep container order, #9098; layered TIFF writes Photoshop's 14-byte global layer mask, so Photoshop opens the layers instead of only the composite, #9095; legacy PSD point text placed from the layout ink box after font resolution, #6094; `.atn`: a recorded Save As imports with its format and file (`file.saveAs`, `file.saveACopy` for As a Copy) instead of as a plain Save that wrote over the played file, #7102; folder destinations stop playback until #5430; `.asl` layer style libraries read and written, #1051; JPEG Options on File › Save, Save As and Save a Copy, FILE-215-19 partial (no Matte, progressive Scans or size preview); 32-bit Hue/Saturation unclipped and Colorize as Photoshop does them, Photoshop-oracle floor 190/258, #5781; JPEG Options on Save As and Save a Copy, FILE-215-19; TIFF compression for scripted saves, `tiffCompression`, #5301; the Nikon D4 white level follows the sample depth (12 and 14 bit), #5978; Apply Layer Comp action mapping, #7101; Cineon write: 10-bit gray/RGB; animated WebP frames load into video layers, #1198; Photoshop mixed-order TIFF type geometry, #4758; DDS textures save: uncompressed or BC1–BC3, optional mip chain, DDS Options in Save As (#1327); PSD smart filters: 53 filters (39 more: Pinch, Polar Coordinates, Ripple, Spherize, Twirl, Wave, ZigZag, Invert, Blur, Surface Blur, Smart Sharpen, Diffuse, Wind, Offset, Mezzotint, Clouds, Difference Clouds, Fibers, Lens Flare and others) plus Hue/Saturation and Perspective Warp mapped both ways, #6296, #6298, #6300, #6302, #6304, #6314, #6316, #6267, #6268, FILE-215-2; large-file fixtures: a 20 MP layered PSD, a 150-layer layout, a 2 GB PSD and a 4.4 GB PSB generated at test time and round-tripped, FILE-216-2 done, #5107; earlier: smart objects keep Photoshop's Cylinder warp through re-renders and saves, #4112; PNG `sTER` stereo pairing kept on save, #6063; PDF write one flattened page via Save As / Save a Copy / CLI, #3401; CMYK Invert, Posterize and Threshold on the inks; smart filter masks on PSD open and save; Photoshop-oracle floor 188/258; lossy DNG, compression 34892, decodes with its levels and LinearizationTable applied to the stored 8-bit samples, FILE-215-11; CMYK Hue/Saturation and Color Balance keep the black ink; CMYK Posterize on the stored values, psd-tools oracle floor 242/309; CMYK adjustment layers composite on the document's inks; Photoshop-oracle floor 165/258; CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; modern Brightness/Contrast's brightness curve; Photoshop-oracle floor 151/258; Lab documents composite on their stored L, a, b; Photoshop-oracle floor 152/258; Levels on whole levels at every step with Photoshop's shadow toe; Photoshop-oracle floor 146/258, psd-tools 238/309; 32-bit adjustments unclipped; Photoshop-oracle floor 149/258; mask feathers blur with their exact variance; Threshold splits on Photoshop's luminosity; a pass-through clipping base with an adjustment renders isolated; psd-tools oracle floor 240/309; 16-bit Posterize as Photoshop bins it; psd-tools oracle floor 241/309; Gradient Map luminosity; Photoshop-oracle floor 147/258; PSD: `Mt16`/`Mt32` merged transparency read; palette PNGs open in Indexed Color mode, #4804; 16-bit Lab Invert; Photoshop-oracle floor 145/258; `.atn` import maps 112 events; DDS textures open, #1327; DPX read and write, #1049; #2465 fixed: CS2 placed layers with only a `PlLd` block open their contents; Photoshop Actions `.atn` read and write; `.shc` contour files read and write; earlier the same day: indexed BMP palette mode; Save keeps a JPEG's quality and a WebP's encoding; Amiga IFF write: 24-plane ILBM, Save As `.iff`; PSD stores spot channels as Photoshop does, ink 0 = solid, and numbers them in 1053, #7415 split; TIFF writes and reads alpha and spot channels as extra samples with Photoshop's channel resources, PSD output unchanged, FILE-215-7, FILE-215-17's TIFF part, #7415; Photoshop's `MTrn` merged-transparency marker, from a layered TIFF saved with Save Transparency, marks thLine truncated
|
||||
|
||||
**PSD Filter Gallery (#8940, 2026-10-23):** Halftone Pattern maps its size, contrast and dot/circle/line pattern as editable settings on import and export, with the reference application's descriptor keys (`HlSz`, `Cntr`, `ScrT`: `ScrD`/`ScrC`/`ScrL`). PSD/PSB round trips pass at 8/16/32 bits. This does not claim pixel equivalence for the existing renderer. Unknown or malformed settings remain verbatim on import.
|
||||
|
||||
@@ -133,7 +133,7 @@ remaining gaps in #1606 stay tracked with per-sample corpus ceilings.
|
||||
| LUTs `.cube` / `.3dl` / `.look` | R/W (Export Color Lookup) | R/W / R / R | `cms/src/lutfile.rs` |
|
||||
| Keyboard shortcuts `.kys` | R/W | R/W | `engine/src/kys.rs` (`write`: Edit › Keyboard Shortcuts › Export…, rows carry our id; Photoshop reading our files is unverified) |
|
||||
| ICC profiles | R | R | Own CMS |
|
||||
| Actions `.atn` ([reference](atn.md)) | R/W | R/W | `psd/src/atn.rs` reads version 12 and 16 sets and writes version 16 (exact round trip for version 16; version 12 legacy bare identifiers, reference classes and object-array values keep their meaning; trailing bytes remain a warning, #10699). `engine/src/cmd/atn_cmds/` maps the reference application's events to commands (144 supported event IDs, the table in [atn.md](atn.md); one recognized-but-disabled event), including Apply Layer Comp by name (#7101), recorded layer indexes/ordinals and indexed moves, opening-order document indexes and comp index/ID/ordinal references (#10701); other steps kept verbatim. Save As maps to `file.saveAs`/`file.saveACopy` for a file destination (#7102). Panel menu, CLI `batch --actions set.atn`, `actions.load`/`actions.save`. Version 7 and MacBinary wrappers remain unsupported; version 12 coverage uses synthetic fixtures. |
|
||||
| Actions `.atn` ([reference](atn.md)) | R/W | R/W | `psd/src/atn.rs` reads version 12 and 16 sets and writes version 16 (exact round trip for version 16; version 12 legacy bare identifiers, reference classes and object-array values keep their meaning; trailing bytes remain a warning, #10699). `engine/src/cmd/atn_cmds/` maps the reference application's events to commands (145 supported event IDs, the table in [atn.md](atn.md); one recognized-but-disabled event), including Apply Layer Comp by name (#7101), recorded layer indexes/ordinals and indexed moves, opening-order document indexes and comp index/ID/ordinal references (#10701); other steps kept verbatim. Save As maps to `file.saveAs`/`file.saveACopy` for a file destination (#7102). Panel menu, CLI `batch --actions set.atn`, `actions.load`/`actions.save`. Version 7 and MacBinary wrappers remain unsupported; version 12 coverage uses synthetic fixtures. |
|
||||
| Styles `.asl` | R/W | R/W | `psd/src/asl.rs`, `io/src/asl_map.rs`; Styles panel Import/Export Styles…, `style.presets.importAsl`/`exportAsl` (#1051) |
|
||||
| Contours `.shc` | R/W | R/W | `psd/src/shc.rs`; Contour Editor Load…/Save… (FILE-215-15). No user contour library; not yet checked against a Photoshop-written file |
|
||||
| Custom shapes `.csh`, tool presets `.tpl` | R/W | no | |
|
||||
@@ -151,6 +151,7 @@ The original reference entry retains its source date and historical totals; curr
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-02 | minor | Actions Shear (`Shr `) loads, plays and saves the measured curve points and edge mode; unsafe subranges and unrepresentable forms remain kept steps (#10605). |
|
||||
| 2026-11-01 | minor | `.atn`: event reference [atn.md](atn.md): the 117 supported events, and measured keys, defaults, ranges and enum values for 101 events not mapped yet |
|
||||
| 2026-10-31 | minor | `.atn` Group B: four Render events load, play and save; 120 supported and 97 unmapped. Supported-table columns corrected against the event registry; the original 117/101 reference entry remains historical. |
|
||||
| 2026-10-31 | minor | `.atn`: Pinch (`Pnch`), Polar Coordinates (`Plr `), Spherize (`Sphr`), Twirl (`Twrl`), Wave (`Wave`) and ZigZag (`ZgZg`) map to `filter.distort.*` with every key in recorded order; out-of-range values clamped and missing keys given Photoshop's defaults on import; a Wave scaled below 100 % stays a Photoshop step (the command has no scale); Shear still kept verbatim (#10605) |
|
||||
|
||||
Reference in new issue
Block a user