Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

.ai import: Stylize effects open with their saved settings

dotCooCoo664fe8a12b55
diff --git a/crates/engine/tests/import_fuzz.rs b/crates/engine/tests/import_fuzz.rs
index 7ae7b1d63..d24f69d00 100644
--- a/crates/engine/tests/import_fuzz.rs
+++ b/crates/engine/tests/import_fuzz.rs
@@ -3401,6 +3401,29 @@ fn arb_ai_token() -> impl Strategy<Value = String> {
"(Fill Style Filter) 0 0 /Filter ,",
"(Adobe Outer Glow) 1 0 /Filter ,",
"(Adobe Drop Shadow) 1 0 /Filter ,",
+ "(Adobe Inner Glow) 1 0 /Filter ,",
+ "(Adobe Fuzzy Mask) 1 0 /Filter ,",
+ "(Adobe Round Corners) 1 0 /Filter ,",
+ "(Adobe Scribble Fill) 1 0 /Filter ,",
+ "(Chain Style Filter) 0 0 /Filter ,",
+ "/Dictionary : /NotRecorded ,",
+ "; /Dict ;",
+ "2.5 /Int (blnd) ,",
+ "99 /Int (csrc) ,",
+ "1e308 /Int (gtyp) ,",
+ "1 /Int (gtyp) ,",
+ "-13 /Real (vert) ,",
+ "14 /Real (Radius) ,",
+ "-1e308 /Real (radius) ,",
+ "67 /Real (Angle) ,",
+ "0.17 /Real (Scribbliness) ,",
+ "1e308 /Real (Spacing) ,",
+ "(x) /String (note) ,",
+ "1 /Bool (usePSLBlur) ,",
+ "16 /Int (Adobe Effect Expand Before Version) ,",
+ "/FillStyle : 0 O\n0 0 0 0 1 0 0 Xa\n0 1 Xd\n/Def ;\n (sclr) ,",
+ "/FillStyle : 0 O\nBb\n2 (G) 0 0 0 1 1 0 0 1 0 0 Bg\n0 BB\n/Def ;\n (gclr) ,",
+ "(sclr) ,",
"1 /Visible ,",
"2 /FillOrStroke ,",
"1 /Bool (BSDashAdj) ,",
diff --git a/crates/eps/src/import/ai/style.rs b/crates/eps/src/import/ai/style.rs
index ede1ae8e9..20950c965 100644
--- a/crates/eps/src/import/ai/style.rs
+++ b/crates/eps/src/import/ai/style.rs
@@ -48,8 +48,12 @@ use super::obj::V;
use super::paint;
const GLOW: &str = "Adobe Outer Glow"; // brand-ok: the filter's name in the files
-const FEATHER: &str = "Adobe Feather"; // brand-ok: the filter's name in the files
+const INNER_GLOW: &str = "Adobe Inner Glow"; // brand-ok: the filter's name in the files
+const FEATHER: &str = "Adobe Fuzzy Mask"; // brand-ok: the filter's name in the files
const SHADOW: &str = "Adobe Drop Shadow"; // brand-ok: the filter's name in the files
+const ROUND_CORNERS: &str = "Adobe Round Corners"; // brand-ok: the filter's name in the files
+const SCRIBBLE: &str = "Adobe Scribble Fill"; // brand-ok: the filter's name in the files
+const EXPAND_VERSION: &str = "Adobe Effect Expand Before Version"; // brand-ok: the key's name in the files
const DEFORM: &str = "Adobe Deform"; // brand-ok: the filter's name in the files
const OFFSET: &str = "Adobe Offset Path"; // brand-ok: the filter's name in the files
const TRANSFORM: &str = "Adobe Transform"; // brand-ok: the filter's name in the files
@@ -94,8 +98,8 @@ pub(super) struct ArtStyle {
/// The style reads as [`Self::items`] and [`Self::effects`].
pub plain: bool,
/// It is one fill and one stroke at most, in solid colours or the object's own gradient, with
- /// no transparency or effects of their own, and only Outer Glow, Feather and Drop Shadow on the
- /// object: what any object is read with. Type takes the other plain styles too (its drawn look
+ /// no transparency or effects of their own, and only Drop Shadow, Inner Glow, Outer Glow,
+ /// Feather, Round Corners and Scribble on the object: what any object is read with. Type takes the other plain styles too (its drawn look
/// can't be retyped); other objects keep their drawn look, which is the app's own rendering.
pub simple: bool,
/// Its fills and strokes, bottom first.
@@ -148,6 +152,17 @@ impl Default for ItemLook {
}
}
+/// How a filter's dictionary writes an entry: `value /Int (key) ,`, `/Real`, `/Bool`, a fill's
+/// style (`/FillStyle : … /Def ; (key) ,`), or anything else.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+enum Kind {
+ Int,
+ Real,
+ Bool,
+ Fill,
+ Other,
+}
+
#[derive(Debug)]
struct Filter {
name: String,
@@ -156,6 +171,8 @@ struct Filter {
parent: Option<usize>,
compound: bool,
params: HashMap<String, f64>,
+ /// How each key of its dictionary is written.
+ kinds: HashMap<String, Kind>,
/// Its dictionary's arrays (`/Array : v /Real , … ; (key) ,`), by key.
arrays: HashMap<String, Vec<f64>>,
fill: Option<Paint>,
@@ -184,6 +201,7 @@ impl Default for Filter {
parent: None,
compound: false,
params: HashMap::new(),
+ kinds: HashMap::new(),
arrays: HashMap::new(),
fill: None,
stroke: None,
@@ -223,6 +241,10 @@ pub(super) fn art_styles(data: &[u8]) -> HashMap<String, ArtStyle> {
};
let mut array: Option<Vec<V>> = None;
let mut dict_array: Option<Vec<f64>> = None;
+ // A paint style being read as a dictionary entry: its key follows its `/Def ;`.
+ let mut style_entry: Option<Kind> = None;
+ // A name of a basic filter's that may be an entry's type, with the string that follows it.
+ let mut other_entry: Option<Option<String>> = None;
let mut lex = Lexer::new(data);
while let Some(t) = lex.next_token() {
if let (Some(a), Tok::Num(v)) = (array.as_mut(), &t.tok) {
@@ -231,14 +253,21 @@ pub(super) fn art_styles(data: &[u8]) -> HashMap<String, ArtStyle> {
}
match t.tok {
Tok::Num(v) => operands.push(V::Num(v)),
- Tok::Str(s) | Tok::Hex(s) => operands.push(V::Str(s)),
+ Tok::Str(s) | Tok::Hex(s) => {
+ if let Some(key @ None) = other_entry.as_mut() {
+ *key = Some(String::from_utf8_lossy(&s).into_owned());
+ }
+ operands.push(V::Str(s));
+ }
Tok::Name(n) => match n {
b"KnownStyle" => {
finish(name.take(), &mut filters);
operands.clear();
open.clear();
- (pending, in_basic) = (None, false);
+ (pending, in_basic, style_entry, other_entry) = (None, false, None, None);
}
+ b"FillStyle" => style_entry = Some(Kind::Fill),
+ b"StrokeStyle" | b"BlendStyle" => style_entry = Some(Kind::Other),
b"Name" if name.is_none() && filters.is_empty() => name = operands.iter().rev().find_map(V::text),
b"CompoundFilter" => pending = Some(true),
b"BasicFilter" => pending = Some(false),
@@ -271,17 +300,31 @@ pub(super) fn art_styles(data: &[u8]) -> HashMap<String, ArtStyle> {
a.extend(value);
continue;
}
+ let kind = match n {
+ b"Int" => Kind::Int,
+ b"Real" => Kind::Real,
+ _ => Kind::Bool,
+ };
// The key follows: `value /Real (key) ,`.
- if let (Some(value), Some(Tok::Str(key))) = (value, lex.next_token().map(|t| t.tok))
+ if let Some(Tok::Str(key)) = lex.next_token().map(|t| t.tok)
&& let Some(f) = filters.last_mut()
{
- f.params.insert(String::from_utf8_lossy(&key).into_owned(), value);
+ let key = String::from_utf8_lossy(&key).into_owned();
+ match value {
+ Some(value) => f.params.insert(key.clone(), value),
+ None => f.params.remove(&key),
+ };
+ f.kinds.insert(key, kind);
}
continue;
}
+ // Perhaps an entry of another type (`(text) /String (key) ,`): its key, if any, is
+ // the string before the `,`.
+ _ if in_basic => other_entry = Some(None),
_ => {}
},
Tok::Word(w) => {
+ let entry = other_entry.take().flatten();
let op = std::str::from_utf8(w).unwrap_or_default();
if op == "[" {
array = Some(vec![]);
@@ -304,6 +347,15 @@ pub(super) fn art_styles(data: &[u8]) -> HashMap<String, ArtStyle> {
if op == ";" && !in_basic {
open.pop();
}
+ if op == "," {
+ let key = match style_entry.take() {
+ Some(kind) => operands.iter().rev().find_map(V::text).map(|k| (k, kind)),
+ None => entry.map(|k| (k, Kind::Other)),
+ };
+ if let (Some((key, kind)), Some(f)) = (key, filters.last_mut()) {
+ f.kinds.insert(key, kind);
+ }
+ }
if let Some(f) = filters.last_mut() {
paint_op(f, op, &operands);
}
@@ -428,39 +480,144 @@ fn width_profile(arrays: &HashMap<String, Vec<f64>>) -> Option<WidthProfile> {
(!uniform).then_some(WidthProfile { points })
}
-/// The live effect filter `f` is, when it is one read here.
-fn effect(f: &Filter) -> Option<Effect> {
- let param = |k: &str| f.params.get(k).copied().filter(|v| v.is_finite());
- let flag = |k: &str| param(k).is_some_and(|v| v != 0.0);
- let mode = |default: usize| super::read::blend_name(param("blnd").map_or(default, |v| v.max(0.0) as usize));
- let color = f.fill.as_ref().and_then(Paint::color).unwrap_or(vectorcraft_color::Color::BLACK);
- let (id, params) = match f.name.as_str() {
- // `blur`'s scale isn't publicly documented: read as the Gaussian's σ, an effect's blur being 2σ.
- GLOW => (
- "stylize.outerGlow",
- json!({"mode": mode(2), "opacity": param("opac").unwrap_or(0.75) * 100.0, "blur": 2.0 * param("blur").unwrap_or(5.0), "color": color}),
- ),
- // LiveEffect XML uses `radius`; art styles abbreviate it `rad` (public scripting posts on applyEffect).
- FEATHER => ("stylize.feather", json!({"radius": param("rad").or_else(|| param("radius")).unwrap_or(5.0)})),
- SHADOW => {
+/// A Stylize effect's dictionary, read only as it is written: each setting a key of the kind it
+/// names, with a finite value in the effect's range.
+struct Settings<'a>(&'a Filter);
+
+impl Settings<'_> {
+ /// Every key is one of `known`, or one of `fixed` holding the value it names.
+ /// The choices (`blnd`, `csrc`, `gtyp`) are written as `/Int`, the colors as fill styles and
+ /// the other settings as `/Real`.
+ fn only(&self, known: &[&str], fixed: &[(&str, Kind, f64)]) -> bool {
+ let f = self.0;
+ let kind_of = |key: &str| match key {
+ "blnd" | "csrc" | "gtyp" => Kind::Int,
+ "sclr" | "gclr" => Kind::Fill,
+ _ => Kind::Real,
+ };
+ f.arrays.is_empty()
+ && f.kinds.iter().all(|(key, kind)| {
+ (known.contains(&key.as_str()) && kind_of(key) == *kind)
+ || fixed.iter().any(|(k, want, v)| k == key && want == kind && f.params.get(key.as_str()) == Some(v))
+ })
+ }
+
+ fn real(&self, key: &str, range: std::ops::RangeInclusive<f64>) -> Option<f64> {
+ (self.0.kinds.get(key) == Some(&Kind::Real)).then_some(())?;
+ self.0.params.get(key).copied().filter(|v| v.is_finite() && range.contains(v))
+ }
+
+ /// A choice numbered from 0 to `max`.
+ fn choice(&self, key: &str, max: u8) -> Option<usize> {
+ (self.0.kinds.get(key) == Some(&Kind::Int)).then_some(())?;
+ let v = self.0.params.get(key).copied().filter(|v| v.is_finite() && v.fract() == 0.0 && (0.0..=f64::from(max)).contains(v))?;
+ Some(v as usize)
+ }
+
+ /// The blend mode in `blnd`, numbered as transparency's (`Xy`).
+ fn mode(&self) -> Option<String> {
+ Some(super::read::blend_name(self.choice("blnd", 15)?))
+ }
+
+ /// The color of the fill style written as `key`: a solid color, in Normal at full opacity.
+ fn color(&self, key: &str) -> Option<vectorcraft_color::Color> {
+ let f = self.0;
+ let normal = f.xy.is_none_or(|(mode, opacity)| mode == 0 && opacity >= 1.0);
+ (f.kinds.get(key) == Some(&Kind::Fill) && !f.gradient && f.pattern.is_none() && normal).then_some(())?;
+ f.fill.as_ref()?.color()
+ }
+}
+
+/// Drop Shadow, Inner Glow, Outer Glow, Feather, Round Corners and Scribble (`None`: another
+/// filter). `Some(None)` is one whose settings aren't all read: an unknown key, a key of another
+/// kind, a value out of range or a missing setting keeps the drawn look. The keys are LiveEffect
+/// XML's
+/// (https://community.adobe.com/questions-652/pageitem-applyeffect-liveeffectxml-769450).
+fn stylize(f: &Filter) -> Option<Option<(&'static str, serde_json::Value)>> {
+ let s = Settings(f);
+ let opacity = || Some(s.real("opac", 0.0..=1.0)? * 100.0);
+ Some(match f.name.as_str() {
+ // `horz` and `vert` are the X and Y Offset, right and down
+ // (https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/create-drop-shadows.html);
+ // `csrc` 0 is Color (`sclr`), 1 Darkness (`dark`, a percent). `blur` is half the catalog's.
+ SHADOW => (|| {
+ let fixed = [("pair", Kind::Bool, 1.0), ("usePSLBlur", Kind::Bool, 1.0), (EXPAND_VERSION, Kind::Int, 16.0)];
+ s.only(&["blnd", "opac", "horz", "vert", "blur", "csrc", "dark", "sclr"], &fixed).then_some(())?;
let mut params = json!({
- "mode": mode(1),
- "opacity": param("opac").unwrap_or(0.75) * 100.0,
- "blur": 2.0 * param("blur").unwrap_or(5.0),
- // Undocumented; read as the dialog's offsets, not flipped like art-space y: its default 7/7 pt is
- // right and down (https://helpx.adobe.com/illustrator/using/drop-shadows-glows-feathering.html).
- "x": param("horz").unwrap_or(7.0),
- "y": param("vert").unwrap_or(7.0),
- "color": color,
+ "mode": s.mode()?,
+ "opacity": opacity()?,
+ "blur": 2.0 * s.real("blur", 0.0..=500.0)?,
+ "x": s.real("horz", -1e4..=1e4)?,
+ "y": s.real("vert", -1e4..=1e4)?,
});
- // A `csrc` of 1 is Darkness, the object's own colors with black added; any value other than 0 is read as
- // Darkness. `dark` is the percent of black (0 to 100, where `opac` is a fraction), and 100 when it is missing or not finite.
- if param("csrc").unwrap_or(0.0) != 0.0 {
+ if s.choice("csrc", 1)? == 0 {
+ params["color"] = json!(s.color("sclr")?);
+ } else {
params["shade"] = json!("darkness");
- params["darkness"] = json!(param("dark").map_or(100.0, |v| v.clamp(0.0, 100.0)));
+ params["darkness"] = json!(s.real("dark", 0.0..=100.0)?);
+ if let Some(c) = s.color("sclr") {
+ params["color"] = json!(c);
+ }
}
- ("stylize.dropShadow", params)
+ Some(("stylize.dropShadow", params))
+ })(),
+ // `gtyp` 0 is Center, 1 Edge (https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/create-an-inner-or-outer-glow.html);
+ // `blur` is the catalog's.
+ INNER_GLOW => (|| {
+ s.only(&["blnd", "opac", "blur", "gtyp", "gclr"], &[]).then_some(())?;
+ let source = if s.choice("gtyp", 1)? == 0 { "center" } else { "edge" };
+ let params = json!({
+ "mode": s.mode()?,
+ "opacity": opacity()?,
+ "blur": s.real("blur", 0.0..=1000.0)?,
+ "color": s.color("gclr")?,
+ "source": source,
+ });
+ Some(("stylize.innerGlow", params))
+ })(),
+ // `blur` is half the catalog's.
+ GLOW => (|| {
+ s.only(&["blnd", "opac", "blur", "sclr"], &[("usePSLBlur", Kind::Bool, 1.0), (EXPAND_VERSION, Kind::Int, 16.0)]).then_some(())?;
+ let params = json!({"mode": s.mode()?, "opacity": opacity()?, "blur": 2.0 * s.real("blur", 0.0..=500.0)?, "color": s.color("sclr")?});
+ Some(("stylize.outerGlow", params))
+ })(),
+ // https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/feather-object-edges.html
+ FEATHER => s.only(&["Radius"], &[]).then(|| s.real("Radius", 0.0..=1000.0)).flatten().map(|r| ("stylize.feather", json!({"radius": r}))),
+ ROUND_CORNERS => {
+ s.only(&["radius"], &[]).then(|| s.real("radius", 0.0..=1e4)).flatten().map(|r| ("stylize.roundCorners", json!({"radius": r})))
}
+ // `Angle` in degrees; widths, spacings and overlaps in points; `Scribbliness` (Curviness)
+ // and `ScribbleVariation` as fractions. The catalog's Scribble has no color, so a Scribble
+ // with `sclr` keeps the drawn look.
+ SCRIBBLE => (|| {
+ let keys =
+ ["Angle", "EdgeOverlap", "EdgeOverlapVariation", "StrokeWidth", "Scribbliness", "ScribbleVariation", "Spacing", "SpacingVariation"];
+ s.only(&keys, &[]).then_some(())?;
+ let params = json!({
+ "angle": s.real("Angle", -360.0..=360.0)?,
+ "overlap": s.real("EdgeOverlap", -1000.0..=1000.0)?,
+ "overlapVariation": s.real("EdgeOverlapVariation", 0.0..=100.0)?,
+ "strokeWidth": s.real("StrokeWidth", 0.01..=1000.0)?,
+ "curviness": s.real("Scribbliness", 0.0..=1.0)? * 100.0,
+ "curvinessVariation": s.real("ScribbleVariation", 0.0..=1.0)? * 100.0,
+ "spacing": s.real("Spacing", 0.1..=1000.0)?,
+ "spacingVariation": s.real("SpacingVariation", 0.0..=100.0)?,
+ });
+ Some(("stylize.scribble", params))
+ })(),
+ _ => return None,
+ })
+}
+
+/// The live effect filter `f` is, when it is one read here.
+fn effect(f: &Filter) -> Option<Effect> {
+ if let Some(stylized) = stylize(f) {
+ let (id, params) = stylized?;
+ return Some(Effect { id: id.into(), params, visible: f.visible });
+ }
+ let param = |k: &str| f.params.get(k).copied().filter(|v| v.is_finite());
+ let flag = |k: &str| param(k).is_some_and(|v| v != 0.0);
+ let (id, params) = match f.name.as_str() {
// Effect › Warp: `DeformStyle` numbers the styles from 1 as the dialog lists them, `Rotate`
// is Vertical, and the bend and distortions are fractions.
DEFORM => {
@@ -657,7 +814,12 @@ fn style(filters: &[Filter]) -> ArtStyle {
&& count(false) <= 1
&& st.items.iter().all(|i| matches!(i, StyleItem::Fill(_) | StyleItem::Stroke { .. } | StyleItem::Gradient { .. }))
&& st.looks.iter().all(|l| l.visible && l.opacity >= 1.0 && l.blend == BlendMode::Normal && l.effects.is_empty())
- && st.effects.iter().all(|e| matches!(e.id.as_str(), "stylize.outerGlow" | "stylize.feather" | "stylize.dropShadow"));
+ && st.effects.iter().all(|e| {
+ matches!(
+ e.id.as_str(),
+ "stylize.dropShadow" | "stylize.innerGlow" | "stylize.outerGlow" | "stylize.feather" | "stylize.roundCorners" | "stylize.scribble"
+ )
+ });
st
}
diff --git a/crates/eps/src/import/ai/style/tests.rs b/crates/eps/src/import/ai/style/tests.rs
index 964b74f10..9ba5838f3 100644
--- a/crates/eps/src/import/ai/style/tests.rs
+++ b/crates/eps/src/import/ai/style/tests.rs
@@ -26,94 +26,236 @@ fn dashes_aligned_to_corners_keep_the_drawn_look() {
assert!(!art_styles(data)["Stitches"].plain);
}
-#[test]
-fn a_drop_shadow_offset_down_points_down() {
- // GUARDS: the document has y down; flipping `vert` like an art-space y would turn the dialog's
- // default shadow (7 pt right, 7 pt down) upwards.
- let data = b"/KnownStyle :\n(Shade) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
- /BasicFilter :\n(Adobe Drop Shadow) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n7 /Real (horz) ,\n7 /Real (vert) ,\n; /Dict ;\n /Part ,\n;\n";
- let styles = art_styles(data);
- let [shadow] = styles["Shade"].effects.as_slice() else { panic!("{:?}", styles["Shade"]) };
- assert_eq!((shadow.params["x"].as_f64(), shadow.params["y"].as_f64()), (Some(7.0), Some(7.0)));
-}
-
/// The style `Shade`: a Drop Shadow whose dictionary holds `keys`.
fn shadow_style(keys: &str) -> ArtStyle {
+ effect_style("Adobe Drop Shadow", keys)
+}
+
+/// The style `Fx`: an effect `name` on the whole object, its dictionary holding `keys`.
+fn effect_style(name: &str, keys: &str) -> ArtStyle {
let data = format!(
- "/KnownStyle :\n(Shade) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
- /BasicFilter :\n(Adobe Drop Shadow) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n{keys}; /Dict ;\n /Part ,\n;\n"
+ "/KnownStyle :\n(Fx) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
+ /BasicFilter :\n({name}) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n{keys}; /Dict ;\n /Part ,\n;\n"
);
- art_styles(data.as_bytes()).remove("Shade").unwrap_or_default()
+ art_styles(data.as_bytes()).remove("Fx").unwrap_or_default()
}
-#[test]
-fn a_drop_shadow_with_darkness_reads_its_darkness() {
- // GUARDS: a `csrc` other than 0 made the style not plain, and the object came in as its drawn look.
- let style = shadow_style("1 /Int (blnd) ,\n0.75 /Real (opac) ,\n5 /Real (blur) ,\n1 /Int (csrc) ,\n50 /Real (dark) ,\n");
+/// A colour entry `key`: a fill style in RGB `r g b`.
+fn color_entry(key: &str, rgb: &str) -> String {
+ format!("/FillStyle : 0 O\n0 0 0 0 {rgb} Xa\n0 1 0 0 0 Xy\n0 J 0 j 1 w 10 M []0 d\n0 XR\n0 1 Xd\n/Def ;\n ({key}) ,\n")
+}
+
+/// A Drop Shadow's dictionary: every setting, with Color or Darkness set by `shade`.
+fn shadow_keys(shade: &str) -> String {
+ format!(
+ "2 /Int (blnd) ,\n0.43 /Real (opac) ,\n37 /Real (dark) ,\n-13 /Real (vert) ,\n11 /Real (horz) ,\n17 /Real (blur) ,\n{}{shade}",
+ color_entry("sclr", "0 1 0")
+ )
+}
+
+/// `style`'s one effect on the whole object.
+fn only_effect(style: &ArtStyle) -> &Effect {
assert!(style.plain, "{style:?}");
- let [shadow] = style.effects.as_slice() else { panic!("{style:?}") };
+ let [e] = style.effects.as_slice() else { panic!("{style:?}") };
+ e
+}
+
+/// `params[key]`, a number within rounding of `want`.
+fn near(params: &serde_json::Value, key: &str, want: f64) {
+ let got = params[key].as_f64();
+ assert!(got.is_some_and(|v| (v - want).abs() < 1e-9), "{key}: {got:?}, not {want}: {params}");
+}
+
+#[test]
+fn a_drop_shadow_reads_its_settings() {
+ // GUARDS: `vert` read as an art-space y would flip a shadow offset down to up.
+ let style = shadow_style(&shadow_keys("0 /Int (csrc) ,\n"));
+ let shadow = only_effect(&style);
let p = &shadow.params;
assert_eq!(
- (shadow.id.as_str(), &p["shade"], &p["darkness"], &p["opacity"], &p["blur"]),
- ("stylize.dropShadow", &json!("darkness"), &json!(50.0), &json!(75.0), &json!(10.0))
+ (shadow.id.as_str(), &p["mode"], &p["color"]),
+ ("stylize.dropShadow", &json!("Screen"), &json!(vectorcraft_color::Color::rgb(0.0, 1.0, 0.0)))
+ );
+ for (key, want) in [("x", 11.0), ("y", -13.0), ("blur", 34.0), ("opacity", 43.0)] {
+ near(p, key, want);
+ }
+ assert_eq!((p.get("shade"), p.get("darkness")), (None, None));
+}
+
+#[test]
+fn a_drop_shadow_with_darkness_reads_its_darkness() {
+ let shadow = only_effect(&shadow_style(&shadow_keys("1 /Int (csrc) ,\n"))).clone();
+ assert_eq!((&shadow.params["shade"], &shadow.params["darkness"]), (&json!("darkness"), &json!(37.0)));
+}
+
+#[test]
+fn a_drop_shadow_with_settings_not_read_keeps_the_drawn_look() {
+ // GUARDS: an unknown `csrc` was read as Darkness, `blnd` was cast to a mode, a missing setting
+ // took a default and an unknown key was skipped: each became an editable shadow the file doesn't draw.
+ let full = shadow_keys("0 /Int (csrc) ,\n");
+ let cases = [
+ full.replace("0 /Int (csrc)", "99 /Int (csrc)"),
+ full.replace("2 /Int (blnd)", "99 /Int (blnd)"),
+ full.replace("2 /Int (blnd)", "2.5 /Int (blnd)"),
+ full.replace("0 /Int (csrc)", "0.5 /Int (csrc)"),
+ full.replace("11 /Real (horz)", "11 /Int (horz)"),
+ full.replace("37 /Real (dark)", "37 /Int (dark)"),
+ full.replace("2 /Int (blnd)", "2 /Real (blnd)"),
+ full.replace("0.43 /Real (opac)", "1.5 /Real (opac)"),
+ full.replace("11 /Real (horz) ,\n", ""),
+ full.replace(&color_entry("sclr", "0 1 0"), ""),
+ full.replace("0 1 0 0 0 Xy", "2 0.5 0 0 0 Xy"),
+ format!("{full}1 /Real (spread) ,\n"),
+ format!("{full}0 /Bool (pair) ,\n"),
+ format!("{full}(x) /String (note) ,\n"),
+ format!("{full}3 4 /RealPointRelToROrigin (spot) ,\n"),
+ shadow_keys("1 /Int (csrc) ,\n").replace("37 /Real (dark)", "250 /Real (dark)"),
+ shadow_keys("1 /Int (csrc) ,\n").replace("37 /Real (dark)", "(fifty) /Real (dark)"),
+ ];
+ for keys in cases {
+ assert!(!shadow_style(&keys).plain, "{keys}");
+ }
+ let observed = format!("{full}1 /Bool (pair) ,\n1 /Bool (usePSLBlur) ,\n16 /Int (Adobe Effect Expand Before Version) ,\n");
+ assert!(shadow_style(&observed).plain);
+}
+
+#[test]
+fn an_inner_glow_reads_its_settings() {
+ let keys =
+ |gtyp: &str| format!("10 /Int (blnd) ,\n0.41 /Real (opac) ,\n13 /Real (blur) ,\n{}{gtyp} /Int (gtyp) ,\n", color_entry("gclr", "1 0 0"));
+ let style = effect_style("Adobe Inner Glow", &keys("0"));
+ let glow = only_effect(&style);
+ let p = &glow.params;
+ assert_eq!(
+ (glow.id.as_str(), &p["mode"], &p["source"], &p["color"]),
+ ("stylize.innerGlow", &json!("Difference"), &json!("center"), &json!(vectorcraft_color::Color::rgb(1.0, 0.0, 0.0)))
);
+ near(p, "opacity", 41.0);
+ near(p, "blur", 13.0);
+ assert!(style.simple);
+ assert_eq!(only_effect(&effect_style("Adobe Inner Glow", &keys("1"))).params["source"], json!("edge"));
+ assert!(!effect_style("Adobe Inner Glow", &keys("2")).plain);
}
#[test]
-fn a_drop_shadow_darkness_is_100_percent_when_missing_and_kept_within_0_to_100() {
- for (dark, want) in [("", 100.0), ("(fifty) /Real (dark) ,\n", 100.0), ("250 /Real (dark) ,\n", 100.0), ("-5 /Real (dark) ,\n", 0.0)] {
- let style = shadow_style(&format!("1 /Int (csrc) ,\n{dark}"));
- assert!(style.plain, "{dark:?}: {style:?}");
- let [shadow] = style.effects.as_slice() else { panic!("{dark:?}: {style:?}") };
- assert_eq!((&shadow.params["shade"], &shadow.params["darkness"]), (&json!("darkness"), &json!(want)), "{dark:?}");
+fn an_outer_glow_reads_its_settings_and_keeps_the_drawn_look_for_others() {
+ let keys = format!(
+ "16 /Int (Adobe Effect Expand Before Version) ,\n10 /Int (blnd) ,\n0.42 /Real (opac) ,\n19 /Real (blur) ,\n{}1 /Bool (usePSLBlur) ,\n",
+ color_entry("sclr", "0 0 1")
+ );
+ let glow = only_effect(&effect_style("Adobe Outer Glow", &keys)).clone();
+ assert_eq!((glow.id.as_str(), &glow.params["mode"]), ("stylize.outerGlow", &json!("Difference")));
+ near(&glow.params, "opacity", 42.0);
+ near(&glow.params, "blur", 38.0);
+ for other in [
+ format!("{keys}1 /Real (spread) ,\n"),
+ keys.replace("19 /Real (blur)", "19 /Int (blur)"),
+ keys.replace("1 /Bool (usePSLBlur)", "0 /Bool (usePSLBlur)"),
+ ] {
+ assert!(!effect_style("Adobe Outer Glow", &other).plain, "{other}");
}
}
#[test]
-fn a_drop_shadow_with_color_keeps_its_params() {
- // GUARDS: a `csrc` of 0, or none, is Color; its shadow has neither `shade` nor `darkness`.
- for csrc in ["", "0 /Int (csrc) ,\n50 /Real (dark) ,\n"] {
- let style = shadow_style(&format!("2 /Int (blnd) ,\n0.5 /Real (opac) ,\n{csrc}"));
- assert!(style.plain, "{csrc:?}: {style:?}");
- let [shadow] = style.effects.as_slice() else { panic!("{csrc:?}: {style:?}") };
- let want = json!({"mode": "Screen", "opacity": 50.0, "blur": 10.0, "x": 7.0, "y": 7.0, "color": vectorcraft_color::Color::BLACK});
- assert_eq!(shadow.params, want, "{csrc:?}");
+fn a_feather_reads_its_radius() {
+ // GUARDS: Feather was looked for under another name and key, so the files' Feather kept the drawn look.
+ let style = effect_style("Adobe Fuzzy Mask", "14 /Real (Radius) ,\n");
+ let feather = only_effect(&style);
+ assert_eq!((feather.id.as_str(), feather.params["radius"].as_f64()), ("stylize.feather", Some(14.0)));
+ assert!(style.simple);
+ for other in ["14 /Real (radius) ,\n", "", "-1 /Real (Radius) ,\n"] {
+ assert!(!effect_style("Adobe Fuzzy Mask", other).plain, "{other}");
}
}
#[test]
-fn a_feather_reads_its_radius_from_rad() {
- let data = b"/KnownStyle :\n(Soft) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
- /BasicFilter :\n(Adobe Feather) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n12 /Real (rad) ,\n; /Dict ;\n /Part ,\n;\n";
- let styles = art_styles(data);
- let [feather] = styles["Soft"].effects.as_slice() else { panic!() };
- assert_eq!((feather.id.as_str(), feather.params["radius"].as_f64()), ("stylize.feather", Some(12.0)));
+fn round_corners_read_their_radius() {
+ let style = effect_style("Adobe Round Corners", "21 /Real (radius) ,\n");
+ let round = only_effect(&style);
+ assert_eq!((round.id.as_str(), round.params["radius"].as_f64()), ("stylize.roundCorners", Some(21.0)));
+ assert!(style.simple);
+ for other in ["21 /Real (Radius) ,\n", "21 /Int (radius) ,\n", "-1 /Real (radius) ,\n"] {
+ assert!(!effect_style("Adobe Round Corners", other).plain, "{other}");
+ }
}
+/// A Scribble's dictionary with every setting.
+const SCRIBBLE_KEYS: &str = "0.8 /Real (SpacingVariation) ,\n0.23 /Real (ScribbleVariation) ,\n4 /Real (EdgeOverlapVariation) ,\n67 /Real (Angle) ,\n\
+ 2.3 /Real (StrokeWidth) ,\n-7 /Real (EdgeOverlap) ,\n0.17 /Real (Scribbliness) ,\n13 /Real (Spacing) ,\n";
+
#[test]
-fn a_feather_falls_back_to_radius_and_defaults_to_five_points() {
- let with_name = b"/KnownStyle :\n(Soft) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
- /BasicFilter :\n(Adobe Feather) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n3 /Real (radius) ,\n; /Dict ;\n /Part ,\n;\n";
- let styles = art_styles(with_name);
- let [feather] = styles["Soft"].effects.as_slice() else { panic!() };
- assert_eq!(feather.params["radius"].as_f64(), Some(3.0));
+fn a_scribble_reads_its_settings() {
+ let style = effect_style("Adobe Scribble Fill", SCRIBBLE_KEYS);
+ let scribble = only_effect(&style);
+ assert_eq!(scribble.id, "stylize.scribble");
+ let want = [
+ ("angle", 67.0),
+ ("overlap", -7.0),
+ ("overlapVariation", 4.0),
+ ("strokeWidth", 2.3),
+ ("curviness", 17.0),
+ ("curvinessVariation", 23.0),
+ ("spacing", 13.0),
+ ("spacingVariation", 0.8),
+ ];
+ for (key, v) in want {
+ near(&scribble.params, key, v);
+ }
+ assert!(style.simple);
+}
- let bare = b"/KnownStyle :\n(Soft) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
- /BasicFilter :\n(Adobe Feather) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n; /Dict ;\n /Part ,\n;\n";
- let styles = art_styles(bare);
- let [feather] = styles["Soft"].effects.as_slice() else { panic!() };
- assert_eq!(feather.params["radius"].as_f64(), Some(5.0));
+#[test]
+fn a_scribble_with_a_colour_or_settings_not_read_keeps_the_drawn_look() {
+ let cases = [
+ format!("{SCRIBBLE_KEYS}{}", color_entry("sclr", "0 1 0")),
+ format!("{SCRIBBLE_KEYS}0.5 /Real (MinDensity) ,\n"),
+ SCRIBBLE_KEYS.replace("13 /Real (Spacing) ,\n", ""),
+ SCRIBBLE_KEYS.replace("0.17 /Real (Scribbliness)", "17 /Real (Scribbliness)"),
+ ];
+ for keys in cases {
+ assert!(!effect_style("Adobe Scribble Fill", &keys).plain, "{keys}");
+ }
+}
+
+#[test]
+fn effects_on_the_object_keep_their_order() {
+ let data = format!(
+ "/KnownStyle :\n(Two) /Name ,\n/ActiveStyle :\n{}",
+ compound(
+ "Chain Style Filter",
+ &[basic("Adobe Round Corners", "10 /Real (radius) ,\n"), basic("Adobe Drop Shadow", &shadow_keys("0 /Int (csrc) ,\n"))]
+ )
+ );
+ let st = &art_styles(data.as_bytes())["Two"];
+ assert!(st.plain && st.simple, "{st:?}");
+ assert_eq!(st.effects.iter().map(|e| e.id.as_str()).collect::<Vec<_>>(), ["stylize.roundCorners", "stylize.dropShadow"]);
+}
+
+#[test]
+fn a_glow_on_one_fill_stays_on_that_fill() {
+ // An ordinary object keeps the drawn look (`simple` is false); type takes the fill's glow.
+ let glow = basic(
+ "Adobe Inner Glow",
+ &format!("2 /Int (blnd) ,\n0.75 /Real (opac) ,\n5 /Real (blur) ,\n{}1 /Int (gtyp) ,\n", color_entry("gclr", "1 1 1")),
+ );
+ let item = compound("Chain Style Filter", &[fill("0 0 0 1 0 0 0 Xa"), glow]);
+ let data =
+ format!("/KnownStyle :\n(Lit) /Name ,\n/ActiveStyle :\n{}", compound("Chain Style Filter", &[compound("Stack Style Filter", &[item])]));
+ let st = &art_styles(data.as_bytes())["Lit"];
+ assert!(st.plain && !st.simple, "{st:?}");
+ assert!(st.effects.is_empty());
+ assert_eq!(st.looks[0].effects.iter().map(|e| e.id.as_str()).collect::<Vec<_>>(), ["stylize.innerGlow"]);
}
#[test]
fn art_styles_clear_operands_beyond_the_cap() {
let mut data = Vec::from(
- b"/KnownStyle :\n(Soft) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n/BasicFilter :\n(Adobe Feather) 1 0 /Filter ,\n1 /Visible ,\n",
+ b"/KnownStyle :\n(Soft) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n/BasicFilter :\n(Adobe Fuzzy Mask) 1 0 /Filter ,\n1 /Visible ,\n",
);
for _ in 0..80 {
data.extend_from_slice(b"1 ");
}
- data.extend_from_slice(b"/Dictionary : /NotRecorded ,\n; /Dict ;\n /Part ,\n;\n");
+ data.extend_from_slice(b"/Dictionary : /NotRecorded ,\n5 /Real (Radius) ,\n; /Dict ;\n /Part ,\n;\n");
let styles = art_styles(&data);
let [feather] = styles["Soft"].effects.as_slice() else { panic!() };
assert_eq!(feather.params["radius"].as_f64(), Some(5.0));
@@ -121,7 +263,8 @@ fn art_styles_clear_operands_beyond_the_cap() {
#[test]
fn art_styles_ignore_filters_beyond_the_cap() {
- const UNIT: &[u8] = b"/BasicFilter :\n(Adobe Feather) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n; /Dict ;\n /Part ,\n";
+ const UNIT: &[u8] =
+ b"/BasicFilter :\n(Adobe Fuzzy Mask) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n1 /Real (Radius) ,\n; /Dict ;\n /Part ,\n";
let mut data =
Vec::from(b"/KnownStyle :\n(Capped) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n");
for _ in 0..MAX_FILTERS + 16 {
@@ -309,7 +452,7 @@ fn contents_above_some_items_count_them() {
#[test]
fn an_effect_not_read_here_keeps_the_drawn_look() {
- let item = compound("Chain Style Filter", &[fill("0 0 0 1 0 0 0 Xa"), basic("Adobe Scribble Fill", "")]);
+ let item = compound("Chain Style Filter", &[fill("0 0 0 1 0 0 0 Xa"), basic("Adobe Zig Zag", "")]);
let data =
format!("/KnownStyle :\n(Odd) /Name ,\n/ActiveStyle :\n{}", compound("Chain Style Filter", &[compound("Stack Style Filter", &[item])]));
assert!(!art_styles(data.as_bytes())["Odd"].plain);
diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs
index 96d0ba941..05f33e6a3 100644
--- a/crates/eps/src/import/ai/tests.rs
+++ b/crates/eps/src/import/ai/tests.rs
@@ -2080,12 +2080,14 @@ const ART_STYLES: &str = "%AI9_BeginArtStyles\n\
/CompoundFilter :\n(Stack Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
/BasicFilter :\n(Fill Style Filter) 0 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n/FillStyle : 0 O\n0 0 0 0 0 0 1 Xa\n0 1 Xd\n/Def ;\n (FillStyle) ,\n; /Dict ;\n /Part ,\n\
/BasicFilter :\n(Conduit Filter) 0 0 /Filter ,\n1 /Visible ,\n;\n /Part ,\n;\n /Part ,\n\
- /BasicFilter :\n(Adobe Drop Shadow) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n3 /Real (horz) ,\n4 /Real (vert) ,\n; /Dict ;\n /Part ,\n;\n\
+ /BasicFilter :\n(Adobe Drop Shadow) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n1 /Int (blnd) ,\n0.75 /Real (opac) ,\n5 /Real (blur) ,\n\
+ 0 /Int (csrc) ,\n/FillStyle : 0 O\n0 0 0 1 0 0 0 Xa\n0 1 Xd\n/Def ;\n (sclr) ,\n3 /Real (horz) ,\n4 /Real (vert) ,\n; /Dict ;\n /Part ,\n;\n\
/KnownStyle :\n(Lit) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
/CompoundFilter :\n(Stack Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
/BasicFilter :\n(Fill Style Filter) 0 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n/FillStyle : 0 O\n1 (G) 0 0 0 1 1 0 0 1 0 0 Bg\n0 1 Xd\n/Def ;\n (FillStyle) ,\n; /Dict ;\n /Part ,\n\
/BasicFilter :\n(Conduit Filter) 0 0 /Filter ,\n1 /Visible ,\n;\n /Part ,\n;\n /Part ,\n\
- /BasicFilter :\n(Adobe Outer Glow) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n0.5 /Real (opac) ,\n2 /Real (blur) ,\n; /Dict ;\n /Part ,\n;\n\
+ /BasicFilter :\n(Adobe Outer Glow) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n2 /Int (blnd) ,\n0.5 /Real (opac) ,\n2 /Real (blur) ,\n\
+ /FillStyle : 0 O\n0 0 0 0 1 1 0 Xa\n0 1 Xd\n/Def ;\n (sclr) ,\n; /Dict ;\n /Part ,\n;\n\
%AI9_EndArtStyles\n";
#[test]
@@ -2114,7 +2116,7 @@ fn an_object_with_a_feather_style_comes_in_with_a_live_effect() {
/CompoundFilter :\n(Stack Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
/BasicFilter :\n(Fill Style Filter) 0 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n/FillStyle : 0 O\n0 0 0 0 0 0 1 Xa\n0 1 Xd\n/Def ;\n (FillStyle) ,\n; /Dict ;\n /Part ,\n\
/BasicFilter :\n(Conduit Filter) 0 0 /Filter ,\n1 /Visible ,\n;\n /Part ,\n;\n /Part ,\n\
- /BasicFilter :\n(Adobe Feather) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n8 /Real (rad) ,\n; /Dict ;\n /Part ,\n;\n\
+ /BasicFilter :\n(Adobe Fuzzy Mask) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n8 /Real (Radius) ,\n; /Dict ;\n /Part ,\n;\n\
%AI9_EndArtStyles\n";
let hidden_rect = rect_path(0.0, 0.0, 10.0, 10.0).replace('\n', "\n%_");
let art_ = format!("0 Ae\nu\n{RED}{}f\nU\n%_Bb\n%_{hidden_rect}f\n%_0 BB\n1 (Soft) XW\n", rect_path(0.0, 0.0, 10.0, 10.0));
@@ -2156,7 +2158,7 @@ fn a_styled_object_inside_a_drawn_look_survives_it() {
/// that shadow, not as its drawn look.
#[test]
fn an_object_with_a_darkness_shadow_comes_in_as_itself() {
- let styles = ART_STYLES.replace("3 /Real (horz) ,\n", "1 /Int (csrc) ,\n50 /Real (dark) ,\n3 /Real (horz) ,\n");
+ let styles = ART_STYLES.replace("0 /Int (csrc) ,\n", "1 /Int (csrc) ,\n50 /Real (dark) ,\n");
let hidden_rect = rect_path(0.0, 0.0, 10.0, 10.0).replace('\n', "\n%_");
let art_ = format!("0 Ae\nu\n{RED}{}f\nU\n%_{hidden_rect}f\n1 (Blue) XW\n", rect_path(0.0, 0.0, 10.0, 10.0));
let r = read_ok(&format!("{styles}{}", layer(&art_)));
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index 98260d60a..2c7fc0109 100644
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@ -79,6 +79,9 @@ private editing data. VectorCraft:
opens a file with that prolog from its program, as the format.
- **Known failures in users' files:** layer structure flattened or multiplied (#951: 109 layers instead of
14; #868: round trip with Illustrator 2018 loses layers and groups), guides and non-printing construction
+ lines lost (#779), some files 4× slower to open since the editing data is read whole (#758), live effects
+ that are not read or have settings that are not read, brushes and symbols come in as their drawn look (#637; pattern fills are read since #1025); legacy `.ai`
+ without the prolog opens since #1027, its legacy type (`To` … `TO`) since #868.
lines lost (#779), some files 4× slower to open since the editing data is read whole (#758), live effects,
brushes and symbols come in as their drawn look (#637; pattern fills are read since #1025); legacy `.ai`
without the prolog opens since #1027, its legacy type (`To` … `TO`) since #868, with its paragraphs' letter
@@ -89,6 +92,7 @@ private editing data. VectorCraft:
### Illustrator's private editing data
+the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPrivateData` streams, a PDF's `AIPDFPrivateData` streams when it was saved with the editing data (#868), Zstandard or zlib, the EPS's in ASCII85) is not documented as a whole. VectorCraft reads its structure: layers and sublayers (names, order, visibility, lock, printing, preview, dimming, colour), groups as they were nested, compound paths (painted by their last path, or the last painted one, with the paths of groups inside them kept as their paths: #1410), clipping groups and layer clipping, object names, hidden and locked objects, fills and strokes (grey, CMYK, RGB, named and spot colours, spot colours defined in Lab with their Lab values (#1032), global process colours as global swatches at their tint), linear and radial gradients, pattern fills with their patterns as pattern swatches (#1025), opacity, blend modes, isolation and knockout, embedded images where their matrix puts them, rotated ones too (#2269), with their alpha channel (CMYK images keep their ink amounts, as they do when a `.ai` opens from its PDF part, and an alpha channel that hides part of a CMYK image becomes a grayscale opacity mask), placed (linked) files as linked images in their place, each showing the low-resolution preview the file keeps of it until its file is found or relinked in the Links panel (#1264), guides, and every artboard where it is. Objects on Path groups open live, with their path, their objects in order along it, Pivot and Rotate; one with a dragged spacing or other options opens as a plain group. A gradient with stops in the middle runs its whole ramp across its shape, and a gradient object does not pass its fill to the next path (#1390). An object whose art style is one fill and one stroke at most (solid colours, its own gradient, a variable-width profile) with Drop Shadow, Inner Glow, Outer Glow, Feather, Round Corners or Scribble comes in as itself with them and their saved settings; one with more, other effects, an effect setting that is not read (an unknown key, a missing or out-of-range value, a Scribble with a color of its own), a brush or dashes aligned to corners comes in as its drawn look (a group named after it). Type keeps its art style as a live appearance whatever its stack, so it can be retyped: each fill and stroke of the style's stack (solid colours, gradients and pattern fills, placed as the drawn look places them) with its own opacity, blend mode and effects, the effects on the whole object, and where the characters paint among them; the effects read are Warp, Offset Path, Transform (with copies), Drop Shadow, Inner Glow, Outer Glow, Feather, Round Corners, Scribble, Gaussian Blur and Bas Relief (its settings at their defaults), and a style with others keeps the type's drawn look. The page's drawing of such a style isn't held to look like VectorCraft's where its drawn look lay. Gradients take their matrix (`Xm`, radials and skewed ones too), focal point and the order of stops sharing a ramp point; gradient meshes, a clipping path's own fill and the artboards' names are read too. `editingData: "always"` (`convert --editing-data`) opens a `.ai` or an Illustrator EPS from its editing data even where it draws differently from its page, which can be older, with a note. Type is made from the file's text document, whole and editable, shown or not: point type (its frame's matrix, which newer files leave out when it is neither turned nor scaled, read as none), area type (a story in several frames as threaded type) and type on a path, with its characters, fonts, size, leading, tracking, scaling, baseline shift, fill and stroke (grey, RGB or CMYK), alignment, indents and paragraph spacing (a character attribute a run doesn't set comes from its character style, then the style that one is based on, then the document's defaults); the page's drawing of it (often in pieces) is left out. When it makes the type of every text object that shows, the page's type is only compared with it, each text object keeps its own group, frame and layer, and a line break inside a paragraph stays one. Where it can't make a text object's type (a frame of another kind), that text object takes the page's type where the text document puts its lines, or else what is left of the page's type in painting order (no group around it); the page's type where made type draws stays that type's, and hidden type is left out with a note. Kerning, underline and the other character and paragraph options aren't read yet. A `.ai` saved without PDF compatibility (a placeholder page) opens from its editing data alone, its point type, area type and type on a path made from the text document. A `.ai` whose PDF part shows only text isn't taken for that placeholder when its page states an art, trim or bleed box: it opens from its editing data alone where that reads, else from its PDF part (#1387). A `.ai` whose PDF part draws nothing at all (an empty page, with or without those boxes) opens from its editing data alone where that reads too: there is no page art to check its layers against, and the empty page would lose all of it. Text objects with an appearance keep their own text and frame, type of hidden layers stays hidden, and type on later artboards lands on its text objects (#1391); area type whose frame is too short for a line of the fallback font shows its first line (the frame is made taller, with a warning in the open result) (#1392). Symbols, pattern fills whose pattern it can't read, placed files the data keeps no preview of and anything else it doesn't read make the file come in as its page (on a layer that doesn't show, they are left out of that layer), with a warning saying what. An unread object on a shown layer whose box can be found instead comes in as a group of the page's objects inside that box, named after it, with the rest of the layers and groups kept and a warning listing what came in as the page's art; the file still comes in as its page when live art or another unread object shares that page art, when the object spans two artboards, or when the page art doesn't carry its transparency (#4806). The layers' art is also compared with the page (by lightness, so colours written as their CMYK equivalents compare alike, and by whether a pixel is inked at all); the page is used when they differ by more than 5% (away from type, when all the type is made from the text document), where one draws an object the other doesn't (away from type, whose lines may be laid out afresh), and when an EPS whose page is its art's box has art printed outside it (#735). An EPS whose page is its art's box keeps that page when it comes in through its layers, not the editing data's artboard, and a text object counts as drawn by the page by its colours, not only its lightness, so a red stroke stacked over a dark red one stays (#1102). `textAs: "outlines"` opens a `.ai` whose type shows from its PDF part, which has the outlines; `editingData: false` opens any of them as its page or PDF part only, for print pipelines (#735). A file whose import left something out (hidden text, art or layers) is never written over by an export or Save As to its own path unless `acknowledgeLoss: true` (`convert --replace-lossy`), so the original keeps what the document lacks. Where a `.ai` can't be read that way (or its layers are turned off in the import options), we read its PDF-compatible part, so Illustrator-only live objects arrive as appearance, and plain groups arrive ungrouped: that part draws each object on its own and marks only layers, clipping groups and groups with opacity, blending or a mask (those come back). Art outside the artboards isn't in that part at all (Illustrator's PDF part leaves it out), so it doesn't open; the import says so in a note (#472). Its pages still go where the editing data puts the artboards (a grid stays a grid), with the art on each, when it has as many artboards as pages, of the same sizes (#1068). A `.ai` whose PDF part's pages are cropped to its art (each page the box of all the art, which is the editing data's bounding box) instead of its artboards opens from its layers, with its own artboards, where they draw as that page does. Its pages are laid out so that art one of them draws past its artboard (notes beside a design, which the part doesn't clip) doesn't lie over the page before it in the row, where it was taken for that page's art: the check against the editing data then found art its layers don't have there and opened the file as its PDF part, without the art outside the artboards. That part also has no paragraphs: area type is written line by line, and comes back as area type only where its font is installed and lays the lines out with the same breaks, else as a point type object per line (#508). Art off the page that a PDF does draw opens on the pasteboard.
the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPrivateData` streams, a PDF's `AIPDFPrivateData` streams when it was saved with the editing data (#868), Zstandard or zlib, the EPS's in ASCII85) is not documented as a whole. VectorCraft reads its structure: layers and sublayers (names, order, visibility, lock, printing, preview, dimming, colour), groups as they were nested, compound paths (painted by their last path, or the last painted one, with the paths of groups inside them kept as their paths: #1410), clipping groups and layer clipping, object names, hidden and locked objects, fills and strokes (grey, CMYK, RGB, named and spot colours, spot colours defined in Lab with their Lab values (#1032), global process colours as global swatches at their tint), linear and radial gradients, pattern fills with their patterns as pattern swatches (#1025), opacity, blend modes, isolation and knockout, embedded images where their matrix puts them, rotated ones too (#2269), with their alpha channel (CMYK images keep their ink amounts, as they do when a `.ai` opens from its PDF part, and an alpha channel that hides part of a CMYK image becomes a grayscale opacity mask), placed (linked) files as linked images in their place, each showing the low-resolution preview the file keeps of it until its file is found or relinked in the Links panel (#1264), guides, and every artboard where it is. Objects on Path groups open live, with their path, their objects in order along it, Pivot and Rotate; one with a dragged spacing or other options opens as a plain group. A gradient with stops in the middle runs its whole ramp across its shape, and a gradient object does not pass its fill to the next path (#1390). An object whose art style is one fill and one stroke at most (solid colours, its own gradient, a variable-width profile) with an Outer Glow or Drop Shadow comes in as itself with them; one with more, other effects, a brush or dashes aligned to corners comes in as its drawn look (a group named after it). Type keeps its art style as a live appearance whatever its stack, so it can be retyped: each fill and stroke of the style's stack (solid colours, gradients and pattern fills, placed as the drawn look places them) with its own opacity, blend mode and effects, the effects on the whole object, and where the characters paint among them; the effects read are Warp, Offset Path, Transform (with copies), Drop Shadow, Outer Glow, Feather, Gaussian Blur and Bas Relief (its settings at their defaults), and a style with others keeps the type's drawn look. The page's drawing of such a style isn't held to look like VectorCraft's where its drawn look lay. Gradients take their matrix (`Xm`, radials and skewed ones too), focal point and the order of stops sharing a ramp point; gradient meshes, a clipping path's own fill and its stroke, and the artboards' names are read too. `editingData: "always"` (`convert --editing-data`) opens a `.ai` or an Illustrator EPS from its editing data even where it draws differently from its page, which can be older, with a note. Type is made from the file's text document, whole and editable, shown or not: point type (its frame's matrix, which newer files leave out when it is neither turned nor scaled, read as none), area type (a story in several frames as threaded type) and type on a path, with its characters, fonts, size, leading, tracking, scaling, baseline shift, fill and stroke (grey, RGB or CMYK), alignment, indents and paragraph spacing (a character attribute a run doesn't set comes from its character style, then the style that one is based on, then the document's defaults); the page's drawing of it (often in pieces) is left out. When it makes the type of every text object that shows, the page's type is only compared with it, each text object keeps its own group, frame and layer, and a line break inside a paragraph stays one. Where it can't make a text object's type (a frame of another kind), that text object takes the page's type where the text document puts its lines, or else what is left of the page's type in painting order (no group around it); the page's type where made type draws stays that type's, and hidden type is left out with a note. Kerning, underline and the other character and paragraph options aren't read yet. A `.ai` saved without PDF compatibility (a placeholder page) opens from its editing data alone, its point type, area type and type on a path made from the text document. A `.ai` whose PDF part shows only text isn't taken for that placeholder when its page states an art, trim or bleed box: it opens from its editing data alone where that reads, else from its PDF part (#1387). A `.ai` whose PDF part draws nothing at all (an empty page, with or without those boxes) opens from its editing data alone where that reads too: there is no page art to check its layers against, and the empty page would lose all of it. Text objects with an appearance keep their own text and frame, type of hidden layers stays hidden, and type on later artboards lands on its text objects (#1391); area type whose frame is too short for a line of the fallback font shows its first line (the frame is made taller, with a warning in the open result) (#1392). Symbols, pattern fills whose pattern it can't read, placed files the data keeps no preview of and anything else it doesn't read make the file come in as its page (on a layer that doesn't show, they are left out of that layer), with a warning saying what. An unread object on a shown layer whose box can be found instead comes in as a group of the page's objects inside that box, named after it, with the rest of the layers and groups kept and a warning listing what came in as the page's art; the file still comes in as its page when live art or another unread object shares that page art, when the object spans two artboards, or when the page art doesn't carry its transparency (#4806). The layers' art is also compared with the page (by lightness, so colours written as their CMYK equivalents compare alike, and by whether a pixel is inked at all); the page is used when they differ by more than 5% (away from type, when all the type is made from the text document), where one draws an object the other doesn't (away from type, whose lines may be laid out afresh), and when an EPS whose page is its art's box has art printed outside it (#735). An EPS whose page is its art's box keeps that page when it comes in through its layers, not the editing data's artboard, and a text object counts as drawn by the page by its colours, not only its lightness, so a red stroke stacked over a dark red one stays (#1102). `textAs: "outlines"` opens a `.ai` whose type shows from its PDF part, which has the outlines; `editingData: false` opens any of them as its page or PDF part only, for print pipelines (#735). A file whose import left something out (hidden text, art or layers) is never written over by an export or Save As to its own path unless `acknowledgeLoss: true` (`convert --replace-lossy`), so the original keeps what the document lacks. Where a `.ai` can't be read that way (or its layers are turned off in the import options), we read its PDF-compatible part, so Illustrator-only live objects arrive as appearance, and plain groups arrive ungrouped: that part draws each object on its own and marks only layers, clipping groups and groups with opacity, blending or a mask (those come back). Art outside the artboards isn't in that part at all (Illustrator's PDF part leaves it out), so it doesn't open; the import says so in a note (#472). Its pages still go where the editing data puts the artboards (a grid stays a grid), with the art on each, when it has as many artboards as pages, of the same sizes (#1068). A `.ai` whose PDF part's pages are cropped to its art (each page the box of all the art, which is the editing data's bounding box) instead of its artboards opens from its layers, with its own artboards, where they draw as that page does. Its pages are laid out so that art one of them draws past its artboard (notes beside a design, which the part doesn't clip) doesn't lie over the page before it in the row, where it was taken for that page's art: the check against the editing data then found art its layers don't have there and opened the file as its PDF part, without the art outside the artboards. That part also has no paragraphs: area type is written line by line, and comes back as area type only where its font is installed and lays the lines out with the same breaks, else as a point type object per line (#508). Art off the page that a PDF does draw opens on the pasteboard.
## Format by format
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index 4736272d7..326a9cc95 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1207,6 +1207,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Drop Shadow's Darkness:** Effect › Stylize › Drop Shadow… has Color and Darkness as radio buttons, each with its field, and the Appearance panel's inline editor has the two radio buttons in its Shade row (`shade`: `color` or `darkness`; `darkness`: 0 to 100%, 100 by default). Color is the default, and a shadow saved without these keys draws as before. With Darkness, the stored source-color model determines the adjustment before document/profile conversion and blur: subtract Darkness/100 from each RGB channel, clamped at zero, or add it to CMYK black K and Gray black, clamped at one, preserving CMYK C/M/Y. At the near-100% endpoint the shadow source becomes gray black before conversion. Shadow opacity stays separate. Original gradient stops follow the same application rule before interpolation; exact resource-level gradient parity remains open. Application SVG export keeps a live filter for simple uniform sRGB sources and uses rendered shadow images for other working RGB profiles, source models and gradients. Low-level SVG filter output warns when this preparation is needed; proportional intermediate SVG filters are not misread as additive Darkness. Exact spot/custom-color and composite-source parity remain open, and resulting CMYK ink values follow the application color pipeline. CSS export leaves the shadow out and marks the object unsupported. When a `.ai`, EPS or PDF opens from its editing data, a Drop Shadow with Darkness in an object's art style is read as one with Color is, with the shadow's Darkness percentage (100% when the style gives none). Behavior reference: Illustrator CC Help (2014, [PDF](https://help.adobe.com/archive/en/illustrator/cc/2014/illustrator_reference.pdf)), page 428 (PDF page 434).
+- **Stylize effects in `.ai` and EPS editing data:** an object whose art style holds Drop Shadow, Inner Glow, Outer Glow, Feather, Round Corners or Scribble opens with those effects live, in their order, with their saved settings. A key the reader does not know, a missing or out-of-range setting, or a Scribble with a color of its own keeps the object's drawn look.
+
- **Live objects after document changes:** a blend, envelope or repeat, with or without an effect of its own, is evaluated again when one of these changes: the tiling of a pattern whose tiles an envelope bends (Distort Pattern Fills), a symbol shown inside a symbol, a pattern or an opacity mask, the fonts of its type, a placed document's file once the file is read, and the color settings. A gradient mesh, with or without an effect of its own, is colored again when the color settings change.
- **Blend, mesh and envelope points by number:** `object.blend.spine.moveAnchor`, `reshapeSegment` and `removeAnchor`, `object.mesh.setPointColor`, `movePoint` and `deletePoint`, and `object.envelope.setMeshPoint` refuse an `anchor`, `segment` or `index` that is not a whole number, and `object.envelope.setMeshPoint` refuses a negative `index`. Specified Steps (`object.blend.make`, `object.blend.options`) and the rows and columns of `object.mesh.create`, `object.envelope.makeWithMesh` and `resetWithMesh` must be whole numbers too.