mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-16 16:42:52 +00:00
Image Trace: seam fills on a stretched image stay within 0.75 image px of their edge
On an image stretched more one way than another, a seam stroke was as wide as 1.5 pixels at the larger scale, so across the less stretched direction it reached far past its edge: on a 40 x 20 image scaled 20x across, a stroke along a horizontal edge covered 15 pixels on each side, over transparent rows too. On such an image, the seam fills are now each stroke's outline in image pixels (butt caps, round joins), filled with the stroke's paint. An image scaled alike in every direction keeps strokes. The anchor limit counts the outlines' anchors. Outline views and Expand by color recognize a seam fills group of filled outlines as they do one of strokes, and Expand by color again recognizes the unclipped seam fills group of a trace made before the seam fills were clipped.
This commit is contained in:
@@ -654,16 +654,16 @@ impl Renderer {
|
||||
let opts = RenderOptions { outline: true, ..f.opts.clone() };
|
||||
let frame = Frame { opts: &opts, ..*f };
|
||||
// An Abutting trace's seam fills hold no traced outline: a clip group named "Seam Fills"
|
||||
// of stroked paths without fills.
|
||||
// of paths that are each stroked without a fill or (on a stretched image, the strokes'
|
||||
// outlines) filled without a stroke.
|
||||
let seam_fills = |c: &Arc<Node>| {
|
||||
let stroke_only = |m: &Arc<Node>| {
|
||||
let one_paint = |m: &Arc<Node>| {
|
||||
matches!(m.kind, NodeKind::Path { .. } | NodeKind::Compound { .. })
|
||||
&& m.appearance.fill_paint().is_none()
|
||||
&& !m.appearance.stroke_paint().is_none()
|
||||
&& m.appearance.fill_paint().is_none() != m.appearance.stroke_paint().is_none()
|
||||
};
|
||||
c.name.as_deref() == Some("Seam Fills")
|
||||
&& matches!(&c.kind, NodeKind::Group { clip: true, children }
|
||||
if children.split_first().is_some_and(|(_, members)| !members.is_empty() && members.iter().all(stroke_only)))
|
||||
if children.split_first().is_some_and(|(_, members)| !members.is_empty() && members.iter().all(one_paint)))
|
||||
};
|
||||
for c in shapes.iter().filter(|c| !seam_fills(c)) {
|
||||
self.draw_outline_member(ctx, &frame, c);
|
||||
|
||||
Reference in New Issue
Block a user