mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-16 14:17:14 +00:00
Expand Appearance: symbol instances with raster effects in a fill or stroke become art, nested ones included
A symbol instance whose topmost fill or stroke has only a shadow or glow now expands to its art over the effect's image, instead of a live instance over the image. When the outer instance's art expands, an instance inside it whose topmost fill or stroke has a raster effect (its own or one the outer instance passes on) becomes its art too: a shadow or glow becomes an image under that art, and a blur, feather or inner glow replaces it with the image. This repeats for the instances in that art, within the nesting depth and symbol art limits. An instance of a missing symbol stays an instance.
This commit is contained in:
@@ -87,8 +87,8 @@ pub use raster::{
|
||||
};
|
||||
pub use reshape::{
|
||||
SYMBOL_ART_MAX_NODES, expand_outlined, follows_image_pixels, gives_image_shape, has_gradient_copies, has_instance_row_raster, has_item_geometry,
|
||||
has_painted_effects, has_transform_art, has_transform_copies, has_transform_options, image_paint, needs_outline, outer_effects, outline_art,
|
||||
outline_text, paint_type_piece, reshape,
|
||||
has_painted_effects, has_transform_art, has_transform_copies, has_transform_options, image_paint, instance_as_art, needs_outline, outer_effects,
|
||||
outline_art, outline_text, paint_type_piece, reshape,
|
||||
};
|
||||
pub use revolve::{
|
||||
CLASSIC_REVOLVE, REVOLVE, has_revolve, is_revolve, revolve_art, revolve_art_in, revolve_options, validate_revolve, validate_revolve_in,
|
||||
|
||||
@@ -845,6 +845,16 @@ pub fn expand_outlined(doc: Option<&Document>, n: &Node, symbol_art: Option<&Nod
|
||||
as_art(doc, n, symbol_art)
|
||||
}
|
||||
|
||||
/// Symbol instance `n` as plain art for Expand Appearance, with or without geometry effects: the
|
||||
/// art it places, reshaped by those effects when it has some, in the form [`expand_outlined`]
|
||||
/// gives. `None` for other kinds of objects and for an instance without `symbol_art`.
|
||||
pub fn instance_as_art(doc: Option<&Document>, n: &Node, symbol_art: Option<&Node>) -> Option<Node> {
|
||||
if !matches!(n.kind, NodeKind::SymbolInstance { .. }) {
|
||||
return None;
|
||||
}
|
||||
as_art(doc, n, symbol_art)
|
||||
}
|
||||
|
||||
/// [`reshape`] without its checks (no geometry effects: just the art).
|
||||
pub(crate) fn as_art(doc: Option<&Document>, n: &Node, symbol_art: Option<&Node>) -> Option<Node> {
|
||||
as_art_with(doc, doc, n, symbol_art, &outline_text, &SymbolNodes::default())
|
||||
|
||||
@@ -97,7 +97,7 @@ fn effect_specs() -> Vec<CommandSpec> {
|
||||
"Expand Appearance",
|
||||
["Object"],
|
||||
None,
|
||||
"{ids?|id?: [..], target?} turn each object's appearance into objects: every fill and stroke becomes an object of its own (a stroke stays a stroke, with its weight, dashes, arrowheads and width profile, on its own copy of the path, which object.expand or object.path.outlineStroke outline; brushed strokes become their brush art) grouped in paint order under the object's id and transparency, geometry effects are baked, raster effects become an embedded image (shadows and outer glows below the art; blur, feather and inner glow replace it; an object whose only raster effect is its own Rasterize becomes the image object.rasterize makes with the effect's options), type with effects or fills of its own is outlined; Crop Marks become a group of the object and its marks; Vector Halftone (addon.color.halftone) becomes a group of its dot paths, one per ink; a group's or layer's own fills and strokes become objects among its members, which are expanded too; a symbol instance whose topmost fill or stroke is visible, has an opacity above 0 and has a geometry effect becomes a group of its art, that fill's effects reshaping the art's filled shapes and that stroke's effects reshaping its stroked shapes, as the canvas draws them. An outlined frame of threaded text leaves its thread with the text it shows, and a frame kept as type in a group stays in its thread. A dimension whose art it changes becomes a plain group of its art, except one selected with art it measures, directly or in groups without fills, strokes or effects of their own: its lines and label stay as they are, and if the new art no longer fits its link it stays where it was, no longer linked. Hidden fills, strokes and effects are dropped. In Safe Mode, an object with a visible plug-in effect (in it, or in a symbol it places) is an error and nothing changes. Enabled when a selected or targeted object's appearance isn't basic (`ids` then pick which objects) → {ids, warning? (an image in the art couldn't be decoded, as object.rasterize says)}",
|
||||
"{ids?|id?: [..], target?} turn each object's appearance into objects: every fill and stroke becomes an object of its own (a stroke stays a stroke, with its weight, dashes, arrowheads and width profile, on its own copy of the path, which object.expand or object.path.outlineStroke outline; brushed strokes become their brush art) grouped in paint order under the object's id and transparency, geometry effects are baked, raster effects become an embedded image (shadows and outer glows below the art; blur, feather and inner glow replace it; an object whose only raster effect is its own Rasterize becomes the image object.rasterize makes with the effect's options), type with effects or fills of its own is outlined; Crop Marks become a group of the object and its marks; Vector Halftone (addon.color.halftone) becomes a group of its dot paths, one per ink; a group's or layer's own fills and strokes become objects among its members, which are expanded too; a symbol instance whose topmost fill or stroke is visible, has an opacity above 0 and has a geometry or raster effect becomes a group of its art, that fill's effects reshaping the art's filled shapes and that stroke's effects reshaping its stroked shapes, as the canvas draws them, its raster effects an image as for other objects; a symbol instance in that art whose topmost fill or stroke has such an effect (its own or one the outer instance passes on) becomes its art and image in turn. An outlined frame of threaded text leaves its thread with the text it shows, and a frame kept as type in a group stays in its thread. A dimension whose art it changes becomes a plain group of its art, except one selected with art it measures, directly or in groups without fills, strokes or effects of their own: its lines and label stay as they are, and if the new art no longer fits its link it stays where it was, no longer linked. Hidden fills, strokes and effects are dropped. In Safe Mode, an object with a visible plug-in effect (in it, or in a symbol it places) is an error and nothing changes. Enabled when a selected or targeted object's appearance isn't basic (`ids` then pick which objects) → {ids, warning? (an image in the art couldn't be decoded, as object.rasterize says)}",
|
||||
can_expand,
|
||||
expand_appearance
|
||||
),
|
||||
@@ -1007,12 +1007,10 @@ fn expand_pieces(
|
||||
}
|
||||
|
||||
/// Replace each symbol instance in `m`, art an instance placed (`depth` instances deep), whose
|
||||
/// active fill or stroke has a geometry effect ([`effects::has_item_geometry`]) by its art as
|
||||
/// [`effects::expand_outlined`] makes it, and the instances in that art in turn, so
|
||||
/// [`expand_pieces`] bakes their effects with the rest. An instance stays as it is when it is more
|
||||
/// than [`vectorcraft_doc::depth::MAX_DEPTH`] instances deep, its symbol is missing, or its art
|
||||
/// would take the objects placed so far past `budget`.
|
||||
fn expand_nested_instances(d: &Document, m: &mut Node, depth: usize, budget: &mut u64) {
|
||||
/// active fill or stroke has a geometry or raster effect ([`effects::has_item_geometry`],
|
||||
/// [`effects::has_instance_row_raster`]) by its art ([`expanded_instance`]), and the instances in
|
||||
/// that art in turn, so [`expand_pieces`] bakes their effects with the rest.
|
||||
fn expand_nested_instances(d: &mut Document, m: &mut Node, depth: usize, budget: &mut u64) {
|
||||
for c in m.children_mut().into_iter().flatten() {
|
||||
if !matches!(c.kind, NodeKind::SymbolInstance { .. }) {
|
||||
if c.children().is_some() {
|
||||
@@ -1020,24 +1018,53 @@ fn expand_nested_instances(d: &Document, m: &mut Node, depth: usize, budget: &mu
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let NodeKind::SymbolInstance { symbol, .. } = &c.kind else { continue };
|
||||
if depth >= vectorcraft_doc::depth::MAX_DEPTH || !effects::has_item_geometry(c) {
|
||||
continue;
|
||||
}
|
||||
let Some(sym) = d.symbols.iter().find(|s| s.name == *symbol) else { continue };
|
||||
let count = sym.art.count() as u64;
|
||||
if count > *budget {
|
||||
continue;
|
||||
}
|
||||
*budget -= count;
|
||||
let art = vectorcraft_render::instance_art(&sym.art, c);
|
||||
if let Some(mut a) = effects::expand_outlined(Some(d), c, Some(&art)) {
|
||||
expand_nested_instances(d, &mut a, depth + 1, budget);
|
||||
if let Some(a) = expanded_instance(d, c, depth, budget) {
|
||||
*c = Arc::new(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Symbol instance `c`, art an instance placed (`depth` instances deep), as art: the raster
|
||||
/// effects of its active fill or stroke an embedded image ([`raster_image`]) that replaces the art
|
||||
/// (blur, feather, inner glow) or goes below it (shadows, outer glows), and its art as
|
||||
/// [`effects::expand_outlined`] makes it without them, or as [`effects::instance_as_art`] does when
|
||||
/// it has no geometry effect, with the instances in that art expanded in turn. `None`, the instance
|
||||
/// staying as it is, when its active fill and stroke have no such effect, it is more than
|
||||
/// [`vectorcraft_doc::depth::MAX_DEPTH`] instances deep, its symbol is missing, or its art would
|
||||
/// take the objects placed so far past `budget`. When the image of its raster effects can't be
|
||||
/// made, they stay on the art its geometry effects make, and without one it stays as it is.
|
||||
fn expanded_instance(d: &mut Document, c: &Node, depth: usize, budget: &mut u64) -> Option<Node> {
|
||||
let NodeKind::SymbolInstance { symbol, .. } = &c.kind else { return None };
|
||||
let raster = effects::has_instance_row_raster(c);
|
||||
if depth >= vectorcraft_doc::depth::MAX_DEPTH || !(raster || effects::has_item_geometry(c)) {
|
||||
return None;
|
||||
}
|
||||
let sym = d.symbols.iter().find(|s| s.name == *symbol)?;
|
||||
let count = sym.art.count() as u64;
|
||||
if count > *budget {
|
||||
return None;
|
||||
}
|
||||
*budget -= count;
|
||||
let art = vectorcraft_render::instance_art(&sym.art, c);
|
||||
let image = if raster { raster_image(d, c) } else { None };
|
||||
let mut v = c.clone();
|
||||
if image.is_some() {
|
||||
rasterfx::strip_raster(&mut v, false);
|
||||
}
|
||||
let below = match image {
|
||||
Some((image, false)) => return Some(rasterfx::replace_with_image(v, image)),
|
||||
Some((image, true)) => Some(image),
|
||||
None => None,
|
||||
};
|
||||
let mut a = effects::expand_outlined(Some(&*d), &v, Some(&art))
|
||||
.or_else(|| if below.is_some() { effects::instance_as_art(Some(&*d), &v, Some(&art)) } else { None })?;
|
||||
expand_nested_instances(d, &mut a, depth + 1, budget);
|
||||
if let Some(image) = below {
|
||||
rasterfx::put_below(d, &mut a, image);
|
||||
}
|
||||
Some(a)
|
||||
}
|
||||
|
||||
/// Does `n` hold an id of `seen`, or one id twice: does [`effects::fresh_ids`] give it new ids?
|
||||
fn repeats_an_id(n: &Node, seen: &std::collections::HashSet<NodeId>) -> bool {
|
||||
let mut ids = std::collections::HashSet::new();
|
||||
@@ -1192,7 +1219,12 @@ fn expanded_node(d: &mut Document, mut n: Node, brushes: &[vectorcraft_brush::Br
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
effects::expand_outlined(Some(&*d), &v, symbol.as_ref()).map(|mut m| {
|
||||
// A symbol instance whose active fill or stroke has only effects that paint below it
|
||||
// (now in the image) becomes its art as well.
|
||||
let row_raster = image.is_some() && effects::has_instance_row_raster(&n);
|
||||
let outlined = effects::expand_outlined(Some(&*d), &v, symbol.as_ref())
|
||||
.or_else(|| if row_raster { effects::instance_as_art(Some(&*d), &v, symbol.as_ref()) } else { None });
|
||||
outlined.map(|mut m| {
|
||||
let mut budget = vectorcraft_doc::MAX_SYMBOL_NODES;
|
||||
expand_nested_instances(d, &mut m, 1, &mut budget);
|
||||
expand_pieces(d, &mut m, true, brushes, &mut stroke_art);
|
||||
|
||||
@@ -455,10 +455,11 @@ fn a_symbol_instance_fill_shadow_shadows_its_filled_art() {
|
||||
|
||||
assert!(expandable(&s), "the fill's shadow can be expanded");
|
||||
run(&mut s, "effect.expandAppearance", json!({}));
|
||||
let ch = node(&s, id).children().cloned().expect("the instance becomes a group");
|
||||
let n = node(&s, id);
|
||||
let ch = n.children().cloned().expect("the instance becomes a group");
|
||||
assert!(matches!(ch[0].kind, NodeKind::Image(_)), "the shadow is an image under the art: {}", ch[0].kind_label());
|
||||
assert!(matches!(ch[1].kind, NodeKind::SymbolInstance { .. }), "the art stays an instance: {}", ch[1].kind_label());
|
||||
no_effects_left(&ch[1]);
|
||||
n.walk(&mut |part| assert!(!matches!(part.kind, NodeKind::SymbolInstance { .. }), "the art is no longer an instance"));
|
||||
no_effects_left(&n);
|
||||
let after = render(&s);
|
||||
assert!(differing(&before, &after, 24) < 400, "expanding changed {} pixels", differing(&before, &after, 24));
|
||||
run(&mut s, "edit.undo", json!({}));
|
||||
@@ -508,6 +509,143 @@ fn a_nested_symbol_instance_takes_the_outer_fill_shadow() {
|
||||
assert!(dark(render(&s).pixel(165, 100)), "the inner art casts the shadow: {:?}", render(&s).pixel(165, 100));
|
||||
}
|
||||
|
||||
/// An instance of an Inner symbol of the square, with a new fill without paint on top that `inner`
|
||||
/// gives effects, placed in the art of an Outer symbol; the Outer instance is selected, with a new
|
||||
/// fill without paint on top. Returns the Outer instance and its new row's index.
|
||||
fn nested_with_row(s: &mut Session, inner: impl FnOnce(&mut Session, NodeId, usize)) -> (NodeId, usize) {
|
||||
let (inner_id, inner_row) = instance_with_row(s, "Inner", true);
|
||||
inner(s, inner_id, inner_row);
|
||||
let id = NodeId(run(s, "symbol.new", json!({"name": "Outer"}))["id"].as_u64().unwrap());
|
||||
run(s, "appearance.addFill", json!({"ids": [id.0]}));
|
||||
let row = node(s, id).appearance.items.len() - 1;
|
||||
run(s, "appearance.setItem", json!({"ids": [id.0], "index": row, "none": true}));
|
||||
(id, row)
|
||||
}
|
||||
|
||||
/// The symbol instances and the images in `n`.
|
||||
fn instances_and_images(n: &Node) -> (usize, usize) {
|
||||
let mut found = (0, 0);
|
||||
n.walk(&mut |part| match part.kind {
|
||||
NodeKind::SymbolInstance { .. } => found.0 += 1,
|
||||
NodeKind::Image(_) => found.1 += 1,
|
||||
_ => {}
|
||||
});
|
||||
found
|
||||
}
|
||||
|
||||
/// Replace the art of every symbol with an empty group.
|
||||
fn empty_symbols(s: &mut Session) {
|
||||
let d = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
|
||||
for (i, sym) in d.symbols.iter_mut().enumerate() {
|
||||
sym.art = std::sync::Arc::new(Node::group(NodeId(91_000 + i as u64), vec![]));
|
||||
}
|
||||
}
|
||||
|
||||
/// When the outer instance's art expands, an instance in it whose own fill has a shadow becomes art
|
||||
/// too, the shadow an image under it: no instance or effect is left, the look stays, and the result
|
||||
/// no longer follows either symbol.
|
||||
#[test]
|
||||
fn a_nested_instance_fill_shadow_becomes_an_image_when_the_outer_art_expands() {
|
||||
let mut s = session();
|
||||
let (id, row) = nested_with_row(&mut s, shadow_row);
|
||||
offset_row(&mut s, id, row, 10.0);
|
||||
let before = render(&s);
|
||||
assert!(dark(before.pixel(175, 100)), "the inner art casts its shadow: {:?}", before.pixel(175, 100));
|
||||
|
||||
run(&mut s, "effect.expandAppearance", json!({}));
|
||||
let n = node(&s, id);
|
||||
let (instances, images) = instances_and_images(&n);
|
||||
assert_eq!(instances, 0, "the outer and inner instances become art");
|
||||
assert!(images >= 1, "the inner shadow is an image");
|
||||
no_effects_left(&n);
|
||||
let after = render(&s);
|
||||
assert!(differing(&before, &after, 24) < 400, "expanding changed {} pixels", differing(&before, &after, 24));
|
||||
empty_symbols(&mut s);
|
||||
assert_eq!(differing(&after, &render(&s), 0), 0, "the expanded art no longer follows the symbols");
|
||||
}
|
||||
|
||||
/// A shadow on the outer instance's fill alone: the instance becomes its art over the shadow's
|
||||
/// image, and an instance in that art with a shadow of its own becomes art and an image in turn, in
|
||||
/// one undo step.
|
||||
#[test]
|
||||
fn an_outer_fill_shadow_expands_the_instance_and_reaches_the_nested_art() {
|
||||
let mut s = session();
|
||||
let (id, row) = nested_with_row(&mut s, shadow_row);
|
||||
shadow_row(&mut s, id, row);
|
||||
let before = render(&s);
|
||||
assert!(expandable(&s));
|
||||
|
||||
run(&mut s, "effect.expandAppearance", json!({}));
|
||||
let n = node(&s, id);
|
||||
let (instances, images) = instances_and_images(&n);
|
||||
assert_eq!(instances, 0, "the outer and inner instances become art");
|
||||
assert!(images >= 2, "the outer and inner shadows are images: {images}");
|
||||
no_effects_left(&n);
|
||||
let after = render(&s);
|
||||
assert!(differing(&before, &after, 24) < 400, "expanding changed {} pixels", differing(&before, &after, 24));
|
||||
|
||||
run(&mut s, "edit.undo", json!({}));
|
||||
assert!(matches!(node(&s, id).kind, NodeKind::SymbolInstance { .. }), "one undo gives the instance back");
|
||||
run(&mut s, "edit.redo", json!({}));
|
||||
empty_symbols(&mut s);
|
||||
assert_eq!(differing(&after, &render(&s), 0), 0, "the expanded art no longer follows the symbols");
|
||||
}
|
||||
|
||||
/// A blur on the nested instance's fill: the nested instance becomes the image.
|
||||
#[test]
|
||||
fn a_nested_instance_fill_blur_becomes_an_image_when_the_outer_art_expands() {
|
||||
let mut s = session();
|
||||
let blur = |s: &mut Session, id: NodeId, row: usize| {
|
||||
run(s, "effect.apply", json!({"ids": [id.0], "item": row, "effect": "blur.gaussian", "params": {"radius": 3}}));
|
||||
};
|
||||
let (id, row) = nested_with_row(&mut s, blur);
|
||||
offset_row(&mut s, id, row, 10.0);
|
||||
let before = render(&s);
|
||||
|
||||
run(&mut s, "effect.expandAppearance", json!({}));
|
||||
let n = node(&s, id);
|
||||
let (instances, images) = instances_and_images(&n);
|
||||
assert_eq!(instances, 0, "the outer and inner instances become art");
|
||||
assert_eq!(images, 1, "the blurred inner art is one image");
|
||||
no_effects_left(&n);
|
||||
let after = render(&s);
|
||||
assert!(differing(&before, &after, 24) < 400, "expanding changed {} pixels", differing(&before, &after, 24));
|
||||
}
|
||||
|
||||
/// A shadow on a hidden fill of the nested instance draws nothing, and expanding makes no image of it.
|
||||
#[test]
|
||||
fn a_hidden_nested_instance_fill_shadow_makes_no_image() {
|
||||
let mut s = session();
|
||||
let hidden = |s: &mut Session, id: NodeId, row: usize| {
|
||||
shadow_row(s, id, row);
|
||||
run(s, "appearance.setItem", json!({"ids": [id.0], "index": row, "visible": false}));
|
||||
};
|
||||
let (id, row) = nested_with_row(&mut s, hidden);
|
||||
offset_row(&mut s, id, row, 10.0);
|
||||
assert!(!dark(render(&s).pixel(175, 100)), "the hidden fill casts no shadow");
|
||||
|
||||
run(&mut s, "effect.expandAppearance", json!({}));
|
||||
let n = node(&s, id);
|
||||
assert_eq!(instances_and_images(&n), (0, 0), "the instances become art without an image");
|
||||
no_effects_left(&n);
|
||||
}
|
||||
|
||||
/// A nested instance with a shadow whose symbol is missing stays as it is while the outer art
|
||||
/// expands around it.
|
||||
#[test]
|
||||
fn a_nested_instance_of_a_missing_symbol_stays_an_instance() {
|
||||
let mut s = session();
|
||||
let (id, row) = nested_with_row(&mut s, shadow_row);
|
||||
offset_row(&mut s, id, row, 10.0);
|
||||
{
|
||||
let d = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
|
||||
d.symbols.retain(|sym| sym.name != "Inner");
|
||||
}
|
||||
run(&mut s, "effect.expandAppearance", json!({}));
|
||||
let n = node(&s, id);
|
||||
assert_eq!(instances_and_images(&n), (1, 0), "the inner instance stays, without an image");
|
||||
}
|
||||
|
||||
/// Export draws a symbol instance's fill shadow on the filled shapes of its art: baking leaves the
|
||||
/// shadow on the art's fill, not its stroke, and PDF export makes an image of it.
|
||||
#[test]
|
||||
|
||||
+9
-5
@@ -5242,11 +5242,15 @@ the object with the image). Type with a geometry effect (Outline Object included
|
||||
is outlined; type that has no fills or strokes of its own and whose only effects are shadows or outer glows stays
|
||||
type, with the image under it. A group's or layer's own fills and strokes become objects among its members, and its
|
||||
members are expanded too. A symbol instance whose topmost fill or topmost stroke is visible, has an opacity above 0
|
||||
and has a geometry effect becomes a group of its art: that fill's effects reshape the filled shapes of the art and that
|
||||
stroke's effects reshape its stroked shapes, which keep their colors, as the canvas draws them (VectorCraft's own
|
||||
rule); the instance's other fills and strokes are dropped. A raster effect on that fill or stroke draws on the filled
|
||||
or stroked shapes of the art, and expanding makes it an image as for other objects; with no geometry effect, the
|
||||
instance stays an instance over a shadow or glow image, and a blur, feather or inner glow replaces it with the image.
|
||||
and has a geometry or raster effect becomes a group of its art: that fill's effects reshape the filled shapes of the
|
||||
art and that stroke's effects reshape its stroked shapes, which keep their colors, as the canvas draws them
|
||||
(VectorCraft's own rule); the instance's other fills and strokes are dropped. A raster effect on that fill or stroke
|
||||
draws on the filled or stroked shapes of the art, and expanding makes it an image as for other objects: a shadow or
|
||||
glow image goes under the art, and a blur, feather or inner glow replaces the instance with the image. A symbol
|
||||
instance in the art whose topmost fill or stroke has a geometry or raster effect, its own or one the outer instance
|
||||
passes on, becomes its art and image the same way, and so do the instances in that art (VectorCraft's own rule).
|
||||
Before, an instance whose fill or stroke had only a shadow or glow stayed an instance over the image, and a raster
|
||||
effect on an instance in the art stayed live.
|
||||
The result is `{ids}`; when an image in the art can't be decoded, the images made from
|
||||
raster effects do not show it, and the result also carries the `warning` that Flatten Transparency gives.
|
||||
A path's strokes stay strokes, as the
|
||||
|
||||
@@ -1690,6 +1690,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
A geometry effect on a symbol instance's fill reshapes the filled shapes of the symbol's art and leaves their strokes as they are; one on the instance's stroke reshapes the stroked shapes and leaves their fills as they are. The shapes keep their colors. Only the instance's topmost fill and topmost stroke count, and only while they are visible with an opacity above 0. The canvas and Object › Expand Appearance use the same art, SVG and PDF export bake the same shapes, and Expand Appearance turns the instance into an editable group in one undo step. A group's own fills and strokes in the art take the effects too. An instance inside the art passes the effects on to its own art, and a dynamic symbol's instance reshapes the fills and strokes it paints on the art. How the effects map onto the symbol's art is VectorCraft's own rule. The help page <https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/apply-and-modify-effects.html> describes effects on one fill or stroke, and the help page <https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/expand-objects.html> describes Expand Appearance (engine `expand::a_symbol_instance_fill_effect_reshapes_its_filled_art_and_expands`, `a_symbol_instance_stroke_effect_reshapes_its_stroked_art_and_expands`, `a_stroke_effect_reshapes_a_stroke_a_dynamic_instance_adds`, `a_fill_effect_reshapes_the_fill_of_a_group_in_the_art`, `only_the_topmost_visible_instance_fill_reshapes_the_art`, `a_nested_symbol_instance_takes_the_outer_fill_effect`, `export_bakes_a_symbol_instance_fill_effect`, `a_fill_effect_on_an_instance_of_a_symbol_that_holds_itself_ends`). Existing documents with a geometry effect on a symbol instance's fill or stroke draw differently: before, the effect drew nothing.
|
||||
Live effects inside a symbol's art (geometry effects, color adjustments and the rest that export bakes) are written where each instance places the art in PDF, print, EPS and DXF, as the canvas draws them: the art is placed first and its effects are applied after, so an instance that scales its art does not scale the distance a Transform effect moves it. Symbols nested in the art, a dynamic symbol instance's own paint changes and the stain an instance's fill gives its art are kept, and the art is stained before its effects apply. A linked instance's PDF link covers its art where the effects draw it. A symbol whose art holds itself stops at the nesting limit, and the symbols' own art keeps its effects. An instance stays an instance in these exports when the objects its art makes once baked (the copies a Transform effect makes included) would take the export's placed symbol art past 16,000,000 objects, or when its baked art would draw deeper than the 128 levels a document may draw; these are VectorCraft's own limits. Art baked for an instance that then stays an instance still counts toward that limit, and while an instance's art bakes, the art's own objects are held in the limit for the instances nested in it. Instances the export leaves out (hidden ones, those in hidden groups, on template layers, and on hidden layers or layers that do not print when the export leaves those out) are not placed and do not count toward that limit. Before, these exports wrote the art without its effects (effects `bake::placing_symbols_bakes_their_art_where_each_instance_places_it`, `placing_symbols_reaches_the_art_of_nested_instances`, `placing_a_symbol_that_holds_itself_stops`, `placing_symbols_keeps_dynamic_instances_changes`, `placing_symbols_keeps_the_instances_stain`, `placing_symbols_counts_the_baked_art`, `placing_symbols_counts_nested_art_once`, `placing_symbols_holds_the_outer_art_while_it_bakes`, `placing_symbols_counts_the_art_it_drops`, `placing_symbols_counts_art_dropped_for_depth_against_later_baked_art`, `placing_symbols_keeps_the_baked_art_within_the_drawn_depth`, `placing_symbols_skips_instances_the_export_leaves_out`; doc `depth::tests::drawn_heights_measure_objects_outside_the_layers`; PDF, print, EPS and DXF `symbol_art_effects_are_written_where_they_draw`, `symbol_art_effects_print_where_they_draw`; PDF `a_stained_instance_keeps_its_stain_when_its_art_has_effects`, `a_linked_instance_keeps_its_link_when_its_art_has_effects`).
|
||||
A raster effect (Drop Shadow, Outer Glow, Gaussian Blur and the other effects that paint pixels) on a symbol instance's topmost fill draws on each filled shape of the symbol's art, and one on its topmost stroke draws on each stroked shape, after any geometry effects listed before it, under the same rules as geometry effects: only a visible fill or stroke with an opacity above 0 counts, a group's own fills and strokes in the art take the effect, and an instance inside the art passes it on. Each shape gets its own shadow or glow, which is VectorCraft's own rule. The canvas, Use Preview Bounds and the drawn bounds, SVG and PDF export draw it, and Object › Expand Appearance is enabled for such an instance and makes the effect an image at the document's raster effects resolution, in one undo step (engine `expand::a_symbol_instance_fill_shadow_shadows_its_filled_art`, `a_symbol_instance_stroke_shadow_shadows_only_its_stroked_art`, `a_symbol_instance_fill_shadow_follows_the_fill_offset_before_it`, `a_nested_symbol_instance_takes_the_outer_fill_shadow`, `export_draws_a_symbol_instance_fill_shadow`). Existing documents with a raster effect on a symbol instance's fill or stroke draw differently: before, the effect drew nothing.
|
||||
Object › Expand Appearance turns a symbol instance whose topmost fill or stroke has only raster effects into its art as well, with the effect's image under the art (a shadow or glow) or in its place (a blur, feather or inner glow). A symbol instance inside the art whose topmost fill or stroke has a geometry or raster effect, its own or one the outer instance passes on, becomes its art and image the same way, and so do the instances in that art, within the nesting and symbol art limits; an instance of a missing symbol stays an instance. No live instance or raster effect is left from those effects, so the result no longer changes with the symbols. The help page <https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/expand-objects.html> describes Expand Appearance turning appearance attributes into objects, and the help page <https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/vector-and-raster-effects.html> describes expanding an effect into permanent raster data; expanding nested instances this way is VectorCraft's own rule (engine `expand::a_nested_instance_fill_shadow_becomes_an_image_when_the_outer_art_expands`, `an_outer_fill_shadow_expands_the_instance_and_reaches_the_nested_art`, `a_nested_instance_fill_blur_becomes_an_image_when_the_outer_art_expands`, `a_hidden_nested_instance_fill_shadow_makes_no_image`, `a_nested_instance_of_a_missing_symbol_stays_an_instance`). Before, an instance whose fill or stroke had only a shadow or glow stayed an instance over the image, and a raster effect on an instance in the art stayed live.
|
||||
The Appearance panel's inline effect editor labels each parameter as the effect dialogs' generic fields do, without the colon ("Max. Radius", "Channel 1", "Create New Fields by"). Roughen's and Zig Zag's Points, Offset Path's Joins, Inner Glow's Source and the menus of Radial Blur, Smart Blur, Sprayed Strokes, Glass, Mezzotint, Halftone Pattern, Grain, Texturizer and De-Interlace are dropdowns with the dialog's labels that send the dialog's values, and a plug-in's choice is a dropdown of the plug-in's values.
|
||||
Revolve's edge, Extrude & Bevel's bevel, every Warp style's orientation, Rasterize's Color Model, Background and Anti-aliasing and the channel of Levels and Curves are dropdowns too, with the labels their own dialogs show. `effect.apply` and `effect.setParams` refuse a Levels or Curves `channel` other than `rgb`, `red`, `green` or `blue` (or `r`, `g` and `b`, in any letter case).
|
||||
Object › Expand Appearance keeps each stroke of a path a stroke (weight, caps, joins, dashes, arrowheads, alignment and width profile) on a copy of the path with the geometry effects baked in, and Object › Expand… is dimmed, with a tooltip, while the selection has appearance attributes, so a stroked line with Zig Zag becomes a stroked zig-zag line and only Expand then outlines it, the two steps the [Expand objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/expand-objects.html) help page describes (#3089). Brushed strokes still become their brush art; `object.expand` still bakes and outlines in one step for agents.
|
||||
|
||||
Reference in New Issue
Block a user