mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 01:18:43 +00:00
Complete measured Stylize and Pixelate ATN mappings
This commit is contained in:
1 parent
7906cd8bc2
commit
8d47e4efef
5 files changed
+730
-145
No files matched your search
@@ -54,14 +54,7 @@ macro_rules! ev {
|
||||
|
||||
macro_rules! stylize_event {
|
||||
($code:literal, $name:literal, $label:literal, $id:literal) => {
|
||||
Event {
|
||||
code: $code,
|
||||
name: $name,
|
||||
label: $label,
|
||||
ids: &[$id],
|
||||
from: |d| super::steps_stylize::from($id, d),
|
||||
to: |_, p| if pixel_target(p) { super::steps_stylize::to($id, p) } else { None },
|
||||
}
|
||||
Event { code: $code, name: $name, label: $label, ids: &[$id], from: |d| super::steps_stylize::from($id, d), to: super::steps_stylize::to }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -202,6 +195,14 @@ pub(super) const EVENTS: &[Event] = &[
|
||||
stylize_event!("Slrz", "solarize", "Solarize", "filter.stylize.solarize"),
|
||||
stylize_event!("Fct ", "facet", "Facet", "filter.pixelate.facet"),
|
||||
stylize_event!("Frgm", "fragment", "Fragment", "filter.pixelate.fragment"),
|
||||
stylize_event!("Extr", "extrude", "Extrude", "filter.stylize.extrude"),
|
||||
stylize_event!("TrcC", "traceContour", "Trace Contour", "filter.stylize.traceContour"),
|
||||
stylize_event!("Wnd ", "wind", "Wind", "filter.stylize.wind"),
|
||||
stylize_event!("Tls ", "tiles", "Tiles", "filter.stylize.tiles"),
|
||||
stylize_event!("ClrH", "colorHalftone", "Color Halftone", "filter.pixelate.colorHalftone"),
|
||||
stylize_event!("Mztn", "mezzotint", "Mezzotint", "filter.pixelate.mezzotint"),
|
||||
stylize_event!("Msc ", "mosaic", "Mosaic", "filter.pixelate.mosaic"),
|
||||
stylize_event!("Pntl", "pointillize", "Pointillize", "filter.pixelate.pointillize"),
|
||||
ev!("GsnB", "gaussianBlur", "Gaussian Blur", "filter.blur.gaussianBlur", &[F("Rds ", "radius", Kind::Px)]),
|
||||
ev!(
|
||||
"UnsM",
|
||||
|
||||
@@ -1,15 +1,188 @@
|
||||
//! Descriptor adapters for the measured Stylize and Pixelate action events.
|
||||
|
||||
use super::descriptors::desc;
|
||||
use super::descriptors::{desc, enm, px};
|
||||
use super::fields::{Mapped, step};
|
||||
use super::{Descriptor, Value, json};
|
||||
use super::{D, Descriptor, Map, Value, json};
|
||||
|
||||
enum Kind {
|
||||
Long(i32, i32, i32),
|
||||
Pixels(f64, f64, f64),
|
||||
Bool(bool),
|
||||
Enum(&'static str, &'static [(&'static str, &'static str)], &'static str),
|
||||
}
|
||||
|
||||
// Descriptor key, command parameter, and measured type/default/range.
|
||||
struct Field(&'static str, &'static str, Kind);
|
||||
|
||||
const EXTRUDE: &[Field] = &[
|
||||
Field("ExtS", "size", Kind::Long(30, 2, 255)),
|
||||
Field("ExtD", "depth", Kind::Long(30, 1, 255)),
|
||||
Field("ExtF", "solidFrontFaces", Kind::Bool(false)),
|
||||
Field("ExtM", "maskIncompleteBlocks", Kind::Bool(false)),
|
||||
Field("ExtT", "type", Kind::Enum("ExtT", &[("Blks", "blocks"), ("Pyrm", "pyramids")], "blocks")),
|
||||
Field("ExtR", "depthMode", Kind::Enum("ExtR", &[("Rndm", "random"), ("LvlB", "levelBased")], "random")),
|
||||
];
|
||||
const TRACE: &[Field] = &[
|
||||
// The dialog range is not measured. These bounds are only the descriptor's integer type.
|
||||
Field("Lvl ", "level", Kind::Long(128, i32::MIN, i32::MAX)),
|
||||
Field("Edg ", "edge", Kind::Enum("CntE", &[("Lwr ", "lower"), ("Upr ", "upper")], "upper")),
|
||||
];
|
||||
const WIND: &[Field] = &[
|
||||
Field("WndM", "method", Kind::Enum("WndM", &[("Wnd ", "wind"), ("Blst", "blast"), ("Stgr", "stagger")], "wind")),
|
||||
// Photoshop names the direction the streaks extend, rather than their source.
|
||||
Field("Drct", "direction", Kind::Enum("Drct", &[("Left", "fromRight"), ("Rght", "fromLeft")], "fromRight")),
|
||||
];
|
||||
const TILES: &[Field] = &[
|
||||
Field("TlNm", "count", Kind::Long(10, 1, 99)),
|
||||
Field("TlOf", "maxOffset", Kind::Long(10, 1, 99)),
|
||||
Field("FlCl", "fill", Kind::Enum("FlCl", &[("FlBc", "background"), ("FlFr", "foreground"), ("FlIn", "inverse"), ("FlSm", "unaltered")], "background")),
|
||||
];
|
||||
const HALFTONE: &[Field] = &[
|
||||
Field("Rds ", "maxRadius", Kind::Long(8, 4, 127)),
|
||||
Field("Ang1", "channel1", Kind::Long(108, -10000, 10000)),
|
||||
Field("Ang2", "channel2", Kind::Long(162, -10000, 10000)),
|
||||
Field("Ang3", "channel3", Kind::Long(90, -10000, 10000)),
|
||||
Field("Ang4", "channel4", Kind::Long(45, -10000, 10000)),
|
||||
];
|
||||
const MEZZOTINT: &[Field] = &[Field(
|
||||
"MztT",
|
||||
"type",
|
||||
Kind::Enum(
|
||||
"MztT",
|
||||
&[
|
||||
("FnDt", "fineDots"),
|
||||
("CrsD", "coarseDots"),
|
||||
("GrnD", "grainyDots"),
|
||||
("LngL", "longLines"),
|
||||
("LngS", "longStrokes"),
|
||||
("MdmD", "mediumDots"),
|
||||
("MdmL", "mediumLines"),
|
||||
("MdmS", "mediumStrokes"),
|
||||
("ShSt", "shortStrokes"),
|
||||
("ShrL", "shortLines"),
|
||||
],
|
||||
"fineDots",
|
||||
),
|
||||
)];
|
||||
const MOSAIC: &[Field] = &[Field("ClSz", "cellSize", Kind::Pixels(2.0, 2.0, 200.0))];
|
||||
const POINTILLIZE: &[Field] = &[Field("ClSz", "cellSize", Kind::Long(5, 3, 300))];
|
||||
|
||||
/// The event's fields in recorded order; other filter families keep their own adapters.
|
||||
fn fields(id: &str) -> Option<&'static [Field]> {
|
||||
Some(match id {
|
||||
"filter.stylize.extrude" => EXTRUDE,
|
||||
"filter.stylize.traceContour" => TRACE,
|
||||
"filter.stylize.wind" => WIND,
|
||||
"filter.stylize.tiles" => TILES,
|
||||
"filter.pixelate.colorHalftone" => HALFTONE,
|
||||
"filter.pixelate.mezzotint" => MEZZOTINT,
|
||||
"filter.pixelate.mosaic" => MOSAIC,
|
||||
"filter.pixelate.pointillize" => POINTILLIZE,
|
||||
"filter.stylize.findEdges" | "filter.stylize.solarize" | "filter.pixelate.facet" | "filter.pixelate.fragment" => &[],
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
impl Kind {
|
||||
/// Missing ATN keys take the measured default, which can differ from the native command.
|
||||
fn default(&self) -> Value {
|
||||
match self {
|
||||
Self::Long(n, ..) => json!(n),
|
||||
Self::Pixels(n, ..) => json!(n),
|
||||
Self::Bool(b) => json!(b),
|
||||
Self::Enum(_, _, value) => json!(value),
|
||||
}
|
||||
}
|
||||
|
||||
/// Reject incompatible types and enum identities; clamp only measured numeric ranges.
|
||||
fn read(&self, value: &D) -> Option<Value> {
|
||||
Some(match (self, value) {
|
||||
(Self::Long(_, min, max), D::Integer(n)) => json!(n.clamp(min, max)),
|
||||
(Self::Pixels(_, min, max), D::UnitFloat { unit, value: n }) if unit == b"#Pxl" && n.is_finite() => json!(n.clamp(*min, *max)),
|
||||
(Self::Pixels(_, min, max), D::Double(n)) if n.is_finite() => json!(n.clamp(*min, *max)),
|
||||
(Self::Pixels(_, min, max), D::Integer(n)) => json!(f64::from(*n).clamp(*min, *max)),
|
||||
(Self::Bool(_), D::Boolean(b)) => json!(b),
|
||||
(Self::Enum(ty, values, _), D::Enumerated { type_id, value }) if type_id.is(ty) => {
|
||||
json!(values.iter().find(|(code, _)| value.is(code))?.1)
|
||||
}
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
/// Refuse native values the field cannot represent instead of changing the saved edit.
|
||||
fn write(&self, value: &Value) -> Option<D> {
|
||||
Some(match self {
|
||||
Self::Long(_, min, max) => {
|
||||
let n = value.as_f64()?;
|
||||
let integer = n as i32;
|
||||
if f64::from(integer) != n || !(*min..=*max).contains(&integer) {
|
||||
return None;
|
||||
}
|
||||
D::Integer(integer)
|
||||
}
|
||||
Self::Pixels(_, min, max) => {
|
||||
let n = value.as_f64()?;
|
||||
if !n.is_finite() || !(*min..=*max).contains(&n) {
|
||||
return None;
|
||||
}
|
||||
px(n)
|
||||
}
|
||||
Self::Bool(_) => D::Boolean(value.as_bool()?),
|
||||
Self::Enum(ty, values, _) => enm(ty, values.iter().find(|(_, label)| Some(*label) == value.as_str())?.0),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Unknown or duplicate keys keep the original step intact rather than lose settings.
|
||||
fn params_from(id: &str, d: &Descriptor) -> Option<Map<String, Value>> {
|
||||
let fields = fields(id)?;
|
||||
if d.items.iter().any(|(key, _)| !fields.iter().any(|f| key.is(f.0))) {
|
||||
return None;
|
||||
}
|
||||
let mut params = Map::new();
|
||||
for Field(key, param, kind) in fields {
|
||||
if d.items.iter().filter(|(k, _)| k.is(key)).count() > 1 {
|
||||
return None;
|
||||
}
|
||||
let value = match d.get(key) {
|
||||
Some(value) => kind.read(value)?,
|
||||
None => kind.default(),
|
||||
};
|
||||
params.insert((*param).into(), value);
|
||||
}
|
||||
Some(params)
|
||||
}
|
||||
|
||||
/// Map a complete measured descriptor or leave it as an unsupported Photoshop step.
|
||||
pub(super) fn from(id: &str, d: &Descriptor) -> Mapped {
|
||||
if d.items.is_empty() { step(id, json!({})) } else { Mapped::Unsupported { harmless: false } }
|
||||
match params_from(id, d) {
|
||||
Some(params) => step(id, Value::Object(params)),
|
||||
None => Mapped::Unsupported { harmless: false },
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn to(_id: &str, p: &Value) -> Option<Descriptor> {
|
||||
/// Write every measured key, preserving native defaults and rejecting native-only settings.
|
||||
pub(super) fn to(id: &str, p: &Value) -> Option<Descriptor> {
|
||||
let fields = fields(id)?;
|
||||
let params = p.as_object()?;
|
||||
// These events have no fields for a layer reference or any native filter settings.
|
||||
params.keys().all(|key| key == "target").then(|| desc("null"))
|
||||
let seeded =
|
||||
matches!(id, "filter.stylize.extrude" | "filter.stylize.wind" | "filter.stylize.tiles" | "filter.pixelate.mezzotint" | "filter.pixelate.pointillize");
|
||||
if !super::events::pixel_target(p)
|
||||
|| params.iter().any(|(key, value)| {
|
||||
!fields.iter().any(|f| f.1 == key.as_str()) && key != "target" && !(key == "seed" && seeded && (value.is_null() || value.as_f64() == Some(0.0)))
|
||||
})
|
||||
{
|
||||
return None;
|
||||
}
|
||||
let mut d = desc("null");
|
||||
for Field(key, param, kind) in fields {
|
||||
// Imports materialize Photoshop's defaults. Native commands retain their own defaults.
|
||||
let default = match (id, *param) {
|
||||
("filter.pixelate.mosaic", "cellSize") => json!(10),
|
||||
("filter.stylize.traceContour", "edge") => json!("lower"),
|
||||
_ => kind.default(),
|
||||
};
|
||||
d = d.with(key, kind.write(p.get(param).filter(|v| !v.is_null()).unwrap_or(&default))?);
|
||||
}
|
||||
Some(d)
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
/// The parameterless events use an empty descriptor and accept both event identifiers.
|
||||
#[test]
|
||||
fn parameterless_stylize_and_pixelate_events_use_both_event_id_forms() {
|
||||
for (code, name, id) in [
|
||||
@@ -9,21 +10,396 @@ fn parameterless_stylize_and_pixelate_events_use_both_event_id_forms() {
|
||||
(*b"Frgm", "fragment", "filter.pixelate.fragment"),
|
||||
] {
|
||||
for event in [AtnEvent::Code(code), AtnEvent::name(name)] {
|
||||
let file = AtnFile {
|
||||
name: UnicodeString::new_nul("Group D"),
|
||||
actions: vec![AtnAction {
|
||||
name: UnicodeString::new_nul("A"),
|
||||
items: vec![AtnItem { event, descriptor: Some(desc("null")), ..Default::default() }],
|
||||
..Default::default()
|
||||
}],
|
||||
..Default::default()
|
||||
};
|
||||
let imported = import(&atn::write(&file).unwrap()).unwrap();
|
||||
assert!(imported.unsupported.is_empty());
|
||||
assert_eq!(imported.actions[0].steps, vec![(id.into(), json!({}))]);
|
||||
assert_eq!(export_item(id, &json!({}), "Group D").unwrap().descriptor, Some(desc("null")));
|
||||
let mut s = load_items(vec![AtnItem { event, descriptor: Some(desc("null")), ..Default::default() }]);
|
||||
assert_eq!(s.actions.list[0].steps, vec![(id.into(), json!({}))]);
|
||||
assert_eq!(saved_items(&mut s)[0].descriptor, Some(desc("null")));
|
||||
assert!(export_item(id, &json!({"layer": 17}), "Group D").is_none());
|
||||
assert!(export_item(id, &json!({"target": "mask"}), "Group D").is_none());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Fixture {
|
||||
code: &'static str,
|
||||
name: &'static str,
|
||||
id: &'static str,
|
||||
default: Descriptor,
|
||||
defaults: Value,
|
||||
changed: Descriptor,
|
||||
changes: Value,
|
||||
}
|
||||
|
||||
/// Independent descriptor fixtures spell out measured key order, types, values and defaults.
|
||||
fn fixtures() -> Vec<Fixture> {
|
||||
vec![
|
||||
Fixture {
|
||||
code: "Extr",
|
||||
name: "extrude",
|
||||
id: "filter.stylize.extrude",
|
||||
default: desc("null")
|
||||
.with("ExtS", D::Integer(30))
|
||||
.with("ExtD", D::Integer(30))
|
||||
.with("ExtF", D::Boolean(false))
|
||||
.with("ExtM", D::Boolean(false))
|
||||
.with("ExtT", enm("ExtT", "Blks"))
|
||||
.with("ExtR", enm("ExtR", "Rndm")),
|
||||
defaults: json!({"size":30,"depth":30,"solidFrontFaces":false,"maskIncompleteBlocks":false,"type":"blocks","depthMode":"random"}),
|
||||
changed: desc("null")
|
||||
.with("ExtS", D::Integer(42))
|
||||
.with("ExtD", D::Integer(91))
|
||||
.with("ExtF", D::Boolean(true))
|
||||
.with("ExtM", D::Boolean(true))
|
||||
.with("ExtT", enm("ExtT", "Pyrm"))
|
||||
.with("ExtR", enm("ExtR", "LvlB")),
|
||||
changes: json!({"size":42,"depth":91,"solidFrontFaces":true,"maskIncompleteBlocks":true,"type":"pyramids","depthMode":"levelBased"}),
|
||||
},
|
||||
Fixture {
|
||||
code: "TrcC",
|
||||
name: "traceContour",
|
||||
id: "filter.stylize.traceContour",
|
||||
default: desc("null").with("Lvl ", D::Integer(128)).with("Edg ", enm("CntE", "Upr ")),
|
||||
defaults: json!({"level":128,"edge":"upper"}),
|
||||
changed: desc("null").with("Lvl ", D::Integer(43)).with("Edg ", enm("CntE", "Lwr ")),
|
||||
changes: json!({"level":43,"edge":"lower"}),
|
||||
},
|
||||
Fixture {
|
||||
code: "Wnd ",
|
||||
name: "wind",
|
||||
id: "filter.stylize.wind",
|
||||
default: desc("null").with("WndM", enm("WndM", "Wnd ")).with("Drct", enm("Drct", "Left")),
|
||||
defaults: json!({"method":"wind","direction":"fromRight"}),
|
||||
changed: desc("null").with("WndM", enm("WndM", "Stgr")).with("Drct", enm("Drct", "Rght")),
|
||||
changes: json!({"method":"stagger","direction":"fromLeft"}),
|
||||
},
|
||||
Fixture {
|
||||
code: "Tls ",
|
||||
name: "tiles",
|
||||
id: "filter.stylize.tiles",
|
||||
default: desc("null").with("TlNm", D::Integer(10)).with("TlOf", D::Integer(10)).with("FlCl", enm("FlCl", "FlBc")),
|
||||
defaults: json!({"count":10,"maxOffset":10,"fill":"background"}),
|
||||
changed: desc("null").with("TlNm", D::Integer(17)).with("TlOf", D::Integer(23)).with("FlCl", enm("FlCl", "FlFr")),
|
||||
changes: json!({"count":17,"maxOffset":23,"fill":"foreground"}),
|
||||
},
|
||||
Fixture {
|
||||
code: "ClrH",
|
||||
name: "colorHalftone",
|
||||
id: "filter.pixelate.colorHalftone",
|
||||
default: desc("null")
|
||||
.with("Rds ", D::Integer(8))
|
||||
.with("Ang1", D::Integer(108))
|
||||
.with("Ang2", D::Integer(162))
|
||||
.with("Ang3", D::Integer(90))
|
||||
.with("Ang4", D::Integer(45)),
|
||||
defaults: json!({"maxRadius":8,"channel1":108,"channel2":162,"channel3":90,"channel4":45}),
|
||||
changed: desc("null")
|
||||
.with("Rds ", D::Integer(12))
|
||||
.with("Ang1", D::Integer(-10000))
|
||||
.with("Ang2", D::Integer(10000))
|
||||
.with("Ang3", D::Integer(-721))
|
||||
.with("Ang4", D::Integer(1001)),
|
||||
changes: json!({"maxRadius":12,"channel1":-10000,"channel2":10000,"channel3":-721,"channel4":1001}),
|
||||
},
|
||||
Fixture {
|
||||
code: "Mztn",
|
||||
name: "mezzotint",
|
||||
id: "filter.pixelate.mezzotint",
|
||||
default: desc("null").with("MztT", enm("MztT", "FnDt")),
|
||||
defaults: json!({"type":"fineDots"}),
|
||||
changed: desc("null").with("MztT", enm("MztT", "LngS")),
|
||||
changes: json!({"type":"longStrokes"}),
|
||||
},
|
||||
Fixture {
|
||||
code: "Msc ",
|
||||
name: "mosaic",
|
||||
id: "filter.pixelate.mosaic",
|
||||
default: desc("null").with("ClSz", px(2.0)),
|
||||
defaults: json!({"cellSize":2}),
|
||||
changed: desc("null").with("ClSz", px(31.5)),
|
||||
changes: json!({"cellSize":31.5}),
|
||||
},
|
||||
Fixture {
|
||||
code: "Pntl",
|
||||
name: "pointillize",
|
||||
id: "filter.pixelate.pointillize",
|
||||
default: desc("null").with("ClSz", D::Integer(5)),
|
||||
defaults: json!({"cellSize":5}),
|
||||
changed: desc("null").with("ClSz", D::Integer(19)),
|
||||
changes: json!({"cellSize":19}),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
/// Load an actual action file through the command boundary, including flag and name handling.
|
||||
fn load_items(items: Vec<AtnItem>) -> Session {
|
||||
let file = AtnFile {
|
||||
name: UnicodeString::new_nul("Group D"),
|
||||
actions: vec![AtnAction { name: UnicodeString::new_nul("A"), items, ..Default::default() }],
|
||||
..Default::default()
|
||||
};
|
||||
let bytes = atn::write(&file).unwrap();
|
||||
let mut s = Session::new();
|
||||
s.execute("actions.load", json!({"data":photocraft_paint::tile::b64_encode(&bytes)})).unwrap();
|
||||
s
|
||||
}
|
||||
|
||||
/// Save through the real command and parse its bytes so descriptor order and types stay visible.
|
||||
fn saved_items(s: &mut Session) -> Vec<AtnItem> {
|
||||
let result = s.execute("actions.save", json!({"action":"A"})).unwrap();
|
||||
assert_eq!(result["skipped"], json!([]));
|
||||
let bytes = photocraft_paint::tile::b64_decode(result["data"].as_str().unwrap()).unwrap();
|
||||
atn::parse(&bytes).unwrap().actions.remove(0).items
|
||||
}
|
||||
|
||||
/// A measured four-character event with the supplied independent descriptor.
|
||||
fn code_item(code: &str, descriptor: Descriptor) -> AtnItem {
|
||||
AtnItem { event: AtnEvent::Code(code.as_bytes().try_into().unwrap()), descriptor: Some(descriptor), ..Default::default() }
|
||||
}
|
||||
|
||||
/// Check exact independent descriptors through real load/save commands, not a codec against itself.
|
||||
#[test]
|
||||
fn measured_defaults_and_every_changed_value_round_trip_in_order() {
|
||||
for fixture in fixtures() {
|
||||
for (descriptor, params) in [(&fixture.default, &fixture.defaults), (&fixture.changed, &fixture.changes)] {
|
||||
for named in [false, true] {
|
||||
let mut item = code_item(fixture.code, descriptor.clone());
|
||||
if named {
|
||||
item.event = AtnEvent::name(fixture.name);
|
||||
}
|
||||
let mut s = load_items(vec![item]);
|
||||
assert_eq!(s.actions.list[0].steps, vec![(fixture.id.into(), params.clone())], "{} named={named}", fixture.code);
|
||||
let saved = saved_items(&mut s);
|
||||
assert_eq!(saved[0].event, AtnEvent::Code(fixture.code.as_bytes().try_into().unwrap()));
|
||||
assert_eq!(saved[0].descriptor.as_ref(), Some(descriptor), "{} named={named}", fixture.code);
|
||||
}
|
||||
}
|
||||
let mut s = load_items(vec![code_item(fixture.code, desc("null"))]);
|
||||
assert_eq!(s.actions.list[0].steps[0], (fixture.id.into(), fixture.defaults), "{} missing keys", fixture.code);
|
||||
assert_eq!(saved_items(&mut s)[0].descriptor, Some(fixture.default));
|
||||
}
|
||||
}
|
||||
|
||||
/// Every measured numeric bound is checked independently, including angles beyond 360 degrees.
|
||||
#[test]
|
||||
fn numeric_imports_clamp_measured_ranges_and_keep_unmeasured_trace_levels() {
|
||||
for (code, key, param, min, max) in [
|
||||
("Extr", "ExtS", "size", 2, 255),
|
||||
("Extr", "ExtD", "depth", 1, 255),
|
||||
("Tls ", "TlNm", "count", 1, 99),
|
||||
("Tls ", "TlOf", "maxOffset", 1, 99),
|
||||
("ClrH", "Rds ", "maxRadius", 4, 127),
|
||||
("ClrH", "Ang1", "channel1", -10000, 10000),
|
||||
("ClrH", "Ang2", "channel2", -10000, 10000),
|
||||
("ClrH", "Ang3", "channel3", -10000, 10000),
|
||||
("ClrH", "Ang4", "channel4", -10000, 10000),
|
||||
("Msc ", "ClSz", "cellSize", 2, 200),
|
||||
("Pntl", "ClSz", "cellSize", 3, 300),
|
||||
] {
|
||||
for (input, expected) in [(i32::MIN, min), (min - 1, min), (min, min), (max, max), (max + 1, max), (i32::MAX, max)] {
|
||||
let value = if code == "Msc " { px(f64::from(input)) } else { D::Integer(input) };
|
||||
let mut s = load_items(vec![code_item(code, desc("null").with(key, value))]);
|
||||
assert_ne!(s.actions.list[0].steps[0].0, PHOTOSHOP_STEP, "{code}/{key}");
|
||||
assert_eq!(s.actions.list[0].steps[0].1[param], expected, "{code}/{key}/{input}");
|
||||
assert!(saved_items(&mut s)[0].descriptor.is_some());
|
||||
}
|
||||
}
|
||||
for level in [i32::MIN, -1, 0, 255, 300, i32::MAX] {
|
||||
let mut s = load_items(vec![code_item("TrcC", desc("null").with("Lvl ", D::Integer(level)))]);
|
||||
assert_eq!(s.actions.list[0].steps[0].1["level"], level);
|
||||
assert_eq!(saved_items(&mut s)[0].descriptor.as_ref().unwrap().get("Lvl "), Some(&D::Integer(level)));
|
||||
}
|
||||
for unitless in [D::Integer(2), D::Double(2.0)] {
|
||||
let mut s = load_items(vec![code_item("Msc ", desc("null").with("ClSz", unitless))]);
|
||||
assert_eq!(saved_items(&mut s)[0].descriptor, Some(desc("null").with("ClSz", px(2.0))));
|
||||
}
|
||||
}
|
||||
|
||||
/// Every enumerator is explicit, and unknown values or enum types retain the original flagged step.
|
||||
#[test]
|
||||
fn enum_values_map_exactly_and_unknown_descriptors_stay_kept() {
|
||||
for (code, key, param, ty, values) in [
|
||||
("Extr", "ExtT", "type", "ExtT", vec![("Blks", "blocks"), ("Pyrm", "pyramids")]),
|
||||
("Extr", "ExtR", "depthMode", "ExtR", vec![("Rndm", "random"), ("LvlB", "levelBased")]),
|
||||
("TrcC", "Edg ", "edge", "CntE", vec![("Lwr ", "lower"), ("Upr ", "upper")]),
|
||||
("Wnd ", "WndM", "method", "WndM", vec![("Wnd ", "wind"), ("Blst", "blast"), ("Stgr", "stagger")]),
|
||||
("Wnd ", "Drct", "direction", "Drct", vec![("Left", "fromRight"), ("Rght", "fromLeft")]),
|
||||
("Tls ", "FlCl", "fill", "FlCl", vec![("FlBc", "background"), ("FlFr", "foreground"), ("FlIn", "inverse"), ("FlSm", "unaltered")]),
|
||||
(
|
||||
"Mztn",
|
||||
"MztT",
|
||||
"type",
|
||||
"MztT",
|
||||
vec![
|
||||
("FnDt", "fineDots"),
|
||||
("CrsD", "coarseDots"),
|
||||
("GrnD", "grainyDots"),
|
||||
("LngL", "longLines"),
|
||||
("LngS", "longStrokes"),
|
||||
("MdmD", "mediumDots"),
|
||||
("MdmL", "mediumLines"),
|
||||
("MdmS", "mediumStrokes"),
|
||||
("ShSt", "shortStrokes"),
|
||||
("ShrL", "shortLines"),
|
||||
],
|
||||
),
|
||||
] {
|
||||
for (value, expected) in &values {
|
||||
let mut s = load_items(vec![code_item(code, desc("null").with(key, enm(ty, value)))]);
|
||||
assert_eq!(s.actions.list[0].steps[0].1[param], *expected, "{code}/{value}");
|
||||
assert_eq!(saved_items(&mut s)[0].descriptor.as_ref().unwrap().get(key), Some(&enm(ty, value)));
|
||||
}
|
||||
for value in [enm(ty, "????"), enm("Bad!", values[0].0), D::Boolean(true)] {
|
||||
let descriptor = desc("null").with(key, value);
|
||||
let mut item = code_item(code, descriptor.clone());
|
||||
item.enabled = false;
|
||||
item.with_dialog = true;
|
||||
item.dialog_options = 2;
|
||||
let mut s = load_items(vec![item]);
|
||||
assert_eq!(s.actions.list[0].steps[0].0, PHOTOSHOP_STEP, "{code}/{key}");
|
||||
assert!(s.actions.list[0].disabled.contains(&0));
|
||||
assert!(s.actions.list[0].dialogs.contains(&0));
|
||||
let saved = saved_items(&mut s);
|
||||
assert_eq!(saved[0].descriptor, Some(descriptor));
|
||||
assert!(!saved[0].enabled);
|
||||
assert!(saved[0].with_dialog);
|
||||
}
|
||||
}
|
||||
for (code, descriptor) in [
|
||||
("Msc ", desc("null").with("ClSz", D::UnitFloat { unit: *b"#Prc", value: 3.0 })),
|
||||
("Msc ", desc("null").with("ClSz", D::Double(f64::INFINITY))),
|
||||
("Extr", desc("null").with("ExtS", D::Double(30.5))),
|
||||
("Extr", desc("null").with("ExtS", D::Integer(30)).with("ExtS", D::Integer(31))),
|
||||
("FndE", desc("null").with("unknown", D::Boolean(true))),
|
||||
] {
|
||||
let mut s = load_items(vec![code_item(code, descriptor.clone())]);
|
||||
assert_eq!(s.actions.list[0].steps[0].0, PHOTOSHOP_STEP);
|
||||
assert_eq!(saved_items(&mut s)[0].descriptor, Some(descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
/// Native defaults stay native; seeds, frozen colors, targets and lossy values are not discarded.
|
||||
#[test]
|
||||
fn exports_materialize_native_defaults_and_reject_unrepresentable_settings() {
|
||||
for fixture in fixtures() {
|
||||
let item = export_item(fixture.id, &json!({}), "Group D").unwrap();
|
||||
let mut expected = fixture.default.clone();
|
||||
if fixture.code == "Msc " {
|
||||
expected = desc("null").with("ClSz", px(10.0));
|
||||
}
|
||||
if fixture.code == "TrcC" {
|
||||
expected = desc("null").with("Lvl ", D::Integer(128)).with("Edg ", enm("CntE", "Lwr "));
|
||||
}
|
||||
assert_eq!(item.descriptor, Some(expected), "{}", fixture.id);
|
||||
for (key, value) in [
|
||||
("seed", json!(1)),
|
||||
("foreground", json!("#000000")),
|
||||
("background", json!([1, 1, 1, 1])),
|
||||
("layer", json!(17)),
|
||||
("target", json!("mask")),
|
||||
("target", json!("channel:red")),
|
||||
("unknown", json!(true)),
|
||||
] {
|
||||
let mut params = fixture.defaults.clone();
|
||||
params[key] = value;
|
||||
let mut s = Session::new();
|
||||
s.actions.list.push(Action::new("A", vec![(fixture.id.into(), params)]));
|
||||
assert!(s.execute("actions.save", json!({"action":"A"})).is_err(), "{}/{key}", fixture.id);
|
||||
}
|
||||
let mut params = fixture.defaults.clone();
|
||||
params["target"] = json!("pixels");
|
||||
assert!(export_item(fixture.id, ¶ms, "Group D").is_some());
|
||||
}
|
||||
for id in ["filter.stylize.extrude", "filter.stylize.wind", "filter.stylize.tiles", "filter.pixelate.mezzotint", "filter.pixelate.pointillize"] {
|
||||
assert!(export_item(id, &json!({"seed":0}), "Group D").is_some(), "{id}");
|
||||
}
|
||||
for (id, params) in [
|
||||
("filter.stylize.extrude", json!({"size":30.5})),
|
||||
("filter.stylize.wind", json!({"direction":"unknown"})),
|
||||
("filter.stylize.tiles", json!({"fill":"unknown"})),
|
||||
("filter.stylize.traceContour", json!({"edge":"unknown"})),
|
||||
("filter.pixelate.colorHalftone", json!({"channel1":10001})),
|
||||
("filter.pixelate.pointillize", json!({"cellSize":5.5})),
|
||||
("filter.pixelate.mosaic", json!({"cellSize":201})),
|
||||
("filter.pixelate.mezzotint", json!({"type":"unknown"})),
|
||||
] {
|
||||
assert!(export_item(id, ¶ms, "Group D").is_none(), "{id}/{params}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Imported actions produce the same pixels and Undo history as the specified native commands.
|
||||
#[test]
|
||||
fn imported_group_d_playback_matches_direct_commands_across_modes_and_depths() {
|
||||
let items: Vec<_> = fixtures()
|
||||
.into_iter()
|
||||
.map(|f| code_item(f.code, f.changed))
|
||||
.chain(["FndE", "Slrz", "Fct ", "Frgm"].map(|code| code_item(code, desc("null"))))
|
||||
.collect();
|
||||
for (depth, mode) in [(8, "rgb"), (16, "rgb"), (32, "rgb"), (8, "gray"), (8, "cmyk"), (16, "lab")] {
|
||||
let mut imported = load_items(items.clone());
|
||||
imported.actions.list[0].disabled.insert(10);
|
||||
imported.actions.list[0].dialogs.insert(0);
|
||||
let steps = imported.actions.list[0].steps.clone();
|
||||
let mut direct = Session::new();
|
||||
for s in [&mut imported, &mut direct] {
|
||||
prepare_pattern(s, depth, mode);
|
||||
}
|
||||
let before = pixels(&imported);
|
||||
let history = imported.active().unwrap().history.past_len();
|
||||
let result = imported.execute("actions.play", json!({"action":"A"})).unwrap();
|
||||
assert!(result.get("failed").is_none(), "{depth}/{mode}: {result}");
|
||||
assert_eq!(result["ran"], 11);
|
||||
for (index, (id, params)) in steps.into_iter().enumerate() {
|
||||
if index != 10 {
|
||||
direct.execute(&id, params).unwrap();
|
||||
}
|
||||
}
|
||||
assert_eq!(pixels(&imported), pixels(&direct), "{depth}/{mode}");
|
||||
assert_eq!(imported.active().unwrap().history.past_len(), direct.active().unwrap().history.past_len());
|
||||
let added = imported.active().unwrap().history.past_len() - history;
|
||||
assert!(added > 0);
|
||||
for _ in 0..added {
|
||||
imported.execute("edit.undo", json!({})).unwrap();
|
||||
}
|
||||
assert_eq!(pixels(&imported), before, "{depth}/{mode} undo");
|
||||
let saved = saved_items(&mut imported);
|
||||
assert!(!saved[10].enabled);
|
||||
assert!(saved[0].with_dialog);
|
||||
}
|
||||
}
|
||||
|
||||
/// A nonuniform image and nondefault tool colors expose differences hidden by flat inputs.
|
||||
fn prepare_pattern(s: &mut Session, depth: u32, mode: &str) {
|
||||
s.execute("file.new", json!({"width":32,"height":24,"depth":depth,"mode":mode,"background":"#102030"})).unwrap();
|
||||
s.execute("select.rect", json!({"x":3,"y":2,"width":14,"height":11})).unwrap();
|
||||
s.execute("edit.fill", json!({"color":"#ee9922"})).unwrap();
|
||||
s.execute("select.deselect", json!({})).unwrap();
|
||||
s.execute("tools.setColors", json!({"foreground":"#e83a91","background":"#148fca"})).unwrap();
|
||||
}
|
||||
|
||||
fn pixels(s: &Session) -> Vec<[f32; 4]> {
|
||||
photocraft_compose::render(&s.active().unwrap().doc, photocraft_geom::Rect::new(0, 0, 32, 24)).px
|
||||
}
|
||||
|
||||
/// Saving omitted native params preserves their actual command behavior, not Photoshop's defaults.
|
||||
#[test]
|
||||
fn native_and_measured_defaults_stay_distinct_through_playback() {
|
||||
use photocraft_algo::FilterParams;
|
||||
let mosaic = load_items(vec![code_item("Msc ", desc("null"))]);
|
||||
let measured = &mosaic.actions.list[0].steps[0].1;
|
||||
assert!(matches!(crate::filters::params_for("filter.pixelate.mosaic",&json!({})),Some(FilterParams::Mosaic{cell_size}) if cell_size==10.0));
|
||||
assert!(matches!(crate::filters::params_for("filter.pixelate.mosaic",measured),Some(FilterParams::Mosaic{cell_size}) if cell_size==2.0));
|
||||
let trace = load_items(vec![code_item("TrcC", desc("null"))]);
|
||||
let measured = &trace.actions.list[0].steps[0].1;
|
||||
assert!(matches!(crate::filters_ext::params_for("filter.stylize.traceContour", &json!({})), Some(FilterParams::TraceContour { upper: false, .. })));
|
||||
assert!(matches!(crate::filters_ext::params_for("filter.stylize.traceContour", measured), Some(FilterParams::TraceContour { upper: true, .. })));
|
||||
for id in ["filter.pixelate.mosaic", "filter.stylize.traceContour"] {
|
||||
let item = export_item(id, &json!({}), "Group D").unwrap();
|
||||
let mut imported = load_items(vec![item]);
|
||||
let mut native = Session::new();
|
||||
prepare_pattern(&mut imported, 8, "rgb");
|
||||
prepare_pattern(&mut native, 8, "rgb");
|
||||
native.execute(id, json!({})).unwrap();
|
||||
let result = imported.execute("actions.play", json!({"action":"A"})).unwrap();
|
||||
assert!(result.get("failed").is_none(), "{id}: {result}");
|
||||
assert_eq!(pixels(&imported), pixels(&native), "{id}");
|
||||
}
|
||||
}
|
||||
@@ -480,6 +480,14 @@ fn every_mapped_command_exports_and_imports_back() {
|
||||
("filter.stylize.solarize", json!({})),
|
||||
("filter.pixelate.facet", json!({})),
|
||||
("filter.pixelate.fragment", json!({})),
|
||||
("filter.stylize.extrude", json!({"size":42,"depth":91,"solidFrontFaces":true,"maskIncompleteBlocks":true,"type":"pyramids","depthMode":"levelBased"})),
|
||||
("filter.stylize.traceContour", json!({"level":43,"edge":"lower"})),
|
||||
("filter.stylize.wind", json!({"method":"stagger","direction":"fromLeft"})),
|
||||
("filter.stylize.tiles", json!({"count":17,"maxOffset":23,"fill":"foreground"})),
|
||||
("filter.pixelate.colorHalftone", json!({"maxRadius":12,"channel1":-10000,"channel2":10000,"channel3":-721,"channel4":1001})),
|
||||
("filter.pixelate.mezzotint", json!({"type":"longStrokes"})),
|
||||
("filter.pixelate.mosaic", json!({"cellSize":31.5})),
|
||||
("filter.pixelate.pointillize", json!({"cellSize":19})),
|
||||
("filter.blur.gaussianBlur", json!({"radius": 3.5})),
|
||||
("filter.sharpen.unsharpMask", json!({"amount": 120, "radius": 1.5, "threshold": 3})),
|
||||
("filter.noise.addNoise", json!({"amount": 12.5, "distribution": "gaussian", "monochromatic": true, "seed": 7})),
|
||||
|
||||
+145
-118
@@ -16,7 +16,7 @@ so playback skips them.
|
||||
This page has two parts: the events PhotoCraft maps today, and a measured reference for the events it
|
||||
does not map yet, with everything needed to implement them without the reference application.
|
||||
|
||||
## Supported events (117)
|
||||
## Supported events (129)
|
||||
|
||||
| Code | String ID | Label | PhotoCraft command(s) |
|
||||
|---|---|---|---|
|
||||
@@ -137,6 +137,150 @@ does not map yet, with everything needed to implement them without the reference
|
||||
| `UnsM` | unsharpMask | Unsharp Mask | `filter.sharpen.unsharpMask` |
|
||||
| (string ID only) | updatePlacedLayer | Update Smart Objects | `layer.smartObjects.updateModifiedContent` |
|
||||
| `Vbrn` | Vbrn | vibrance | `Vibrance` |
|
||||
| `Extr` | extrude | Extrude | `filter.stylize.extrude` |
|
||||
| `FndE` | findEdges | Find Edges | `filter.stylize.findEdges` |
|
||||
| `Slrz` | solarize | Solarize | `filter.stylize.solarize` |
|
||||
| `TrcC` | traceContour | Trace Contour | `filter.stylize.traceContour` |
|
||||
| `Wnd ` | wind | Wind | `filter.stylize.wind` |
|
||||
| `Tls ` | tiles | Tiles | `filter.stylize.tiles` |
|
||||
| `ClrH` | colorHalftone | Color Halftone | `filter.pixelate.colorHalftone` |
|
||||
| `Fct ` | facet | Facet | `filter.pixelate.facet` |
|
||||
| `Frgm` | fragment | Fragment | `filter.pixelate.fragment` |
|
||||
| `Mztn` | mezzotint | Mezzotint | `filter.pixelate.mezzotint` |
|
||||
| `Msc ` | mosaic | Mosaic | `filter.pixelate.mosaic` |
|
||||
| `Pntl` | pointillize | Pointillize | `filter.pixelate.pointillize` |
|
||||
|
||||
### Group D: The Stylize and Pixelate filters
|
||||
|
||||
These twelve events are mapped. The tables preserve their measured descriptor order, types, defaults and ranges.
|
||||
|
||||
Missing descriptor keys load with the measured defaults below. Mosaic therefore imports
|
||||
with cell size 2, and Trace Contour imports with its upper edge. Saving a native command
|
||||
that omits these parameters preserves its native behavior: Mosaic cell size 10 and
|
||||
Trace Contour lower edge. Explicit imported values stay explicit, including changed
|
||||
Trace Contour levels and edges that the reference application applies but does not echo.
|
||||
|
||||
Mosaic accepts a unitless pixel value on import and writes a `#Pxl` unit double.
|
||||
Other fields keep their documented integer, boolean and enum types. Unknown keys,
|
||||
wrong types or unknown enum values keep the original step intact. A native setting
|
||||
without a descriptor field, such as a nonzero seed, frozen foreground/background
|
||||
colors, an explicit layer or a non-pixel target, refuses export instead of being
|
||||
silently dropped. Seed 0 and the ordinary pixel target remain representable.
|
||||
These mappings reuse the existing filters; they do not establish new pixel-parity
|
||||
measurements against the reference application.
|
||||
|
||||
#### Extrude
|
||||
|
||||
- Event: `Extr` / `extrude`
|
||||
- PhotoCraft command: `filter.stylize.extrude`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `ExtS` | extrudeSize | integer | | 30 | 2 .. 255 (out-of-range values are clamped) |
|
||||
| `ExtD` | extrudeDepth | integer | | 30 | 1 .. 255 (out-of-range values are clamped) |
|
||||
| `ExtF` | extrudeSolidFace | boolean | | false | |
|
||||
| `ExtM` | extrudeMaskIncomplete | boolean | | false | |
|
||||
| `ExtT` | extrudeType | enumerated | | `Blks` blacks | `Blks` blacks, `Pyrm` pyramids |
|
||||
| `ExtR` | extrudeRandom | enumerated | | `Rndm` random | `LvlB` levelBased, `Rndm` random |
|
||||
|
||||
#### Find Edges
|
||||
|
||||
- Event: `FndE` / `findEdges`
|
||||
- PhotoCraft command: `filter.stylize.findEdges`
|
||||
|
||||
No parameters: the step carries an empty descriptor.
|
||||
|
||||
#### Solarize
|
||||
|
||||
- Event: `Slrz` / `solarize`
|
||||
- PhotoCraft command: `filter.stylize.solarize`
|
||||
|
||||
No parameters: the step carries an empty descriptor.
|
||||
|
||||
#### Trace Contour
|
||||
|
||||
- Event: `TrcC` / `traceContour`
|
||||
- PhotoCraft command: `filter.stylize.traceContour`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `Lvl ` | level | integer | | 128 | applied, but not echoed: the returned step always shows 128. Levels <= 0 and >= 255 give the same image. Dialog range pending. |
|
||||
| `Edg ` | edge | enumerated | | `Upr ` upper | `Lwr ` lower, `Upr ` upper (applied; the returned step always shows upper) |
|
||||
|
||||
#### Wind
|
||||
|
||||
- Event: `Wnd ` / `wind`
|
||||
- PhotoCraft command: `filter.stylize.wind`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `WndM` | windMethod | enumerated | | `Wnd ` wind | `Blst` blast, `Stgr` stagger, `Wnd ` wind |
|
||||
| `Drct` | direction | enumerated | | `Left` left | `Left` left, `Rght` right |
|
||||
|
||||
#### Tiles
|
||||
|
||||
- Event: `Tls ` / `tiles`
|
||||
- PhotoCraft command: `filter.stylize.tiles`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `TlNm` | tileNumber | integer | | 10 | 1 .. 99 (out-of-range values are clamped) |
|
||||
| `TlOf` | tileOffset | integer | | 10 | 1 .. 99 (out-of-range values are clamped) |
|
||||
| `FlCl` | fillColor | enumerated | | `FlBc` fillBack | `FlBc` fillBack, `FlFr` fillFore, `FlIn` fillInverse, `FlSm` fillSame |
|
||||
|
||||
#### Color Halftone
|
||||
|
||||
- Event: `ClrH` / `colorHalftone`
|
||||
- PhotoCraft command: `filter.pixelate.colorHalftone`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `Rds ` | radius | integer | | 8 | 4 .. 127 (out-of-range values are clamped) |
|
||||
| `Ang1` | angle1 | integer | | 108 | -10000 .. 10000 (out-of-range values are clamped) |
|
||||
| `Ang2` | angle2 | integer | | 162 | -10000 .. 10000 (out-of-range values are clamped) |
|
||||
| `Ang3` | angle3 | integer | | 90 | -10000 .. 10000 (out-of-range values are clamped) |
|
||||
| `Ang4` | angle4 | integer | | 45 | -10000 .. 10000 (out-of-range values are clamped) |
|
||||
|
||||
#### Facet
|
||||
|
||||
- Event: `Fct ` / `facet`
|
||||
- PhotoCraft command: `filter.pixelate.facet`
|
||||
|
||||
No parameters: the step carries an empty descriptor.
|
||||
|
||||
#### Fragment
|
||||
|
||||
- Event: `Frgm` / `fragment`
|
||||
- PhotoCraft command: `filter.pixelate.fragment`
|
||||
|
||||
No parameters: the step carries an empty descriptor.
|
||||
|
||||
#### Mezzotint
|
||||
|
||||
- Event: `Mztn` / `mezzotint`
|
||||
- PhotoCraft command: `filter.pixelate.mezzotint`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `MztT` | mezzotintType | enumerated | | `FnDt` fineDots | `CrsD` coarseDots, `FnDt` fineDots, `GrnD` grainyDots, `LngL` longLines, `LngS` longStrokes, `MdmD` mediumDots, `MdmL` mediumLines, `MdmS` mediumStrokes, `ShSt` shortStrokes, `ShrL` shortLines |
|
||||
|
||||
#### Mosaic
|
||||
|
||||
- Event: `Msc ` / `mosaic`
|
||||
- PhotoCraft command: `filter.pixelate.mosaic`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `ClSz` | cellSize | unitdouble | | 2 | 2 .. 200 pixels (out-of-range values are clamped). Write it as a unit double in `#Pxl`: the application accepts that and returns it unchanged. Read a value without a unit as pixels (the application returns its own default that way). |
|
||||
|
||||
#### Pointillize
|
||||
|
||||
- Event: `Pntl` / `pointillize`
|
||||
- PhotoCraft command: `filter.pixelate.pointillize`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `ClSz` | cellSize | integer | | 5 | 3 .. 300 (out-of-range values are clamped) |
|
||||
|
||||
## Event reference: events not mapped yet
|
||||
|
||||
@@ -863,123 +1007,6 @@ Nested values as recorded (defaults):
|
||||
|
||||
Displace reads a displacement map from a file chosen in a dialog; record one step and add its keys (file path form) before implementing.
|
||||
|
||||
### Group D: The Stylize and Pixelate filters
|
||||
|
||||
All commands exist in PhotoCraft (`filter.stylize.*`, `filter.pixelate.*`); only the `.atn` mapping is missing.
|
||||
|
||||
#### Extrude
|
||||
|
||||
- Event: `Extr` / `extrude`
|
||||
- PhotoCraft command: `filter.stylize.extrude`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `ExtS` | extrudeSize | integer | | 30 | 2 .. 255 (out-of-range values are clamped) |
|
||||
| `ExtD` | extrudeDepth | integer | | 30 | 1 .. 255 (out-of-range values are clamped) |
|
||||
| `ExtF` | extrudeSolidFace | boolean | | false | |
|
||||
| `ExtM` | extrudeMaskIncomplete | boolean | | false | |
|
||||
| `ExtT` | extrudeType | enumerated | | `Blks` blacks | `Blks` blacks, `Pyrm` pyramids |
|
||||
| `ExtR` | extrudeRandom | enumerated | | `Rndm` random | `LvlB` levelBased, `Rndm` random |
|
||||
|
||||
#### Find Edges
|
||||
|
||||
- Event: `FndE` / `findEdges`
|
||||
- PhotoCraft command: `filter.stylize.findEdges`
|
||||
|
||||
No parameters: the step carries an empty descriptor.
|
||||
|
||||
#### Solarize
|
||||
|
||||
- Event: `Slrz` / `solarize`
|
||||
- PhotoCraft command: `filter.stylize.solarize`
|
||||
|
||||
No parameters: the step carries an empty descriptor.
|
||||
|
||||
#### Trace Contour
|
||||
|
||||
- Event: `TrcC` / `traceContour`
|
||||
- PhotoCraft command: `filter.stylize.traceContour`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `Lvl ` | level | integer | | 128 | applied, but not echoed: the returned step always shows 128. Levels <= 0 and >= 255 give the same image. Dialog range pending. |
|
||||
| `Edg ` | edge | enumerated | | `Upr ` upper | `Lwr ` lower, `Upr ` upper (applied; the returned step always shows upper) |
|
||||
|
||||
#### Wind
|
||||
|
||||
- Event: `Wnd ` / `wind`
|
||||
- PhotoCraft command: `filter.stylize.wind`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `WndM` | windMethod | enumerated | | `Wnd ` wind | `Blst` blast, `Stgr` stagger, `Wnd ` wind |
|
||||
| `Drct` | direction | enumerated | | `Left` left | `Left` left, `Rght` right |
|
||||
|
||||
#### Tiles
|
||||
|
||||
- Event: `Tls ` / `tiles`
|
||||
- PhotoCraft command: `filter.stylize.tiles`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `TlNm` | tileNumber | integer | | 10 | 1 .. 99 (out-of-range values are clamped) |
|
||||
| `TlOf` | tileOffset | integer | | 10 | 1 .. 99 (out-of-range values are clamped) |
|
||||
| `FlCl` | fillColor | enumerated | | `FlBc` fillBack | `FlBc` fillBack, `FlFr` fillFore, `FlIn` fillInverse, `FlSm` fillSame |
|
||||
|
||||
#### Color Halftone
|
||||
|
||||
- Event: `ClrH` / `colorHalftone`
|
||||
- PhotoCraft command: `filter.pixelate.colorHalftone`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `Rds ` | radius | integer | | 8 | 4 .. 127 (out-of-range values are clamped) |
|
||||
| `Ang1` | angle1 | integer | | 108 | -10000 .. 10000 (out-of-range values are clamped) |
|
||||
| `Ang2` | angle2 | integer | | 162 | -10000 .. 10000 (out-of-range values are clamped) |
|
||||
| `Ang3` | angle3 | integer | | 90 | -10000 .. 10000 (out-of-range values are clamped) |
|
||||
| `Ang4` | angle4 | integer | | 45 | -10000 .. 10000 (out-of-range values are clamped) |
|
||||
|
||||
#### Facet
|
||||
|
||||
- Event: `Fct ` / `facet`
|
||||
- PhotoCraft command: `filter.pixelate.facet`
|
||||
|
||||
No parameters: the step carries an empty descriptor.
|
||||
|
||||
#### Fragment
|
||||
|
||||
- Event: `Frgm` / `fragment`
|
||||
- PhotoCraft command: `filter.pixelate.fragment`
|
||||
|
||||
No parameters: the step carries an empty descriptor.
|
||||
|
||||
#### Mezzotint
|
||||
|
||||
- Event: `Mztn` / `mezzotint`
|
||||
- PhotoCraft command: `filter.pixelate.mezzotint`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `MztT` | mezzotintType | enumerated | | `FnDt` fineDots | `CrsD` coarseDots, `FnDt` fineDots, `GrnD` grainyDots, `LngL` longLines, `LngS` longStrokes, `MdmD` mediumDots, `MdmL` mediumLines, `MdmS` mediumStrokes, `ShSt` shortStrokes, `ShrL` shortLines |
|
||||
|
||||
#### Mosaic
|
||||
|
||||
- Event: `Msc ` / `mosaic`
|
||||
- PhotoCraft command: `filter.pixelate.mosaic`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `ClSz` | cellSize | unitdouble | | 2 | 2 .. 200 pixels (out-of-range values are clamped). Write it as a unit double in `#Pxl`: the application accepts that and returns it unchanged. Read a value without a unit as pixels (the application returns its own default that way). |
|
||||
|
||||
#### Pointillize
|
||||
|
||||
- Event: `Pntl` / `pointillize`
|
||||
- PhotoCraft command: `filter.pixelate.pointillize`
|
||||
|
||||
| Key | String ID | Type | Unit | Default | Allowed |
|
||||
|---|---|---|---|---|---|
|
||||
| `ClSz` | cellSize | integer | | 5 | 3 .. 300 (out-of-range values are clamped) |
|
||||
|
||||
### Group E: Video, Other and matting filters and the direct Gradient Map / Replace Color adjustments
|
||||
|
||||
All commands exist in PhotoCraft; only the `.atn` mapping is missing. Gradient Map and Replace Color here are the direct adjustments (Image > Adjustments), not adjustment layers (those are already mapped).
|
||||
|
||||
Reference in new issue
Block a user