mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-17 09:36:45 +00:00
Image Trace: Flat Logo traces a disc on a gray panel without slivers of a paler ground
When the colors of an image lie on one line, as a pale gray ground, a gray panel and a charcoal disc do, an edge pixel between the panel and the disc is also reproduced by a mix of the ground and the disc. Flat Logo switches such a pixel to the mix of the classes beside it only when its neighbors lie on both sides of the class it drops, which a class beyond both classes of the edge never satisfies. A charcoal disc on a gray panel on a paler ground traced with 28 slivers of the ground, of at most two pixels each, around it when its edges were sharp, and with one sliver when they were blurred by 0.7 pixel, with the colors found or named. A pixel now also takes the mix of the classes beside it when the class it drops lies beyond both of them on their line, the pixel's own neighbors lie on each side of it, no neighbor lies past the nearer of the two toward the dropped class, and a chain of neighbors, each nearer that class than the one before, leads from the pixel, in at most 6 steps, to that class's color or to a flat area of that class. A class named some levels off the color of its flat areas still counts. The pixels of a pale line on the disc, whether 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 mixes. An edge blurred by a pixel or more can still leave slivers of the ground. Docs: docs/image-trace-adjustments.md, docs/target-app-parity.md.
This commit is contained in:
@@ -1158,3 +1158,35 @@ fn a_noisy_hard_edged_gray_between_black_and_white_is_one_shape() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_disc_on_a_gray_panel_on_a_paler_ground_has_no_slivers_of_the_ground() {
|
||||
// The panel's gray lies on the line from the ground's gray to the disc's charcoal, so the disc's
|
||||
// edge pixels are also a mix of the ground and the disc.
|
||||
let (ground, panel, disc) = ([240, 240, 240], [200, 200, 200], [60, 60, 60]);
|
||||
for blur in [0.0, 0.7] {
|
||||
let grays = render(150, 150, blur, move |x, y| {
|
||||
let (cx, cy) = (x.clamp(35.0, 115.0), y.clamp(35.0, 115.0));
|
||||
Some(if (x - 75.0).hypot(y - 75.0) < 30.0 {
|
||||
disc
|
||||
} else if (20.0..130.0).contains(&x) && (20.0..130.0).contains(&y) && (x - cx).hypot(y - cy) < 15.0 {
|
||||
panel
|
||||
} else {
|
||||
ground
|
||||
})
|
||||
});
|
||||
for named in [false, true] {
|
||||
let logo_colors = if named { vec!["#F0F0F0".into(), "#C8C8C8".into(), "#3C3C3C".into()] } else { Vec::new() };
|
||||
let res = trace(&grays, &TraceParams { logo_colors, ..logo_params() });
|
||||
let paths: Vec<_> = res.paths.iter().map(|t| (t.color, t.pixels)).collect();
|
||||
assert_eq!(res.paths.len(), 3, "blur {blur}, named {named}: one path per color; {paths:?}");
|
||||
for k in 0..16 {
|
||||
let a = f64::from(k) * std::f64::consts::TAU / 16.0;
|
||||
let at = Point::new(75.0 + 31.0 * a.cos(), 75.0 + 31.0 * a.sin());
|
||||
assert_eq!(top_color(&res, at), Some(panel), "blur {blur}, named {named}: beside the disc at {at:?}");
|
||||
}
|
||||
assert_eq!(top_color(&res, Point::new(8.0, 75.0)), Some(ground), "blur {blur}, named {named}: the ground");
|
||||
assert_eq!(top_color(&res, Point::new(75.0, 75.0)), Some(disc), "blur {blur}, named {named}: the disc");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+159
-16
@@ -5,7 +5,8 @@
|
||||
//! runs, so each pixel is instead explained as a mix of at most three classes, whichever mix
|
||||
//! reproduces the pixel best. When another mix also reproduces it (with a gray between black and
|
||||
//! white among the classes, a black-to-white edge pixel is a mix of black and gray as well as of
|
||||
//! black and white), the pixel takes the mix whose classes lie nearest it in the flat areas around it,
|
||||
//! black and white, and a gray-to-black edge pixel is a mix of white and black as well as of gray
|
||||
//! and black), the pixel takes the mix whose classes lie nearest it in the flat areas around it,
|
||||
//! when its neighbors show an edge between those classes.
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
@@ -217,7 +218,7 @@ pub(crate) fn unmix(pix: &[Px], width: usize, height: usize, classes: &[[f64; 4]
|
||||
continue;
|
||||
}
|
||||
let Some(mixes) = mixed.get(&key) else { continue };
|
||||
let edges: Vec<&Weights> = mixes.tied.iter().filter(|m| across_edge(pix, width, height, i, classes, &mixes.best, m)).collect();
|
||||
let edges: Vec<&Weights> = mixes.tied.iter().filter(|m| across_edge(pix, &flat, (width, height), i, classes, &mixes.best, m)).collect();
|
||||
if edges.is_empty() {
|
||||
continue;
|
||||
}
|
||||
@@ -244,10 +245,24 @@ pub(crate) fn unmix(pix: &[Px], width: usize, height: usize, classes: &[[f64; 4]
|
||||
|
||||
/// Whether pixel `i` lies on an edge between the two classes of `other`, rather than in an area of
|
||||
/// a class of `best` that `other` leaves out: for each such class, the pixel has a neighbor beyond
|
||||
/// it toward each class of `other`, along the line between them. (A black-to-white edge pixel as
|
||||
/// light as a gray has a darker neighbor and a lighter one; a gray stroke on white has no neighbor
|
||||
/// darker than the gray.)
|
||||
fn across_edge(pix: &[Px], width: usize, height: usize, i: usize, classes: &[[f64; 4]], best: &Weights, other: &Weights) -> bool {
|
||||
/// it toward each class of `other`, along the line between them, or, for a class that lies beyond
|
||||
/// both classes of `other` on that line, 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; a gray stroke on white
|
||||
/// has no neighbor darker than 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.)
|
||||
fn across_edge(
|
||||
pix: &[Px],
|
||||
flat: &[Option<usize>],
|
||||
(width, height): (usize, usize),
|
||||
i: usize,
|
||||
classes: &[[f64; 4]],
|
||||
best: &Weights,
|
||||
other: &Weights,
|
||||
) -> bool {
|
||||
let [(a, _), (b, _)] = other.as_slice() else { return false };
|
||||
let (Some(ca), Some(cb)) = (classes.get(*a), classes.get(*b)) else { return false };
|
||||
let ab: [f64; 4] = std::array::from_fn(|j| cb[j] - ca[j]);
|
||||
@@ -262,21 +277,75 @@ fn across_edge(pix: &[Px], width: usize, height: usize, i: usize, classes: &[[f6
|
||||
let off = (0..4).map(|j| (v[j] - ca[j] - t * ab[j]).powi(2)).sum::<f64>().sqrt();
|
||||
(t, off)
|
||||
};
|
||||
let (x, y) = (i % width.max(1), i / width.max(1));
|
||||
let neighbors: Vec<f64> = (y.saturating_sub(1)..(y + 2).min(height))
|
||||
.flat_map(|yy| (x.saturating_sub(1)..(x + 2).min(width)).map(move |xx| yy * width + xx))
|
||||
.filter(|&j| j != i)
|
||||
.filter_map(|j| pix.get(j))
|
||||
.map(|q| place([f64::from(q[0]), f64::from(q[1]), f64::from(q[2]), f64::from(q[3])]))
|
||||
.filter(|&(_, off)| off <= 2.0 * PURE)
|
||||
.map(|(t, _)| t)
|
||||
.collect();
|
||||
// Where pixel `j` lies along the line, when it lies within `2 * PURE` of it.
|
||||
let at = |j: usize| {
|
||||
pix.get(j)
|
||||
.map(|q| place([f64::from(q[0]), f64::from(q[1]), f64::from(q[2]), f64::from(q[3])]))
|
||||
.filter(|&(_, off)| off <= 2.0 * PURE)
|
||||
.map(|(t, _)| t)
|
||||
};
|
||||
// The pixels around pixel `j`.
|
||||
let around = |j: usize| {
|
||||
let (x, y) = (j % width.max(1), j / width.max(1));
|
||||
(y.saturating_sub(1)..(y + 2).min(height))
|
||||
.flat_map(move |yy| (x.saturating_sub(1)..(x + 2).min(width)).map(move |xx| yy * width + xx))
|
||||
.filter(move |&n| n != j)
|
||||
};
|
||||
let neighbors: Vec<f64> = around(i).filter_map(at).collect();
|
||||
let left_out: Vec<usize> = best.iter().filter(|&&(c, w)| w > 0.0 && c != *a && c != *b).map(|&(c, _)| c).collect();
|
||||
// Whether the pixel has a neighbor on each side of place `t` along the line.
|
||||
let straddled = |t: f64| neighbors.iter().any(|&tn| (t - tn) * len > PURE) && neighbors.iter().any(|&tn| (tn - t) * len > PURE);
|
||||
// Whether pixel `j`, at place `t`, lies within `PURE` of class `c` (at place `to`), or in a flat
|
||||
// area of class `c` ([`flat_classes`]), or beside one and within `PURE` of its color along the
|
||||
// line (as when `c` is named some levels off the area's color).
|
||||
let touches = |j: usize, t: f64, c: usize, to: f64| {
|
||||
let in_c = |n: usize| flat.get(n).copied().flatten() == Some(c);
|
||||
(t - to).abs() * len <= PURE || in_c(j) || around(j).any(|n| in_c(n) && at(n).is_some_and(|tn| (tn - t).abs() * len <= PURE))
|
||||
};
|
||||
// Whether a chain of neighbors from the pixel, each nearer place `to` than the one before and
|
||||
// none past it (`past`), comes to class `c` ([`touches`]) in at most `NEARBY` steps. (From a
|
||||
// pixel beside a pale line's middle, the middle is the only neighbor nearer the gray, and it has
|
||||
// none, and it is far from the gray.)
|
||||
let reaches = |to: f64, c: usize, past: &dyn Fn(f64) -> bool| {
|
||||
let Some(t) = at(i) else { return false };
|
||||
let mut front = vec![(i, t)];
|
||||
let mut seen = HashSet::from([i]);
|
||||
for step in 0..=NEARBY {
|
||||
let mut next = Vec::new();
|
||||
for &(j, t) in &front {
|
||||
if touches(j, t, c, to) {
|
||||
return true;
|
||||
}
|
||||
if step < NEARBY {
|
||||
for n in around(j) {
|
||||
if let Some(tn) = at(n).filter(|&tn| !past(tn) && (tn - to).abs() < (t - to).abs())
|
||||
&& seen.insert(n)
|
||||
{
|
||||
next.push((n, tn));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if next.is_empty() {
|
||||
return false;
|
||||
}
|
||||
front = next;
|
||||
}
|
||||
false
|
||||
};
|
||||
!left_out.is_empty()
|
||||
&& left_out.iter().all(|&c| {
|
||||
let Some(&cv) = classes.get(c) else { return false };
|
||||
let (tc, _) = place(cv);
|
||||
neighbors.iter().any(|&t| (tc - t) * len > PURE) && neighbors.iter().any(|&t| (t - tc) * len > PURE)
|
||||
if straddled(tc) {
|
||||
return true;
|
||||
}
|
||||
if (0.0..=1.0).contains(&tc) {
|
||||
return false;
|
||||
}
|
||||
let beyond = |tn: f64| if tc < 0.0 { -tn * len > PURE } else { (tn - 1.0) * len > PURE };
|
||||
let (to, near) = if tc < 0.0 { (0.0, *a) } else { (1.0, *b) };
|
||||
!neighbors.iter().any(|&tn| beyond(tn)) && at(i).is_some_and(straddled) && reaches(to, near, &beyond)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -670,6 +739,80 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_edge_pixel_takes_no_class_beyond_both_classes_beside_it() {
|
||||
// A pale ground, a gray and a charcoal on one line: a row of flat gray, one edge pixel halfway
|
||||
// to charcoal, flat charcoal. The edge pixel is a mix of the gray and the charcoal, with none
|
||||
// of the ground in it.
|
||||
let g = |v: f64| [v / 255.0, v / 255.0, v / 255.0, 1.0];
|
||||
let classes = vec![g(240.0), g(200.0), g(60.0), [1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0]];
|
||||
let px = |v: f32| [v / 255.0, v / 255.0, v / 255.0, 1.0];
|
||||
let mut pix = vec![px(200.0); 5];
|
||||
pix.push(px(130.0));
|
||||
pix.extend([px(60.0); 5]);
|
||||
let (pl, _, _) = unmix(&pix, 11, 1, &classes);
|
||||
assert_eq!(pl[0][5], 0.0, "ground in the edge pixel");
|
||||
assert!((pl[1][5] - 0.5).abs() < 0.02 && (pl[2][5] - 0.5).abs() < 0.02, "gray {} charcoal {}", pl[1][5], pl[2][5]);
|
||||
// The cases below are vertical lines: three rows alike, read in the middle row.
|
||||
// The same edge with the panel's pixels three levels darker than the named gray.
|
||||
let mut pix = vec![px(197.0); 5];
|
||||
pix.push(px(130.0));
|
||||
pix.extend([px(60.0); 5]);
|
||||
let (pl, _, _) = unmix(&pix.repeat(3), 11, 3, &classes);
|
||||
assert_eq!(pl[0][11 + 5], 0.0, "ground in the edge pixel beside a gray three levels off");
|
||||
// An edge pixel whose lightest neighbor leads nowhere, with another chain of lighter pixels
|
||||
// to the gray.
|
||||
let outer = [vec![px(200.0); 5], vec![px(170.0)], vec![px(60.0); 7]].concat();
|
||||
let middle = [vec![px(200.0); 5], vec![px(170.0), px(130.0), px(180.0)], vec![px(60.0); 5]].concat();
|
||||
let (pl, _, _) = unmix(&[outer.clone(), middle, outer].concat(), 13, 3, &classes);
|
||||
assert_eq!(pl[0][13 + 6], 0.0, "ground in the edge pixel beside a dead end");
|
||||
// A pixel half ground and half charcoal between charcoal pixels, flat gray three pixels off:
|
||||
// a thin pale line on the charcoal, kept.
|
||||
let mut pix = vec![px(200.0); 3];
|
||||
pix.extend([px(60.0); 2]);
|
||||
pix.push(px(150.0));
|
||||
pix.extend([px(60.0); 5]);
|
||||
let (pl, _, _) = unmix(&pix.repeat(3), 11, 3, &classes);
|
||||
assert!((pl[0][11 + 5] - 0.5).abs() < 0.02, "the line: ground {}", pl[0][11 + 5]);
|
||||
// A gap of the ground's color one pixel wide between flat charcoal and flat gray: the pixel
|
||||
// half charcoal and half ground beside it keeps its ground.
|
||||
let mut pix = vec![px(60.0); 5];
|
||||
pix.extend([px(150.0), px(236.0)]);
|
||||
pix.extend([px(200.0); 5]);
|
||||
let (pl, _, _) = unmix(&pix.repeat(3), 12, 3, &classes);
|
||||
assert!((pl[0][12 + 5] - 0.5).abs() < 0.02, "the gap: ground {}", pl[0][12 + 5]);
|
||||
// A pale line blurred over three pixels on the charcoal, flat gray five pixels off: the pixels
|
||||
// beside its middle have a lighter neighbor and a darker one, and keep their ground.
|
||||
let mut pix = vec![px(200.0); 5];
|
||||
pix.extend([px(60.0); 3]);
|
||||
pix.extend([px(103.0), px(154.0), px(103.0)]);
|
||||
pix.extend([px(60.0); 9]);
|
||||
let (pl, _, _) = unmix(&pix.repeat(3), 20, 3, &classes);
|
||||
for j in [20 + 8, 20 + 10] {
|
||||
assert!((pl[0][j] - 43.0 / 180.0).abs() < 0.02 && pl[1][j] == 0.0, "the blurred line at {j}: ground {} gray {}", pl[0][j], pl[1][j]);
|
||||
}
|
||||
// A pale line one pixel wide that falls between two pixels, covering half of one and three
|
||||
// quarters of the other: both pixels keep their ground.
|
||||
let mut pix = vec![px(200.0); 5];
|
||||
pix.extend([px(60.0); 3]);
|
||||
pix.extend([px(150.0), px(195.0)]);
|
||||
pix.extend([px(60.0); 10]);
|
||||
let (pl, _, _) = unmix(&pix.repeat(3), 20, 3, &classes);
|
||||
for (j, want) in [(20 + 8, 0.5), (20 + 9, 0.75)] {
|
||||
let (ground, gray) = (pl[0][j], pl[1][j]);
|
||||
assert!((ground - want).abs() < 0.02 && gray == 0.0, "the line between pixels at {j}: ground {ground} gray {gray}");
|
||||
}
|
||||
// An edge from the gray to the charcoal blurred by 0.7 pixel: the pixels between take no
|
||||
// ground.
|
||||
let mut pix = vec![px(200.0); 5];
|
||||
pix.extend([px(199.97), px(197.8), px(166.7), px(93.3), px(62.2)]);
|
||||
pix.extend([px(60.0); 5]);
|
||||
let (pl, _, _) = unmix(&pix.repeat(3), 15, 3, &classes);
|
||||
for j in [15 + 7, 15 + 8] {
|
||||
assert_eq!(pl[0][j], 0.0, "the blurred edge at {j}: ground");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn row_distances_match_a_scan_of_the_window_around_each_pixel() {
|
||||
// Three classes scattered over 23 x 17 pixels, some pixels holding two, most none.
|
||||
|
||||
@@ -134,6 +134,19 @@ between pixels or is blurred traces as black and white. A flat area whose color
|
||||
some levels off, counts as holding the named colors it is a blend of, and so do the pixels of exactly
|
||||
its color that touch it.
|
||||
|
||||
The same holds when the left-out color lies beyond both colors of the edge, as a pale gray ground lies
|
||||
beyond a gray panel and a charcoal disc: an edge pixel between the panel and the disc is also a blend of
|
||||
the ground and the disc. Flat Logo reads it as a blend of the panel and the disc when, along the line
|
||||
through the three colors, the pixel has a neighbor on each side of it, no neighbor lies past the panel
|
||||
toward the ground, and a chain of neighbors, each nearer the panel's color than the one before, leads
|
||||
from the pixel, in at most 6 steps, to the panel's color or to a flat area of the panel. The same rule
|
||||
applies to a left-out color darker than both colors of the edge, and to colors that are not grays. A
|
||||
charcoal disc on a gray panel on a paler ground then traces with no slivers of the ground around it when
|
||||
its edges are sharp or 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, whether 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.
|
||||
|
||||
**Large images.** An image of more than 1500 pixels on a side is traced as any other, only more
|
||||
slowly, and the trace says so: `imageTrace.make` returns the note in `warnings` and the status bar
|
||||
shows it (the [results optimization](https://helpx.adobe.com/illustrator/using/image-trace-results-optimization.html)
|
||||
|
||||
@@ -1591,6 +1591,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- **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 (an edge blurred by a pixel or more, or pixel noise of a level or more, can still leave gray slivers); 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), and 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).
|
||||
While Crop Image shows its box, the Control bar also sets the cropped image's resolution (PPI: a list of 72, 96, 150, 200 and 300 ppi with the ones above the image's own disabled, or a typed value; at most the image's own, or 300 ppi for a linked image ([Crop Image](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=352))), a reference point that X and Y name and that W and H resize about, and a link that keeps W and H in proportion; `object.cropImage {ppi}` resamples the cut pixels and refuses a resolution above the limit, and `tool.setOption` sets `ppi`, `reference` and `linked` ([Crop images](https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/crop-images-in-illustrator.html)). The list's resolutions and the default (the image's own resolution, the center, unlinked) are VectorCraft's own.
|
||||
|
||||
Reference in New Issue
Block a user