diff --git a/crates/trace/src/logo/tests.rs b/crates/trace/src/logo/tests.rs index 4e152b0b8c..8d493d3a56 100644 --- a/crates/trace/src/logo/tests.rs +++ b/crates/trace/src/logo/tests.rs @@ -974,10 +974,12 @@ fn black_gray_white(gray: [u8; 3]) -> TraceParams { /// A black disc and a gray square on white, blurred by 1 to 3 pixels: the edge pixels around the /// disc as light as the gray read as blends of black and white, so the gray is one shape (the -/// square) and no gray lines the disc, with the colors found or named. At a blur of 3 pixels, with -/// the colors named, a gray of 128 is still one shape, a gray of 200 leaves 4 slivers of no area, -/// and a light gray (230) leaves at most 8 slivers, touching the disc's edge at no more than 4 of -/// 192 samples. (Without named colors, an image blurred by 3 pixels traces without its gray.) +/// square) and no gray lines the disc, with the colors found or named. A light gray (230) blurred by +/// 1.5 pixels leaves at most 4 slivers of up to 3 pixels, touching the disc's edge at no more than 4 +/// of 192 samples. At a blur of 3 pixels, with the colors named, a gray of 128 is still one shape, a +/// gray of 200 leaves 4 slivers of no area, and a light gray leaves at most 8 slivers, touching the +/// disc's edge at no more than 4 of 192 samples. (Without named colors, an image blurred by 3 pixels +/// traces without its gray.) #[test] fn blurred_black_edges_beside_gray_leave_no_gray_slivers() { const INK: [u8; 3] = [4, 4, 3]; @@ -1013,6 +1015,10 @@ fn blurred_black_edges_beside_gray_leave_no_gray_slivers() { grays.sort_unstable(); grays.pop(); match (gray[0], blur == 3.0) { + (230, false) if blur == 1.5 => { + assert!(grays.len() <= 4 && grays.iter().all(|&n| n <= 3), "{what}: slivers {grays:?}"); + assert!(rim <= 4, "{what}: {rim} of 192 samples along the disc's edge traced gray"); + } (230, true) => { assert!(grays.len() <= 8, "{what}: {} slivers; {paths:?}", grays.len()); assert!(rim <= 4, "{what}: {rim} of 192 samples along the disc's edge traced gray"); @@ -1031,15 +1037,26 @@ fn blurred_black_edges_beside_gray_leave_no_gray_slivers() { } } -/// A soft-edged gray band 2 to 4 pixels wide lying along a black disc, blurred by 1.5 or 2 pixels, -/// traces as black and white: its pixels are reached from the disc and from the white through -/// pixels that keep getting darker and lighter, as across a blurred black-to-white edge. A band 8 -/// pixels wide keeps at least half of its gray. With sharp edges every band stays gray. +/// A soft-edged gray band lying along a black disc traces as black and white, with at most one of +/// every 16 samples traced gray, when it is 2 to 4 pixels wide and blurred by 1.5 or 2 pixels, 2 or +/// 3 pixels wide and blurred by 3 pixels, or 2 pixels wide and blurred by 1 pixel: its pixels are +/// reached from the disc and from the white through pixels that keep getting darker and lighter, as +/// across a blurred black-to-white edge. A band 8 pixels wide keeps at least half of its gray at +/// blurs of 1 to 3 pixels. The bands 3 and 4 pixels wide of the three grays, blurred by 1 pixel, +/// keep about 60 of their 336 samples gray, and those 4 pixels wide, blurred by 3 pixels, about 39 +/// of 192. With sharp edges every band stays gray, and with edges blurred by 0.6 pixels a band 3 to +/// 8 pixels wide keeps at least 4 of every 5 samples gray, and the bands 2 to 4 pixels wide of the +/// three grays keep about 306 of their 432 samples gray: beside a sharp edge, a path that comes to a +/// pixel of the gray stops there. #[test] fn a_soft_gray_band_along_black_traces_as_black_and_white() { const INK: [u8; 3] = [4, 4, 3]; + // The samples traced gray over the three grays: of the bands 2 to 4 pixels wide blurred by 0.6 + // pixels, of the bands 3 and 4 pixels wide blurred by 1 pixel, and of the bands 4 pixels wide + // blurred by 3 pixels. + let (mut nearly_sharp, mut blur_one, mut blur_three) = (0, 0, 0); for gray in [[230u8, 230, 230], [200, 200, 200], [128, 128, 128]] { - for blur in [0.0, 1.5, 2.0] { + for blur in [0.0, 0.6, 1.0, 1.5, 2.0, 3.0] { for wide in [2u8, 3, 4, 8] { let img = render(120, 60, blur, |x, y| { Some(if (x - 25.0).hypot(y - 28.0) <= 18.0 { @@ -1058,25 +1075,48 @@ fn a_soft_gray_band_along_black_traces_as_black_and_white() { .count(); let all = 16 * usize::from(wide); let what = format!("gray {}, blur {blur}, {wide} px band: {kept} of {all} samples traced gray", gray[0]); + let lost = if blur == 1.0 { + wide <= 2 + } else if blur == 3.0 { + wide <= 3 + } else { + wide <= 4 + }; if blur == 0.0 { assert_eq!(kept, all, "{what}"); - } else if wide <= 4 { - assert_eq!(kept, 0, "{what}"); - } else { + } else if blur == 0.6 { + if wide >= 3 { + assert!(5 * kept >= 4 * all, "{what}"); + } + if wide <= 4 { + nearly_sharp += kept; + } + } else if lost { + assert!(16 * kept <= all, "{what}"); + } else if wide == 8 { assert!(2 * kept >= all, "{what}"); + } else if blur == 1.0 { + blur_one += kept; + } else if blur == 3.0 { + blur_three += kept; } } } } + assert!((300..=312).contains(&nearly_sharp), "bands 2 to 4 px wide blurred by 0.6 px: {nearly_sharp} of 432 samples traced gray"); + assert!((56..=64).contains(&blur_one), "bands 3 and 4 px wide blurred by 1 px: {blur_one} of 336 samples traced gray"); + assert!((36..=42).contains(&blur_three), "bands 4 px wide blurred by 3 px: {blur_three} of 192 samples traced gray"); } /// A soft-edged gray spoke two or three pixels wide running straight out of a black disc, blurred -/// by 1 or 1.5 pixels, loses 3 or 4 of its 16 samples nearest the disc and keeps the rest. +/// by 1 or 1.5 pixels, loses 3 or 4 of its 16 samples nearest the disc and keeps the rest. Blurred +/// by 2 pixels, a spoke three pixels wide loses 2 or 3 of them, and one two pixels wide traces as +/// black and white along its whole length. #[test] fn a_soft_gray_spoke_loses_a_few_pixels_where_it_meets_black() { const INK: [u8; 3] = [4, 4, 3]; for gray in [[230u8, 230, 230], [128, 128, 128]] { - for blur in [1.0, 1.5] { + for blur in [1.0, 1.5, 2.0] { for wide in [2.0, 3.0] { let img = render(120, 60, blur, |x, y| { Some(if (x - 25.0).hypot(y - 28.0) <= 18.0 { @@ -1092,7 +1132,12 @@ fn a_soft_gray_spoke_loses_a_few_pixels_where_it_meets_black() { let near = (44..60).filter(|&x| top_color(&res, at(x)) == Some(gray)).count(); let far = (60..86).filter(|&x| top_color(&res, at(x)) == Some(gray)).count(); let what = format!("gray {}, blur {blur}, {wide} px spoke", gray[0]); - assert!((12..=13).contains(&near), "{what}: {near} of the 16 samples nearest the disc traced gray"); + if blur == 2.0 && wide == 2.0 { + assert_eq!(near + far, 0, "{what}: {near} and {far} samples traced gray"); + continue; + } + let kept = if blur == 2.0 { 13..=14 } else { 12..=13 }; + assert!(kept.contains(&near), "{what}: {near} of the 16 samples nearest the disc traced gray"); assert_eq!(far, 26, "{what}: the rest of the spoke"); } } @@ -1100,8 +1145,8 @@ fn a_soft_gray_spoke_loses_a_few_pixels_where_it_meets_black() { } /// A soft-edged light gray stroke 2 pixels wide beside a black disc, blurred by 1.5 pixels: 2 -/// pixels from the disc it keeps less than half of its gray, 4 pixels away it loses a few pixels, -/// and 6 or 8 pixels away it keeps all of it. +/// pixels from the disc it keeps about 10 of its 34 samples gray, 4 pixels away about 25, and 6 or +/// 8 pixels away all of them. #[test] fn a_soft_gray_stroke_near_black_loses_gray_by_its_distance() { const INK: [u8; 3] = [4, 4, 3]; @@ -1121,8 +1166,8 @@ fn a_soft_gray_stroke_near_black_loses_gray_by_its_distance() { let kept = (12..46).filter(|&y| top_color(&res, Point::new(x0 + 1.0, f64::from(y) + 0.5)) == Some(GRAY)).count(); let what = format!("{gap} px from the disc: {kept} of 34 samples traced gray"); match gap { - 2 => assert!(2 * kept < 34, "{what}"), - 4 => assert!((24..34).contains(&kept), "{what}"), + 2 => assert!((7..=13).contains(&kept), "{what}"), + 4 => assert!((22..=28).contains(&kept), "{what}"), _ => assert_eq!(kept, 34, "{what}"), } } diff --git a/crates/trace/src/logo/unmix.rs b/crates/trace/src/logo/unmix.rs index 7080b78701..048c8fac71 100644 --- a/crates/trace/src/logo/unmix.rs +++ b/crates/trace/src/logo/unmix.rs @@ -256,17 +256,23 @@ pub(crate) fn unmix(pix: &[Px], width: usize, height: usize, classes: &[[f64; 4] /// a class of `best` that `other` leaves out. For a class left out that lies between the classes of /// `other` on the line between them, a path of pixels from `i` that keeps going toward one class of /// `other` gets past the class left out within [`WALK`] steps through the eight neighbors, and so -/// does one that keeps going toward the other. For a class left out that lies beyond both classes of -/// `other` on that line, the pixel has a neighbor on each side of that class, or a neighbor on each -/// side of the pixel itself, none past the class of `other` nearer the class left out, and a chain -/// of neighbors from the pixel to that nearer class or a flat area of it (`flat`), each nearer it -/// than the one before. (A black-to-white edge pixel as light as a gray has a darker neighbor and a -/// lighter one, or, on an edge blurred over several pixels, reaches darker and lighter pixels through -/// pixels that keep getting darker or lighter; from a gray stroke on white, a path that keeps getting -/// darker ends in the stroke, at the gray; a gray-to-black edge pixel has a lighter neighbor and a -/// darker one, and lighter pixels lead to the flat gray; a pale line one pixel wide on black has only -/// darker neighbors; the pixels beside a blurred pale line's middle reach no flat gray; and a white -/// gap between black and gray has a neighbor lighter than the gray.) +/// does one that keeps going toward the other. When the first step of one path comes to a pixel +/// that stands for its class of `other` (the edge on that side is sharp), the other path stops at +/// a pixel within [`PURE`] of the class left out that it comes to before it gets past that class. +/// For a class left out that lies beyond both classes of `other` on that line, the pixel has a +/// neighbor on each side of that class, or a neighbor on each side of the pixel itself, none past +/// the class of `other` nearer the class left out, and a chain of neighbors from the pixel to that +/// nearer class or a flat area of it (`flat`), each nearer it than the one before. +/// +/// (A black-to-white edge pixel as light as a gray has a darker neighbor and a lighter one, or, on +/// an edge blurred over several pixels, reaches darker and lighter pixels through pixels that keep +/// getting darker or lighter; from a gray stroke on white, a path that keeps getting darker ends in +/// the stroke, at the gray; from the outer pixels of a gray band along black, with nearly sharp +/// edges, the first step outward is white and the path toward black comes to the band's gray; a +/// gray-to-black edge pixel has a lighter neighbor and a darker one, and lighter pixels lead to the +/// flat gray; a pale line one pixel wide on black has only darker neighbors; the pixels beside a +/// blurred pale line's middle reach no flat gray; and a white gap between black and gray has a +/// neighbor lighter than the gray.) /// /// When it does, the number of steps the longer of the two paths takes to a pixel that stands for its /// class of `other` (`stands_for`), the largest over the classes left out. It is `NEARBY + 1` when a @@ -350,26 +356,40 @@ fn across_edge( } false }; - // A path from `i` toward `a` (`toward` -1) or `b` (`toward` 1): each step goes to the neighbor - // near the line that lies farthest that way, while it lies farther than the pixel before (the - // first step is taken whatever `i` itself is). `None` when it does not get more than `PURE` past - // `tc` in [`WALK`] steps; otherwise the steps to the first pixel past it that stands for `class` - // (`stands_for`), or `NEARBY + 1`. - let walk = |toward: f64, tc: f64, class: usize| { + // Whether pixel `j` comes within `PURE` of class `c`. + let within = |j: usize, c: usize| { + let (Some(q), Some(cv)) = (pix.get(j), classes.get(c)) else { return false }; + (0..4).map(|k| (f64::from(q[k]) - cv[k]).powi(2)).sum::().sqrt() < PURE + }; + // The neighbor of pixel `j` near the line that lies farthest toward `a` (`toward` -1) or `b` + // (`toward` 1), with its place. + let next = |j: usize, toward: f64| around(j).filter_map(|n| at(n).map(|tn| (n, tn))).max_by(|p, q| (p.1 * toward).total_cmp(&(q.1 * toward))); + // A path from `i` toward `a` or `b`: each step goes to [`next`], while it lies farther than the + // pixel before (the first step is taken whatever `i` itself is). `None` when it does not get more + // than `PURE` past `tc` in [`WALK`] steps; otherwise the steps to the first pixel past it that + // stands for `class` (`stands_for`), or `NEARBY + 1`. With `halt`, the path also ends at a pixel + // within `PURE` of that class that it comes to before it gets past `tc`. + let walk = |toward: f64, tc: f64, class: usize, halt: Option| { let (mut cur, mut t) = (i, f64::NEG_INFINITY * toward); let mut past = false; for step in 1..=WALK { - match around(cur).filter_map(|j| at(j).map(|tj| (j, tj))).max_by(|p, q| (p.1 * toward).total_cmp(&(q.1 * toward))) { + match next(cur, toward) { Some((j, tj)) if (tj - t) * toward > 0.0 => (cur, t) = (j, tj), _ => break, } past = past || (t - tc) * toward * len > PURE; + if !past && halt.is_some_and(|h| within(cur, h)) { + break; + } if past && stands_for.get(cur).copied().flatten() == Some(class) { return Some(step); } } past.then_some(NEARBY + 1) }; + // Whether the first step of a path toward `class` (`toward` as in [`walk`]) comes to a pixel that + // stands for it: the edge on that side is sharp. + let sharp = |toward: f64, class: usize| next(i, toward).is_some_and(|(j, _)| stands_for.get(j).copied().flatten() == Some(class)); if left_out.is_empty() { return None; } @@ -377,8 +397,9 @@ fn across_edge( for &c in &left_out { let (tc, _) = place(*classes.get(c)?); if (0.0..=1.0).contains(&tc) { - let ra = walk(-1.0, tc, *a)?; - let rb = walk(1.0, tc, *b)?; + // When one side's edge is sharp, the other side's path stops at a pixel of the class left out. + let ra = walk(-1.0, tc, *a, sharp(1.0, *b).then_some(c))?; + let rb = walk(1.0, tc, *b, sharp(-1.0, *a).then_some(c))?; reach = reach.max(ra.max(rb)); continue; } diff --git a/docs/image-trace-adjustments.md b/docs/image-trace-adjustments.md index c679ec3105..6d2357dbe3 100644 --- a/docs/image-trace-adjustments.md +++ b/docs/image-trace-adjustments.md @@ -123,29 +123,41 @@ lies on an edge between them and that blend lies nearer the pixel than the blend The pixel lies on such an edge when, along the line between the outer two colors, it reaches a pixel darker than the middle color in at most 5 steps, each to the neighbor that lies farthest toward the darker color while the pixels keep getting darker, and reaches a pixel lighter than the middle color the -same way. A blend lies as near the pixel as the farther of its colors' nearest flat areas within 6 -pixels. The blend of the outer two also lies as near as the larger of the two step counts to a pixel of -each outer color, when that number is smaller. +same way. When the first step toward one outer color comes to a pixel that is less than half as far from +that color as from any other traced color, the path toward the other outer color stops at the first +pixel within 4 levels (out of 255) of the middle color that it comes to before it gets past the middle +color. A blend lies as near the pixel as the farther of its colors' nearest flat areas within 6 pixels. +The blend of the outer two also lies as near as the larger of the two step counts, when that number is +smaller. Each path counts its steps to the first pixel past the middle color that is less than half as +far from that path's outer color as from any other traced color. A black disc beside a gray square on white traces with one gray shape, the square, and no gray slivers around the disc, when its edges are sharp or blurred by up to 2 pixels, with the colors found or named. -With the colors named and edges blurred by 3 pixels, a gray of 128 is still one shape, a gray of 200 -leaves 4 slivers with no area, and a light gray (230) leaves 8 slivers of up to 21 pixels. An image with -noise of a level or more in its pixels can still leave gray slivers along the disc. +A light gray (230) blurred by 1.5 pixels leaves up to 4 slivers of up to 3 pixels. With the colors named +and edges blurred by 3 pixels, a gray of 128 is still one shape, a gray of 200 leaves 4 slivers with no +area, and a light gray leaves 8 slivers of up to 21 pixels. An image with noise of a level or more in its +pixels can still leave gray slivers along the disc. With sharp edges, a gray stroke two or three pixels wide beside black has no darker pixel next to it and -stays gray, and so does a gray band along black. On edges blurred by a pixel or more, gray near black -loses some of its pixels. A soft-edged gray band up to 4 pixels wide lying along black traces as black -and white at blurs of 1.5 and 2 pixels, and so does one up to 3 pixels wide at blurs of 1 and 3 pixels; a -wider band loses some of its pixels next to black, and one 8 pixels wide keeps at least half of its gray -at blurs of 1.5 and 2 pixels. A soft-edged gray stroke 2 pixels from black can lose some or all of its -gray, one 4 pixels from black loses a few pixels (a light gray stroke 2 pixels wide, blurred by 1.5 -pixels, keeps 28 of 34), and the pixels of one 6 pixels or more from black do not reach black in 5 steps -and are not read as an edge of black and white. A soft-edged gray -stroke 2 or 3 pixels wide running straight out of black, blurred by 1 or 1.5 pixels, loses 3 or 4 of -the 16 pixels nearest black. A soft-edged gray stroke about two -pixels wide that touches black traces as black and white, and one about three pixels wide that touches -black can lose most or all of its gray when it is short (12 pixels long or less). A line of gray one +stays gray, and so does a gray band along black. The counts below are of pixel centers that trace gray. +With edges blurred by 0.6 pixels, as by ordinary anti-aliasing, a gray band 3 to 8 pixels wide along +black traces gray at no fewer than 4 of every 5 of its pixel centers. On edges blurred by a pixel or +more, gray near black traces gray at fewer of its pixel centers. A soft-edged gray band along black +traces as black and white, with gray at no more than 1 of every 16 of its pixel centers, when it is up +to 4 pixels wide at blurs of 1.5 and 2 pixels, up to 3 pixels wide at a blur of 3 pixels, or 2 pixels +wide at a blur of 1 pixel. A wider band loses some or most of its gray next to black. Bands 3 and 4 +pixels wide blurred by 1 pixel trace gray at about 60 of their 336 pixel centers (over grays of 230, 200 +and 128), bands 4 pixels wide blurred by 3 pixels at about 39 of 192, and a band 8 pixels wide at no +fewer than half of its pixel centers at blurs of 1 to 3 pixels. A light gray stroke 2 pixels wide, +blurred by 1.5 pixels, traces gray at about 10 of the 34 pixel centers along its middle when it lies 2 +pixels from black and at about 25 when it lies 4 pixels away. At 6 or 8 pixels from black it traces gray +at all 34: its pixels do not reach black in 5 steps and are not read as an edge of black and white. A +soft-edged gray stroke 2 or 3 pixels wide running straight out of black, blurred by 1 or 1.5 pixels, +loses 3 or 4 of the 16 pixel centers along its middle nearest black. Blurred by 2 pixels, one 3 pixels +wide loses 2 or 3 of them, and one 2 pixels wide traces as black and white along its whole length. A +soft-edged gray stroke about two pixels wide lying along black traces as black and white, and one about +three pixels wide lying along black can lose most or all of its gray when it is short (12 pixels long or +less). A line of gray one pixel wide between black and white stays gray when at least 13 of its pixels touch: such a line and a straight black-to-white edge whose pixels are as light as the gray give the same pixels, and both trace as gray. A one-pixel gray line between black and white that is shorter than 13 pixels, falls diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e5e7943200..329d09de56 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1635,7 +1635,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Image Trace Flat Logo mode:** a fourth mode beside Black and White, Grayscale and Color, for flat-colour logos. Each pixel is read as a blend of the logo's colours (found automatically or named), the blend is interpolated smoothly and every outline is placed where two colours are equally present, so edges are accurate to a fraction of a pixel. Outlines are then cleaned: corners the blur rounded are put back, near-straight runs and near-circular arcs become exact lines and arcs, the rest is fitted with as few Béziers as the tolerance allows, touching colours overlap by a hair so no gap opens, and an outline that strays from the raw contour is fitted plainly instead. Gradients and photos are refused with advice to use Color. Line art whose only solid area is white paper (strokes a pixel or two wide) takes its colours from the strokes' cores, with the lighter shades along a stroke's anti-aliased edge folded into its ink; a page whose ink (a channel at least 48 below white) covers under 1% of it traces to nothing, as blank paper does. *Measured* (a local experiment, not run in CI): a flat-colour logo's vector original was rendered down to a soft 199 × 100 px transparent PNG, traced, and the result compared with the original at 1600 px wide. The built-in colour presets (6 Colors, 16 Colors, High Fidelity Photo, Low Fidelity Photo) had a mean edge error of 2.5 to 3.4 px and region overlap of 0.88 to 0.91; Flat Logo had 0.78 px and 0.966 (0.48 px and 0.975 from a crisp source), in about 0.1 s. Limits: flat-colour art only; needle-thin sharp tips are shortened by about 1.7 source pixels because the blur erases them; it works at no more than 1024 px on the long side (larger images are averaged down first); only one logo family has been scored against a vector original. - **Image Trace, Flat Logo named colors only:** with `logoColors` named, `"logoWhite": false` traces those colors only, so white areas take the nearest of them and no white is added; a named white is kept, and enclosed transparent areas stay holes; code-drawn tests in `crates/trace` and `crates/engine`. - **Image Trace, Flat Logo flat-art check with named colors:** with `logoColors` named, whether the image is flat art is judged by its own colors, as many as are named, with white, or as the Colors setting gives, whichever is more. Named colors 20 levels off a flat badge's colors still trace it, a hatch on a light ground gives the same result with close and far named colors, a gradient's refusal score does not depend on how far the named colors are from it, and areas of colors that were not named are traced in the named colors instead of being refused; code-drawn tests in `crates/trace`. -- **Image Trace, Flat Logo with a color between two others:** an anti-aliased edge pixel between black and white is read as a blend of black and white, not of black and a gray that lies between them, when the flat areas around it and the pixels beside it show that edge, so a black disc beside a gray square on white, with sharp edges or edges blurred by up to about half a pixel, traces with one gray path, the square, instead of the square plus 8 to 24 gray slivers around the disc with the colors found or named exactly; on edges blurred by 1 to 3 pixels, the pixel also counts as on that edge when paths of up to 5 steps through pixels that keep getting darker and lighter reach past the gray both ways, and black and white then lie as near as the steps to them, so the same disc and square trace with one gray path at blurs of 1 to 2 pixels, where up to 33 gray paths were traced before (at a blur of 3 pixels with the colors named, a gray of 200 leaves 4 slivers with no area and a light gray of 230 leaves 8 small slivers, against 11 and 14 gray paths before; pixel noise of a level or more can still leave gray slivers); with sharp edges, gray strokes two and three pixels wide beside black stay gray (a soft-edged gray stroke about two pixels wide that touches black traces as black and white, and a short one about three pixels wide can lose most or all of its gray); on edges blurred by a pixel or more, a soft-edged gray band up to 4 pixels wide along black traces as black and white at blurs of 1.5 and 2 pixels, a soft-edged gray stroke 2 pixels from black can lose some or all of its gray and one 4 pixels away a few pixels, and a soft-edged gray stroke running out of black loses 3 or 4 pixels where it meets black; a one-pixel gray line of at least 13 touching pixels between black and white stays gray (a shorter one, or one that falls between pixels or is blurred, traces as black and white); code-drawn tests in `crates/trace`. +- **Image Trace, Flat Logo with a color between two others:** an anti-aliased edge pixel between black and white is read as a blend of black and white, not of black and a gray that lies between them, when the flat areas around it and the pixels beside it show that edge, so a black disc beside a gray square on white, with sharp edges or edges blurred by up to about half a pixel, traces with one gray path, the square, instead of the square plus 8 to 24 gray slivers around the disc with the colors found or named exactly; on edges blurred by 1 to 3 pixels, the pixel also counts as on that edge when paths of up to 5 steps through pixels that keep getting darker and lighter reach past the gray both ways, and black and white then lie as near as the steps to them, so the same disc and square trace with one gray path at blurs of 1 and 2 pixels and with at most 4 slivers of up to 3 pixels in a light gray at 1.5 pixels, where up to 33 gray paths were traced before (at a blur of 3 pixels with the colors named, a gray of 200 leaves 4 slivers with no area and a light gray of 230 leaves 8 small slivers, where 11 and 14 gray paths were traced before; pixel noise of a level or more can still leave gray slivers); when the first step toward black or white already comes to that color, the path the other way stops at a pixel of the gray, so with edges blurred by 0.6 pixels a gray band 3 to 8 pixels wide along black traces gray at no fewer than 4 of every 5 of its pixel centers; with sharp edges, gray strokes two and three pixels wide beside black stay gray (a soft-edged gray stroke about two pixels wide lying along black traces as black and white, and a short one about three pixels wide can lose most or all of its gray); on edges blurred by a pixel or more, a soft-edged gray band up to 4 pixels wide along black traces as black and white, with gray at no more than 1 of every 16 of its pixel centers, at blurs of 1.5 and 2 pixels, a light gray stroke 2 pixels wide and 2 pixels from black, blurred by 1.5 pixels, traces gray at about 10 of the 34 pixel centers along its middle and one 4 pixels away at about 25, and a soft-edged gray stroke running out of black, blurred by 1 or 1.5 pixels, loses 3 or 4 of the 16 pixel centers along its middle nearest black; a one-pixel gray line of at least 13 touching pixels between black and white stays gray (a shorter one, or one that falls between pixels or is blurred, traces as black and white); code-drawn tests in `crates/trace`. - **Image Trace, Flat Logo with a color beyond both colors of an edge:** an edge pixel between a gray panel and a charcoal disc on a paler gray ground is read as a blend of the panel and the disc, not of the ground and the disc, when the pixels beside it lie on each side of it, none lies past the panel toward the ground, and lighter pixels lead from it to the panel's color or to a flat area of the panel, so the disc traces with three paths, one per color, with the colors found or named, instead of with 28 slivers of the ground around it when its edges are sharp and one sliver when they are blurred by 0.7 pixel (an edge blurred by a pixel or more can still leave slivers of the ground); the pixels of a pale line on the disc, one pixel wide, blurred over three pixels or falling between two pixels, and the edge of a gap of the ground's color between the disc and the panel keep the ground in their blends; code-drawn tests in `crates/trace`. - **Image Trace, Keep Colors:** `"keepColors": ["#rrggbb", …]` traces only the palette colors near a listed color (Abutting: each with the paths the trace of every color gives it; Overlapping: not reaching under the colors left out), in Black and White, Grayscale and Color; code-drawn tests in `crates/trace` and `crates/engine`. - **Advanced art:** live Blends (steps/distance/smooth colour, editable spine, anchor-targeted Blend tool, faithful interpolation, knockout), Envelope Distort (warp/mesh/top object, Reset, full Envelope Options, mesh handles, Edit Contents; type, images, symbols, gradients, patterns and appearance distorted everywhere), Liquify tools with options and pen pressure, Puppet Warp with rotating pins, Perspective Grid with presets, movable planes and projected type (choosing a perspective tool shows the grid; Hide Grid hides it with the tool still chosen), Gradient Mesh, Shape Builder (stroke-only open paths and lines cut the regions they cross and enclose regions of their own, and regions they bound merge without seams where the lines cross at rounded coordinates (#893); filled open paths count as closed; erase mode while Alt/Option is held: a minus pointer, red highlights of what will go, a click or drag deletes the regions touched, the pieces of open lines and the edges (outline pieces between the points where paths meet, opening their paths there) it passes over, one undo step, `shapeBuilder.merge {erase}` and `shapeBuilder.regions` edges over MCP), Live Paint (every path an edge, open lines included), Image Trace (12 presets, colour layers traced in parallel; a trace past two million anchor points is refused with advice rather than running out of memory, an image over 64 megapixels is traced scaled down to that size (aspect kept, paths at the image's own size) and one over 192 megapixels is refused, and a selection too large to outline shows its bounds (#525); Object › Image Trace › Make and Make and Expand trace at once with the Default preset, #543; with an image selected the Control bar and the Properties panel show Image Trace, whose arrow traces with any preset, Mask (`object.maskImage`: a clipping path on the image's outline, selected so its handles crop), Crop Image (a crop box on the image, starting on its part over the artboard, dragged by its handles or inside it, the outside dimmed, with X/Y/W/H, Apply and Cancel in the Control bar, Enter and Escape, #734; an image that isn't turned or skewed, isn't CMYK and can be read at its recorded size is cut from its own pixels when the crop edges fall on its pixel grid, copied as they are without resampling; any other image is drawn, #5534; `object.cropImage {rect}` for agents, `{trim: true}` cuts an image to its pixels that aren't fully transparent, pixel for pixel) and Embed or Unembed in place of Fill and Stroke; with an Image Trace object selected, its Preset (choosing another traces again), View, the Image Trace panel and Expand, plus Release in Properties; the five View modes (Tracing Result, with Outlines, Outlines, Outlines with Source Image, Source Image) redraw a trace on screen without tracing again, are saved with it and `imageTrace.setView` sets them, while exports and Expand keep the result; the panel's Advanced section is a header that stays open or closed as it was left (part of #641); Color mode's Palette: Limited, Full Tone (as many colours as the tones need, Less … More), Automatic (flat art with its own colours, else Full Tone; a heuristic) and Document Library (the most used colours of the document's swatches or a swatch library, filled with the swatch colours as they are), part of #641; Advanced › Create: Fills and/or Strokes, where lines up to the Stroke width trace as stroked centre lines (distance transform, thinning, a skeleton graph with spurs pruned, curve fitting; one width per line; without Fills, wider areas become stroked outlines), part of #641), pattern swatches with pattern editing mode, live Repeat (radial/grid/mirror). A single selected mirror repeat shows a prominent axis with a center move handle and two rotation handles. Drag the line or center to change spacing, or an end to change angle; Shift snaps rotation to 45°. The original artwork stays in place, the reflected copy previews live, Escape cancels and each drag takes one undo step through `object.repeat.options`. Controls follow zoom/view rotation and hide with edges or the bounding box. Engine and headless canvas regressions passed for gestures, history and visibility; native move, rotation and Escape screenshots were reviewed. [Public mirror-repeat reference](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/set-mirror-repeat-options.html). A single selected grid repeat shows a handle below the grid for rows, one right of it for columns and one past its bottom-right corner for both, and sliders between its first two columns and rows for the horizontal and vertical spacing; the source keeps its size, each drag is one undo step and Escape cancels it ([public grid-repeat reference](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/set-grid-repeat-options.html), #2691). Object › Expand turns radial, grid and mirror repeats into groups of their instances (#1765, #1756).