mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-25 00:54:06 +00:00
Merge pull request #8886 from dotCooCoo/fix/outline-compound-strokes-not-fill
Pathfinder: Outline of a compound shape with no fill adds no stroke of its own
This commit is contained in:
@@ -583,9 +583,10 @@ pub fn pathfinder_children(doc: Option<&Document>, group: &Node, hook: Option<Ou
|
||||
let own_fill = has_visible_fill(group);
|
||||
// A compound shape's area has no paint of its own: the shape's own appearance paints it. The
|
||||
// shape's top painting fill is the area's fill for Remove Unpainted Artwork and for Outline's
|
||||
// strokes, while Divide pieces stay unpainted so that the fill is not drawn twice.
|
||||
// strokes, while Divide pieces stay unpainted so that the fill is not drawn twice. The shape's
|
||||
// strokes stay out: the shape's own appearance already strokes the result.
|
||||
let area_style = group.is_compound_shape().then(|| {
|
||||
let items = group.appearance.items.iter().filter(|i| paints(i)).cloned().collect();
|
||||
let items = top_painting_fill(&group.appearance).cloned().into_iter().collect();
|
||||
Node::path(group.id, PathData::default(), Appearance { items, ..Default::default() })
|
||||
});
|
||||
let style_of = |s: &Node| -> Option<Node> {
|
||||
|
||||
@@ -306,6 +306,25 @@ fn outline_strokes_a_compound_shapes_area_in_its_fill() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Outline of a compound shape with no fill gives the edges no paint of their own when Remove
|
||||
/// Unpainted Artwork is off. The shape's own appearance strokes the result, so the shape's stroke
|
||||
/// is not copied onto the edges.
|
||||
#[test]
|
||||
fn outline_of_an_unfilled_compound_shape_adds_no_stroke() {
|
||||
let mut g = compound_shape(ShapeMode::Add);
|
||||
let mut a = Appearance::basic(Paint::None, Paint::solid(Color::BLACK), 4.0);
|
||||
if let Some(AppearanceItem::Stroke(s)) = a.items.last_mut() {
|
||||
s.opacity = 0.5;
|
||||
}
|
||||
g.appearance = a.into();
|
||||
g.appearance.effects.push(Effect { id: "pathfinder.outline".into(), params: serde_json::json!({"removeUnpainted": false}), visible: true });
|
||||
let out = pathfinder_children(None, &g, None).unwrap();
|
||||
assert!(!out.is_empty(), "{out:#?}");
|
||||
for n in &out {
|
||||
assert!(!n.appearance.items.iter().any(paints), "{n:#?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// With Remove Unpainted Artwork, Divide keeps the pieces of an unfilled member when its group's
|
||||
/// own visible fill paints them and leaves them out when the group has no fill. Outline leaves out
|
||||
/// the member's segments either way.
|
||||
|
||||
+2
-1
@@ -6221,7 +6221,8 @@ Each Effect › Pathfinder effect (`pathfinder.add` … `pathfinder.softMix`, no
|
||||
in its params: `precision` (a number, 0.001–10 pt), `removeRedundantPoints` and `removeUnpainted` (true or false), which
|
||||
mean what they mean for the panel's operations; the other operations ignore `removeUnpainted`. With `removeUnpainted`
|
||||
on, a compound shape's area counts as filled when the shape has a visible fill of its own, and Divide keeps every piece
|
||||
when the group or compound shape has one. Outline strokes a compound shape's area in the shape's own fill. `effect.apply`
|
||||
when the group or compound shape has one. Outline strokes a compound shape's area in the shape's own fill, and gives
|
||||
the edges no paint when the shape has no fill (the shape's own strokes still draw over the result). `effect.apply`
|
||||
fills the ones `params` leave out from the current Pathfinder Options, and the values join its journal entry. An effect
|
||||
saved without them evaluates with precision 0.01 and both switches off, as before effects kept them. `effect.setParams
|
||||
{index, params: {precision?, removeRedundantPoints?, removeUnpainted?}}` edits them as one undo step; values the
|
||||
|
||||
Reference in New Issue
Block a user