Merge pull request #7828 from dotCooCoo/fix/trace-seam-fills-clip

Image Trace: seam fills are clipped to the image and skip live shapes
This commit is contained in:
BFlat
2026-11-16 09:32:19 +07:00
committed by GitHub
8 changed files with 618 additions and 121 deletions
+14 -10
View File
@@ -3879,16 +3879,20 @@ already walks Image Trace. Short agent entry points:
black ring around a white disc around a black dot, black gets two groups. `layer.releaseToLayers` on the expanded group then
gives each group a sublayer. A trace made with `autoGrouping` is refused. Expanding by color also refuses a trace
with a live Pathfinder effect.
An Abutting trace with Fills (not Flat Logo) also holds a group named `Seam Fills` under its paths: for each color, a
stroke 1.5 image pixels wide (at the image's larger scale, when it is stretched more one way) with butt caps and round joins along the edges where a filled path of that color meets a
filled path drawn after it, in that color (a gradient path's stroke takes its gradient). Without it, a renderer that
anti-aliases each path on its own shows a light hairline along every shared edge. The traced paths and their shared
edges are the same with or without it, and edges against the image's border, a transparent area or a color left out
get no stroke. A trace whose paths have more than half of the trace's anchor limit (8,000,000, 2,000,000 on the web)
has no seam fills, so that paths and seam fills together stay within the limit. Both Expand commands keep the group, and `byColor` leaves it under every color's group. The strokes
are separate objects: after Expand, recoloring, moving or deleting a traced path leaves them as they are, and deleting
the group removes them. The reply's
`paths` and `anchors` count the traced paths only.
An Abutting trace with Fills (not Flat Logo) also holds a clip group named `Seam Fills` under its paths. For each
color it holds one stroke along the edges where a filled path of that color meets a filled path drawn after it, in
that color (a gradient path's stroke takes its gradient), with butt caps and round joins. The stroke is 1.5 image
pixels wide, VectorCraft's own width. On an image stretched more one way than another, the group holds each
stroke's outline in image pixels as a filled path instead; the outline covers 0.75 image pixels on each side of its
edge. The group clips the strokes or outlines to the image's box within the box of the traced paths, and its
bounds lie within that box. Where a shared edge ends at, or runs within 0.75 image pixels of, a
transparent area or a color left out, its stroke can reach up to 0.75 image pixels into that area. Paths that
became live shapes (`shapes`) take no part. The traced paths and their shared edges are the same with or without
the group. A trace whose paths have more than about half of the trace's anchor limit (8,000,000,
2,000,000 on the web) has no seam fills. Both Expand commands keep the group, and `byColor` leaves it under every
color's group; `byColor` refuses a trace whose seam fills' group was moved above a path. The strokes are separate
objects, in a trace and after Expand: recoloring, moving or deleting a traced path leaves them as they are, and
deleting the group removes them. The reply's `paths` and `anchors` count the traced paths only.
With `keepColors` in `params`, the reply's `warnings` name each listed color that no traced color matches, and say
when nothing was traced.
`noise` (Color, Grayscale and Black and White, not Flat Logo) merges areas smaller than that many pixels into a
+1 -1
View File
@@ -1545,7 +1545,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Image Trace, Document Library color groups:** with Document Swatches, the panel's Colors menu and `"colorGroup"` trace with one color group's colors instead of every swatch, as the public panel documentation describes Document Library; code-drawn tests in `crates/engine` and the panel.
- **Image Trace, Document Library colors:** with Document Swatches, traced fills and strokes use the displayed colors of process, global, spot and tint swatches without links, so editing a swatch leaves the trace unchanged; swatch-library colors are also unlinked; code-drawn tests in `crates/engine`.
- **Image Trace, flattened slivers:** in a Color, Grayscale or Black and White trace with Fills, a traced region whose outline straightens onto one line (a single pixel, or a one-pixel row along an edge, its pieces shared with the regions beside it) is left out instead of becoming a selectable path with no area, which paints nothing. Snap Curves To Lines straightens more outlines, so it leaves out more of these. Without Fills, the region's 1 px stroke draws it, and it is kept. Code-drawn tests in `crates/trace`.
- **Image Trace, Abutting seam fills:** an Abutting trace with Fills holds a `Seam Fills` group under its paths, with 1.5 px strokes along the edges two filled paths share, in the lower path's color (VectorCraft's own width), so renderers that anti-alias each path on its own show no light hairline along those edges. The paths and their shared edges are unchanged. Tests: `seam::tests` in `crates/trace`, `image_trace_abutting_seam_fills_sit_under_the_paths` in `crates/engine`. Scores and hours unchanged.
- **Image Trace, Abutting seam fills:** an Abutting trace with Fills holds a `Seam Fills` clip group under its paths, with strokes along the edges two filled paths share, in the lower path's color, 1.5 image pixels wide (VectorCraft's own width) and clipped to the image's box within the traced paths' box; on an image stretched more one way than another, each stroke's outline in image pixels is a filled path instead. The paths and their shared edges are unchanged. Tests: `seam::tests` in `crates/trace`, `image_trace_abutting_seam_fills_sit_under_the_paths` and `image_trace_seam_fills_on_a_stretched_image_stay_near_their_edge` in `crates/engine`.
- **Image Trace, Auto Color rare colours:** the Automatic palette keeps colours too rare for its area count when they are distinct (Oklab) and drawn as coherent regions, at most six, protected from mixed-colour merging and Noise; code-drawn stem, highlight, low-contrast and scattered-noise tests (see [quality notes](image-trace-quality.md#auto-color-keeps-rare-colours)).
- **Image Trace, nearly flat dark grounds:** with a Limited palette of 9 to 16 colors (16 Colors, and Document Library without swatches), by VectorCraft's own rule, a cut whose two sides both have a dark gray mean (Oklab lightness under 0.30, chroma under 0.03) and lie less than 0.03 apart in Oklab has its gain scaled by (distance / 0.03)². A near-black ground with faint noise then traces in one color, and the color it would have taken goes to another cut. Code-drawn tests `a_nearly_flat_dark_ground_keeps_one_color`, `only_a_limited_palette_of_nine_to_sixteen_colors_weighs_alike_sides` and `a_dark_colored_figure_on_a_nearly_flat_dark_ground_keeps_its_color` in `crates/trace`.
- **Image Trace, Document Library keeps neutral tones neutral:** each pixel takes the library color nearest in Oklab with differences in hue and chroma counted three times, so a gray or a muted brown traces as a neutral library color instead of a saturated one of similar lightness; a code-drawn test of gray and brown patches with a black, light and blue library in `crates/trace`.