Links: Relink, Embed and Unembed keep a distorted image's corners

An image changed by Perspective Distort or Free Distort was refused by
Relink, Embed and Unembed. Each now keeps the image's corners in one
undo step:

- Relink puts the new file's pixels between the corners, as Update
  Links does, whatever `preserve` or the image's Placement Options say.
- Embed keeps the file's pixels in the document between the corners,
  reading the file first when the image shows its saved preview.
- Unembed writes the pixels to the file and links the image to it with
  the same corners. Unembed into a folder keeps the corners too.

Relink and Update Links also follow the clipping path a PSD, PSB or DCS
file names for a distorted image: the path is drawn through the corners,
a clip group of the old file's path takes the new file's, and it becomes
a plain group when the new file names none.

Unembed of an image from a PSD or PSB file took away the clip group of
the file's clipping path, plain images included: the PNG or TIFF it
writes keeps the path, but the file was read without it. A PNG or TIFF
that keeps the path now comes with it when it is read, so Unembed, and a
later Place, Relink or Update Links of the written file, keep the clip
group.

The params text of Relink, Embed and Unembed, docs/mcp.md and the
progress-doc line describe the new behavior.
This commit is contained in:
dotCooCoo committed 2026-11-17 21:02:14 -08:00
1 parent d99fcc5cec
commit 568f0f2168
7 files changed
+369 -49

No files matched your search

+6 -3
View File
@@ -962,7 +962,8 @@ pub(crate) fn size_note(bytes: &[u8]) -> Option<String> {
/// TIFF ([`vectorcraft_doc::cmyk::turned_cmyk`]). An image the decoder reads and that is stored as
/// PNG keeps its gray or RGB samples at 8 or 16 bits, and the gray or RGB ICC profile they are in;
/// other samples become 8-bit RGBA. A PSD/PSB composite's stored image keeps its imported
/// clipping path ([`image_clip`]).
/// clipping path ([`image_clip`]), and a PNG or TIFF that keeps such a path (as Unembed writes
/// it) comes with it.
pub fn raster_image(bytes: &[u8]) -> Result<RasterImage> {
let ppi = super::ppi::resolution(bytes);
if let Some((w, h)) = vectorcraft_doc::cmyk::oversized_tiff(bytes) {
@@ -1139,13 +1140,15 @@ pub fn texture_image(bytes: &[u8]) -> Result<String> {
texture.and_then(|t| t.to_stored()).ok_or_else(|| err("the image can't be read as a texture"))
}
/// An image's encoded `bytes`, `width` × `height` pixels, ready to embed.
/// An image's encoded `bytes`, `width` × `height` pixels, ready to embed, with the clipping path a
/// PNG or TIFF made from a PSD or PSB file keeps ([`image_clip`]).
fn stored(bytes: Vec<u8>, mime: &'static str, (width, height): (u32, u32), ppi: Option<(f64, f64)>) -> Result<RasterImage> {
if width == 0 || height == 0 {
return Err(err("the image is empty"));
}
let blob = ImageBlob::new(mime, bytes);
Ok(RasterImage { key: blob.content_key(), blob, width, height, ppi, clip: None })
let clip = image_clip(&blob).map(|path| (path, vectorcraft_geom::FillRule::EvenOdd));
Ok(RasterImage { key: blob.content_key(), blob, width, height, ppi, clip })
}
/// The keyword of the PNG text chunk holding the clipping path of the file a PNG was made from
@@ -602,6 +602,101 @@ fn relink_and_update_follow_the_clipping_path_of_a_linked_psd() {
assert_eq!(clip_group(&s.doc().unwrap().doc, group), (squared, true, NodeId(image)), "links.update reads the clipping path again");
}
/// links.relink follows the clipping path of a linked PSD file for an image changed by Perspective
/// Distort or Free Distort too: the new file's clipping path is mapped through the image's corners,
/// a clip group of the old file's clipping path loses it when the new file names none, and a later
/// file's clipping path clips it again.
#[test]
fn relink_follows_the_clipping_path_of_a_distorted_psd() {
let dir = vectorcraft_testkit::TempDir::new("psd-relink-distorted");
let cut = write_file(&dir, "cut.psd", &red_psd(&triangle_resources()));
let square = write_file(&dir, "square.psd", &red_psd(&square_resources()));
let plain = write_file(&dir, "plain.psd", &red_psd(&[]));
let mut s = Session::new();
s.execute("file.new", &json!({"width": 100, "height": 50})).unwrap();
let r = s.execute("file.place", &json!({"path": cut, "at": [50, 25]})).unwrap();
let (group, image) = (NodeId(r["ids"][0].as_u64().unwrap()), NodeId(r["image"].as_u64().unwrap()));
s.execute("select.set", &json!({"ids": [group.0]})).unwrap();
s.execute("object.distort", &json!({"corners": [[0, 0], [100, 8], [90, 50], [6, 44]]})).unwrap();
let node = |s: &Session| s.doc().unwrap().doc.node(image).unwrap().clone();
assert!(node(&s).is_distorted_image());
let corners = node(&s).image_corners().unwrap();
// A path's anchors (in the image's pixels) where the image's corners put them.
let mapped = |s: &Session, pixels: &[[f64; 2]]| -> Vec<[f64; 2]> {
let map = node(s).image_map().unwrap();
pixels.iter().map(|[x, y]| map.apply(vectorcraft_geom::Point::new(*x, *y)).unwrap()).map(|p| [p.x, p.y]).collect()
};
let near =
|a: &[[f64; 2]], b: &[[f64; 2]]| a.len() == b.len() && a.iter().zip(b).all(|(p, q)| (p[0] - q[0]).abs() < 1e-6 && (p[1] - q[1]).abs() < 1e-6);
let (anchors, even_odd, held) = clip_group(&s.doc().unwrap().doc, group);
let triangle = mapped(&s, &[[50.0, 0.0], [100.0, 50.0], [0.0, 50.0]]);
assert!(near(&anchors, &triangle) && even_odd && held == image, "{anchors:?} vs {triangle:?}");
s.execute("links.relink", &json!({"ids": [image.0], "path": square})).unwrap();
let (anchors, even_odd, held) = clip_group(&s.doc().unwrap().doc, group);
let squared = mapped(&s, &[[25.0, 12.5], [75.0, 12.5], [75.0, 37.5], [25.0, 37.5]]);
assert!(near(&anchors, &squared) && even_odd && held == image, "the new file's clipping path: {anchors:?} vs {squared:?}");
assert_eq!(node(&s).image_corners().unwrap(), corners);
s.execute("links.relink", &json!({"ids": [image.0], "path": plain})).unwrap();
match s.doc().unwrap().doc.node(group).map(|n| &n.kind) {
Some(NodeKind::Group { children, clip: false }) => assert_eq!(children.iter().map(|c| c.id).collect::<Vec<_>>(), [image]),
other => panic!("a plain group of the image: {other:?}"),
}
s.execute("links.relink", &json!({"ids": [image.0], "path": cut})).unwrap();
let (anchors, _, held) = clip_group(&s.doc().unwrap().doc, group);
assert!(near(&anchors, &triangle) && held == image, "clipped again: {anchors:?} vs {triangle:?}");
assert!(node(&s).is_distorted_image());
assert_eq!(node(&s).image_corners().unwrap(), corners);
}
/// Unembed keeps the clip group of the clipping path an embedded PSD file's image came with, for a
/// plain image and for one changed by Perspective Distort or Free Distort, and so do reading the
/// written file again and placing it.
#[test]
fn unembed_keeps_the_clipping_path_of_an_embedded_psd() {
let dir = vectorcraft_testkit::TempDir::new("psd-unembed-clip");
// An RGB file is kept as a PNG, a CMYK one as a TIFF.
let cmyk = psd(1, 4, (100, 50), 8, 4, &[], &triangle_resources(), &[], &raw(&[&[0; 5000], &[255; 5000], &[255; 5000], &[0; 5000]]));
let files = [("rgb", red_psd(&triangle_resources())), ("cmyk", cmyk)];
for ((kind, file), distort) in files.iter().flat_map(|f| [(f, false), (f, true)]) {
let data = vectorcraft_format::base64_encode(file);
let mut s = Session::new();
s.execute("file.new", &json!({"width": 100, "height": 50})).unwrap();
let r = s.execute("file.place", &json!({"name": "cut.psd", "dataBase64": data, "at": [50, 25]})).unwrap();
let (group, image) = (NodeId(r["ids"][0].as_u64().unwrap()), NodeId(r["image"].as_u64().unwrap()));
if distort {
s.execute("select.set", &json!({"ids": [group.0]})).unwrap();
s.execute("object.distort", &json!({"corners": [[0, 0], [100, 8], [90, 50], [6, 44]]})).unwrap();
}
let before = clip_group(&s.doc().unwrap().doc, group);
// Without an extension the image is written in the format it is stored in.
let r = s.execute("links.unembed", &json!({"id": image.0, "path": dir.join(format!("written-{kind}-{distort}"))})).unwrap();
let path = r["path"].as_str().unwrap().to_string();
let ext = if *kind == "rgb" { ["png"].as_slice() } else { ["tif", "tiff"].as_slice() };
assert!(ext.contains(&super::extension(&path).as_str()), "{kind}: {path}");
for step in ["unembed", "relink"] {
if step == "relink" {
s.execute("links.relink", &json!({"ids": [image.0], "path": path})).unwrap();
}
let d = &s.doc().unwrap().doc;
let NodeKind::Image(im) = &d.node(image).unwrap().kind else { panic!("an image") };
assert!(im.link.is_some(), "linked to the file written");
assert_eq!(d.node(image).unwrap().is_distorted_image(), distort);
// A distorted image's clipping path is drawn through its corners again, within rounding.
let (anchors, even_odd, held) = clip_group(d, group);
let near = anchors.len() == before.0.len()
&& anchors.iter().zip(&before.0).all(|(p, q)| (p[0] - q[0]).abs() < 1e-6 && (p[1] - q[1]).abs() < 1e-6);
assert!(near && (even_odd, held) == (before.1, before.2), "{kind}, {step}, distorted: {distort}: {anchors:?} vs {:?}", before.0);
}
// Placing the written file gives the same clip group as placing the PSD file did.
if !distort {
let r = s.execute("file.place", &json!({"path": path, "at": [50, 25]})).unwrap();
let placed = NodeId(r["ids"][0].as_u64().unwrap());
let (anchors, even_odd, _) = clip_group(&s.doc().unwrap().doc, placed);
assert!(even_odd && anchors.len() == before.0.len(), "{kind}, place: {anchors:?} vs {:?}", before.0);
}
}
}
/// The PNG a PSD file's merged image is kept as holds the clipping path the file names, and only a
/// text chunk within the size limit that reads as a path gives one back.
#[test]
+86 -35
View File
@@ -33,7 +33,7 @@ use vectorcraft_doc::{
Appearance, DataValue, Document, ImageBlob, ImageObject, LinkInfo, Node, NodeId, NodeKind, PageBox, PlacedDocument, PlacementOptions,
StoredPlace, StoredRoot,
};
use vectorcraft_geom::{Affine, FillRule, PathData, Rect, shapes};
use vectorcraft_geom::{Affine, FillRule, Homography, PathData, Rect, shapes};
use super::fileio::{self, RasterImage, absolute_path, file_created, file_stamp, read_file, write_file};
use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, has_doc, ids_param, object_param, str_param, switch_or, text_param};
@@ -72,7 +72,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Relink",
[],
None,
"{ids?: [image or placed document ids] (default: the selected ones; with folder and nothing selected, every missing link), path | folder, scope?: selected (default: ids) | all (ids and every other object linked to the same file as one of them, in the layers, opacity-mask art, symbols, graph designs, patterns and the art of stored brushes) | missingInFolder (with path: ids, then every other missing link whose file name is in path's folder, each to the file of its name there; names not there are in notFound; with copy, only images are looked for) | each (with paths), paths?: [{ids, path}] (with scope each, in place of ids, path and folder: each link to its own file; an id in two entries is an error), copy?: false (with path or paths, for images of a saved document: copy the file into the document's folder and link to the copy; the names Name.png, Name 2.png … Name 99.png are tried in turn until one is free, which gets the copy, or is a file with the same contents, which is used; an error for a DCS file that reads plate files of its own), preserve?: transforms|bounds|fileDimensions|fit|fill (how the new file takes each image's place this time, as links.placementOptions describes; default: each image's Placement Options; fit keeps the new file's aspect ratio inside the old bounds: Replace)} link images (or placed documents, each showing the same artboard or page of the new file) to the file at path, or each to the file of its link's name in folder; embedded images become linked; each keeps its bounds. One undo step → {relinked: [ids], notFound: [file names], copied?: [{from, to}], kept?: [{from, to}] (with copy; to is the file name alone when the document's folder is outside the automation read roots), warnings?: (as links.update's)}",
"{ids?: [image or placed document ids] (default: the selected ones; with folder and nothing selected, every missing link), path | folder, scope?: selected (default: ids) | all (ids and every other object linked to the same file as one of them, in the layers, opacity-mask art, symbols, graph designs, patterns and the art of stored brushes) | missingInFolder (with path: ids, then every other missing link whose file name is in path's folder, each to the file of its name there; names not there are in notFound; with copy, only images are looked for) | each (with paths), paths?: [{ids, path}] (with scope each, in place of ids, path and folder: each link to its own file; an id in two entries is an error), copy?: false (with path or paths, for images of a saved document: copy the file into the document's folder and link to the copy; the names Name.png, Name 2.png … Name 99.png are tried in turn until one is free, which gets the copy, or is a file with the same contents, which is used; an error for a DCS file that reads plate files of its own), preserve?: transforms|bounds|fileDimensions|fit|fill (how the new file takes each image's place this time, as links.placementOptions describes; default: each image's Placement Options; fit keeps the new file's aspect ratio inside the old bounds: Replace)} link images (or placed documents, each showing the same artboard or page of the new file) to the file at path, or each to the file of its link's name in folder; embedded images become linked; each keeps its bounds. An image changed by Perspective Distort or Free Distort keeps its corners, with the new file's pixels between them, whatever preserve or its Placement Options say; the clipping path its file names is drawn through the corners. One undo step → {relinked: [ids], notFound: [file names], copied?: [{from, to}], kept?: [{from, to}] (with copy; to is the file name alone when the document's folder is outside the automation read roots), warnings?: (as links.update's)}",
has_doc,
relink
),
@@ -99,7 +99,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Embed Image",
[],
None,
"{ids?: [image or placed document ids] (default: the selected linked ones)} break the links (the Links panel's Break Link): images keep the linked files' pixels in the document; a placed document becomes an editable copy of its art, as placing its file without link gives (its symbols, patterns, swatches and images joining the document). An image whose file can't be found and that shows the saved preview, or a placed document whose file can't be read or changed, stays linked: relink or update it first. An image placed from a DCS file can't be embedded (an error, and nothing changes). One undo step → {embedded: [ids], missing: [ids]}",
"{ids?: [image or placed document ids] (default: the selected linked ones)} break the links (the Links panel's Break Link): images keep the linked files' pixels in the document; a placed document becomes an editable copy of its art, as placing its file without link gives (its symbols, patterns, swatches and images joining the document). An image whose file can't be found and that shows the saved preview, or a placed document whose file can't be read or changed, stays linked: relink or update it first. An image placed from a DCS file can't be embedded (an error, and nothing changes). An image changed by Perspective Distort or Free Distort keeps its corners. One undo step → {embedded: [ids], missing: [ids]}",
has_doc,
embed
),
@@ -108,7 +108,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Unembed",
[],
None,
"{id?: an embedded image (default: the one selected), path?, ids?: [image ids] (instead of id; one id is the same as id), folder?} write the image's pixels to the file at path (PNG, JPEG, GIF or WebP as stored, other images as PNG; a path ending in .png/.jpg/.jpeg/.gif/.webp/.tif/.tiff/.bmp converts them) and link the image to it, keeping its bounds. One undo step → {id, path}; no path → {name, dataBase64} (nothing changes: there is no file to link to). With folder: write each embedded image of ids or id (default: the selected embedded images) to a new file in folder, as stored (as PNG when that format is not one of VectorCraft's raster file formats), named after the image (characters a file name can't hold become _; Image when nothing is left), with Name 2 … Name 99 when the name is taken; a file already there is never replaced. Linked images among ids are left as they are. Each image links to its file and keeps its bounds. One undo step (undo does not remove the files); when a file can't be written, the files this call wrote are removed and nothing changes → {unembedded: [{id, path}], skipped: [ids of linked images]}; id with ids, path with folder, and ids of more or fewer than one image without folder are errors",
"{id?: an embedded image (default: the one selected), path?, ids?: [image ids] (instead of id; one id is the same as id), folder?} write the image's pixels to the file at path (PNG, JPEG, GIF or WebP as stored, other images as PNG; a path ending in .png/.jpg/.jpeg/.gif/.webp/.tif/.tiff/.bmp converts them) and link the image to it, keeping its bounds (an image changed by Perspective Distort or Free Distort keeps its corners); written as stored, an image from a PSD or PSB file keeps the clip group of the clipping path that file names, and the file written keeps the path for later reads. One undo step → {id, path}; no path → {name, dataBase64} (nothing changes: there is no file to link to). With folder: write each embedded image of ids or id (default: the selected embedded images) to a new file in folder, as stored (as PNG when that format is not one of VectorCraft's raster file formats), named after the image (characters a file name can't hold become _; Image when nothing is left), with Name 2 … Name 99 when the name is taken; a file already there is never replaced. Linked images among ids are left as they are. Each image links to its file and keeps its bounds (a distorted image its corners). One undo step (undo does not remove the files); when a file can't be written, the files this call wrote are removed and nothing changes → {unembedded: [{id, path}], skipped: [ids of linked images]}; id with ids, path with folder, and ids of more or fewer than one image without folder are errors",
has_doc,
unembed
),
@@ -634,7 +634,8 @@ pub(crate) fn readable_and_kept(blob: ImageBlob, unread: bool, linked: bool) ->
/// The linked image file `bytes` (read from `path`, when there is one), read with its preview: a
/// DCS file's plates, else its image ([`super::place::dcs::raster`]); an error when its pixels
/// can't be read ([`readable`]).
/// can't be read ([`readable`]). A PNG or TIFF written from a PSD or PSB file's image (by Unembed)
/// comes with the clipping path it keeps ([`fileio::raster_image`]).
fn linked_image(bytes: &[u8], path: Option<&str>) -> Result<RasterImage> {
let mut img = super::place::dcs::raster(bytes, path)?;
img.blob = readable(img.blob, kept_unread(bytes), true)?;
@@ -791,13 +792,20 @@ fn clip_to(
new_xf: Affine,
held: Option<(&PathData, FillRule)>,
) -> ClipTo {
let old = old_clip.filter(|_| held.is_some()).map(|(path, rule)| (path.transformed(old_xf), *rule));
let file = img.clip.as_ref().map(|(path, rule)| (path.transformed(new_xf), *rule));
placed_clip_to(old.as_ref(), clip, file, held)
}
/// [`clip_to`] with the clipping paths of the old file (`old`) and of the new file (`file`) already
/// on the page.
fn placed_clip_to(old: Option<&FileClip>, clip: Option<Clip>, file: Option<FileClip>, held: Option<(&PathData, FillRule)>) -> ClipTo {
// Whether the clip group holding just the image is the old file's: a clipping path whose fill
// rule was changed in the document is not.
let file_held = match (old_clip, held) {
(Some((old, old_rule)), Some((held, rule))) => rule == *old_rule && same_path(&old.transformed(old_xf), held),
let file_held = match (old, held) {
(Some((old, old_rule)), Some((held, rule))) => rule == *old_rule && same_path(old, held),
_ => false,
};
let file = img.clip.as_ref().map(|(path, rule)| (path.transformed(new_xf), *rule));
if let Some(clip) = clip {
let placement = clip_shape(clip);
return match file {
@@ -1210,14 +1218,43 @@ pub(crate) fn set_image_from_path(d: &mut Document, id: NodeId, path: &str, doc_
install(d, &[id], read, Some(Preserve::Bounds), None)
}
/// Distorted image `im` shows the file read for `link` (`img`) and keeps its corners and its
/// clipping: the new pixels fill them. Its transform is scaled to the new pixel size, so a reader
/// that places it by the transform still gives it its old size.
fn refill_distorted(im: &mut ImageObject, link: &LinkInfo, img: &RasterImage) {
if (img.width, img.height) != (im.width, im.height) && img.width > 0 && img.height > 0 {
im.xf *= Affine::scale_non_uniform(f64::from(im.width) / f64::from(img.width), f64::from(im.height) / f64::from(img.height));
/// Distorted image `n` shows the file read for `link` (`img`) and keeps its corners: the new pixels
/// fill them. Its transform is scaled to the new pixel size, so a reader that places it by the
/// transform still gives it its old size. Its Placement Options do not apply. The result is what
/// happens to its clip, as [`clip_to`] decides from the clipping path of the clip group holding
/// just it (`held`): the clipping paths of its old file (`old_clip`, in its old pixels) and of the
/// new file are mapped to the page through its corners, anchors and handles alike, as a distort
/// maps a path's.
fn refill_distorted(n: &mut Node, old_clip: Option<&FileClip>, link: &LinkInfo, img: &RasterImage, held: Option<(&PathData, FillRule)>) -> ClipTo {
let old = old_clip.filter(|_| held.is_some()).and_then(|(path, rule)| Some((warped(path, &n.image_map()?)?, *rule)));
if let NodeKind::Image(im) = &mut n.kind {
if (img.width, img.height) != (im.width, im.height) && img.width > 0 && img.height > 0 {
im.xf *= Affine::scale_non_uniform(f64::from(im.width) / f64::from(img.width), f64::from(im.height) / f64::from(img.height));
}
(im.key, im.width, im.height, im.link) = (img.key.clone(), img.width, img.height, Some(link.clone()));
}
(im.key, im.width, im.height, im.link) = (img.key.clone(), img.width, img.height, Some(link.clone()));
let file = img.clip.as_ref().and_then(|(path, rule)| Some((warped(path, &n.image_map()?)?, *rule)));
placed_clip_to(old.as_ref(), None, file, held)
}
/// `path` with its anchors and handles mapped through `map` as a distort maps a path's points
/// (`xform::Projective::apply`): a point on the map's horizon is mapped as if a billionth in front
/// of it, and one past it to the far side. `None` when a point maps to no finite page point.
fn warped(path: &PathData, map: &Homography) -> Option<PathData> {
let [[a, b, c], [d, e, f], [g, h, i]] = map.0;
let apply = |p: vectorcraft_geom::Point| {
let w = g * p.x + h * p.y + i;
let w = if w.abs() < 1e-9 { 1e-9_f64.copysign(w) } else { w };
let q = vectorcraft_geom::Point::new((a * p.x + b * p.y + c) / w, (d * p.x + e * p.y + f) / w);
q.is_finite().then_some(q)
};
let mut out = path.clone();
for sp in &mut out.subpaths {
for anchor in &mut sp.anchors {
(anchor.p, anchor.h_in, anchor.h_out) = (apply(anchor.p)?, apply(anchor.h_in)?, apply(anchor.h_out)?);
}
}
Some(out)
}
/// Image objects `ids` (in the layers or outside them) show the file read for `link` (`img`), each
@@ -1244,12 +1281,15 @@ fn install(d: &mut Document, ids: &[NodeId], (link, img): FileRead, force: Optio
let mut make = |n: &Node, held: Option<(&PathData, FillRule)>| {
let mut n = n.clone();
let mut clip = ClipTo::Keep;
let distorted = n.is_distorted_image();
if n.is_distorted_image() {
let old_clip = match &n.kind {
NodeKind::Image(im) => old.get(&im.key).and_then(|(_, clip)| clip.clone()),
_ => None,
};
let clip = refill_distorted(&mut n, old_clip.as_ref(), &link, &img, held);
return (n, clip);
}
if let NodeKind::Image(im) = &mut n.kind {
if distorted {
refill_distorted(im, &link, &img);
return (n, clip);
}
let o = PlacementOptions { preserve: force.unwrap_or(im.placement.preserve), ..im.placement };
let size = |w: u32, h: u32| (w as f64, h as f64);
let (old_pt, old_clip) = match old.get(&im.key) {
@@ -1266,10 +1306,13 @@ fn install(d: &mut Document, ids: &[NodeId], (link, img): FileRead, force: Optio
}
for id in ids {
if d.node(*id).is_some_and(Node::is_distorted_image) {
if let Some(n) = d.node_mut(*id)
&& let NodeKind::Image(im) = &mut n.kind
{
refill_distorted(im, &link, &img);
let old_clip = match d.node(*id).map(|n| &n.kind) {
Some(NodeKind::Image(im)) => d.images.get(&im.key).and_then(file_clip),
_ => None,
};
let held = clip_path_of(d, *id).map(|(path, rule)| (path.clone(), rule));
if let Some(n) = d.node_mut(*id) {
clips.push((*id, refill_distorted(n, old_clip.as_ref(), &link, &img, held.as_ref().map(|(path, rule)| (path, *rule)))));
}
continue;
}
@@ -2153,11 +2196,6 @@ fn relink(s: &mut Session, p: &Value) -> Result<Value> {
}
(None, None, None) => return Err(bad(C, "give path (a file) or folder")),
}
// A new file's placement options place a plain image: a distorted one is left as it is.
let distorted = files.iter().flat_map(|(ids, _)| ids).find(|id| stored(&doc, **id).is_some_and(Node::is_distorted_image));
if let Some(id) = distorted {
return Err(super::xform::distorted_image_error(C, *id));
}
// Every file is read and checked before any is copied.
let mut checked = vec![];
for (ids, path) in files {
@@ -2620,9 +2658,6 @@ fn embed(s: &mut Session, p: &Value) -> Result<Value> {
if ids.is_empty() {
return Err(bad(C, "select the linked images or placed documents, or pass ids"));
}
if let Some(id) = ids.iter().find(|id| stored(&doc, **id).is_some_and(Node::is_distorted_image)) {
return Err(super::xform::distorted_image_error(C, *id));
}
// A DCS file's plates print from its file.
let separated = |id: &NodeId| match kind(id) {
Some(NodeKind::Image(im)) => st.doc.images.get(&im.key).is_some_and(ImageBlob::is_separated),
@@ -2751,9 +2786,6 @@ fn unembed(s: &mut Session, p: &Value) -> Result<Value> {
if im.link.is_some() {
return Err(bad(C, format!("image {} is linked already", id.0)));
}
if n.is_distorted_image() {
return Err(super::xform::distorted_image_error(C, id));
}
let blob = st.doc.images.get(&im.key).filter(|b| !b.is_proxy()).ok_or_else(|| bad(C, "the image's pixels aren't in the document"))?;
// As stored (PNG, JPEG, GIF, WebP), unless the path names another format.
let stored = stored_extension(blob);
@@ -3124,4 +3156,23 @@ mod tests {
let long = unembed_stem(&"é".repeat(200));
assert!(long.len() <= 150 && long.chars().all(|c| c == 'é'), "{}", long.len());
}
/// A clipping path mapped through a distorted image's corners keeps the points that lie on or
/// past the map's horizon, each mapped as a distort maps a path's point.
#[test]
fn points_past_the_horizon_are_mapped_as_a_distort_maps_them() {
use vectorcraft_geom::{Anchor, Point, SubPath};
// w = 1 + x / 100: the horizon is the line x = -100.
let map = Homography([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.01, 0.0, 1.0]]);
let (at, handle, on) = (Point::new(0.0, 0.0), Point::new(-200.0, 0.0), Point::new(-100.0, 5.0));
assert!(map.apply(handle).is_none() && map.apply(on).is_none());
let path = PathData::new(vec![SubPath::new(vec![Anchor::smooth(at, handle), Anchor::corner(on)], false)]);
let out = warped(&path, &map).expect("a path");
let (first, second) = (out.subpaths[0].anchors[0], out.subpaths[0].anchors[1]);
assert_eq!((first.p, first.h_in), (at, Point::new(200.0 / 3.0, 0.0)));
// w = -1: the handle maps to the far side.
assert_eq!(first.h_out, Point::new(200.0, 0.0));
// w = 0 is taken as a billionth.
assert!(second.p.is_finite() && (second.p.x.abs() - 1e11).abs() < 1.0 && (second.p.y.abs() - 5e9).abs() < 1.0, "{:?}", second.p);
}
}
+170
View File
@@ -655,6 +655,176 @@ fn update_links_keeps_a_distorted_images_corners() {
scale_matches_ppi(&mut s);
}
/// Relink with scope `all` puts the new file's pixels between the corners of the distorted images
/// in symbols too, and scales each one's transform to the new pixel size, so a placement by the
/// transform keeps the old size.
#[test]
fn relink_of_all_instances_keeps_the_corners_of_distorted_images_in_symbols() {
let dir = Folder::new("distorted-relink-all");
let (photo, other) = (dir.file("photo.png"), dir.file("other.png"));
write(&photo, &png(20, 10, RED));
write(&other, &png(60, 20, BLUE));
let mut s = session();
let id = place(&mut s, &photo);
s.execute("select.set", &json!({"ids": [id.0]})).unwrap();
s.execute("object.distort", &json!({"corners": [[150, 100], [250, 110], [260, 200], [140, 190]]})).unwrap();
let before = s.doc().unwrap().doc.node(id).unwrap().image_corners().unwrap();
// The far corner of the pixels as the transform alone places them.
let far = |s: &Session| {
let NodeKind::Image(im) = &s.doc().unwrap().doc.node(id).unwrap().kind else { panic!("an image") };
im.xf * vectorcraft_geom::Point::new(f64::from(im.width), f64::from(im.height))
};
let far_before = far(&s);
// A distorted copy in a symbol shows the same file.
let copy = place(&mut s, &photo);
s.execute("select.set", &json!({"ids": [copy.0]})).unwrap();
s.execute("object.distort", &json!({"corners": [[10, 10], [60, 15], [58, 50], [5, 45]]})).unwrap();
s.execute("symbol.new", &json!({"name": "Mark", "ids": [copy.0]})).unwrap();
let in_symbol = |s: &Session| {
let mut out = vec![];
s.doc().unwrap().doc.symbols[0].art.walk(&mut |n| {
if let NodeKind::Image(im) = &n.kind {
out.push((n.image_quad(), (im.width, im.height)));
}
});
out
};
let [(Some(symbol_quad), (20, 10))] = in_symbol(&s)[..] else { panic!("one distorted image in the symbol: {:?}", in_symbol(&s)) };
let r = s.execute("links.relink", &json!({"ids": [id.0], "path": other, "scope": "all"})).unwrap();
let relinked = r["relinked"].as_array().unwrap();
assert!(relinked.len() == 2 && relinked.contains(&json!(id.0)), "the image and the symbol's: {r}");
let n = s.doc().unwrap().doc.node(id).unwrap().clone();
assert_eq!((n.is_distorted_image(), n.image_corners().unwrap()), (true, before));
assert_eq!((image(&s, id).width, image(&s, id).height), (60, 20));
assert!(far(&s).distance(far_before) < 1e-9, "{:?} vs {far_before:?}", far(&s));
assert_eq!(in_symbol(&s), [(Some(symbol_quad), (60, 20))], "the symbol's image keeps its corners");
}
/// Relink, Embed and Unembed keep a distorted image's corners, each in one undo step: Relink puts
/// the new file's pixels between them whatever `preserve` and the Placement Options say, Embed
/// keeps the pixels in the document, and Unembed links the image to the file it writes.
#[test]
fn relink_embed_and_unembed_keep_a_distorted_images_corners() {
let dir = Folder::new("distorted-relink");
let (photo, other, written) = (dir.file("photo.png"), dir.file("other.png"), dir.file("written.png"));
write(&photo, &png(20, 10, RED));
write(&other, &png(60, 20, BLUE));
let mut s = session();
let id = place(&mut s, &photo);
s.execute("links.placementOptions", &json!({"ids": [id.0], "preserve": "fill", "clip": true})).unwrap();
s.execute("select.set", &json!({"ids": [id.0]})).unwrap();
// Around the artboard's center, where `centre_colour` looks.
s.execute("object.distort", &json!({"corners": [[150, 100], [250, 110], [260, 200], [140, 190]]})).unwrap();
let corners = |s: &Session| s.doc().unwrap().doc.node(id).unwrap().image_corners().unwrap();
let before = corners(&s);
let distorted = |s: &Session| s.doc().unwrap().doc.node(id).unwrap().is_distorted_image();
let clipped = |s: &Session| {
let d = &s.doc().unwrap().doc;
matches!(d.parent_of(id).and_then(|p| d.node(p)).map(|p| &p.kind), Some(NodeKind::Group { clip: true, .. }))
};
let undo_len = |s: &Session| s.doc().unwrap().history.undo.len();
assert!(near(centre_colour(&s.doc().unwrap().doc), RED));
let undo = undo_len(&s);
let r = s.execute("links.relink", &json!({"ids": [id.0], "path": other, "preserve": "fileDimensions"})).unwrap();
assert_eq!(r["relinked"], json!([id.0]), "{r}");
assert_eq!(undo_len(&s), undo + 1);
assert!(distorted(&s));
assert_eq!(corners(&s), before);
assert!(!clipped(&s), "not clipped by its Placement Options");
let im = image(&s, id);
assert_eq!((im.width, im.height), (60, 20));
assert_eq!(im.link.as_ref().map(|l| l.path.as_str()), Some(other.as_str()));
assert!(near(centre_colour(&s.doc().unwrap().doc), BLUE));
let r = s.execute("links.embed", &json!({"ids": [id.0]})).unwrap();
assert_eq!(r["embedded"], json!([id.0]), "{r}");
assert_eq!(undo_len(&s), undo + 2);
assert!(distorted(&s));
assert_eq!(corners(&s), before);
assert!(image(&s, id).link.is_none());
assert!(near(centre_colour(&s.doc().unwrap().doc), BLUE));
let r = s.execute("links.unembed", &json!({"id": id.0, "path": written})).unwrap();
assert_eq!(r["id"], json!(id.0), "{r}");
assert_eq!(undo_len(&s), undo + 3);
assert!(distorted(&s));
assert_eq!(corners(&s), before);
assert!(!clipped(&s));
let im = image(&s, id);
assert_eq!((im.width, im.height), (60, 20));
assert!(im.link.is_some());
assert!(Path::new(&written).exists());
assert!(near(centre_colour(&s.doc().unwrap().doc), BLUE));
// Undo takes each back to the same corners, and the first file's pixels in the end.
for _ in 0..3 {
s.execute("edit.undo", &json!({})).unwrap();
assert!(distorted(&s));
assert_eq!(corners(&s), before);
}
assert_eq!((image(&s, id).width, image(&s, id).height), (20, 10));
assert!(near(centre_colour(&s.doc().unwrap().doc), RED));
}
/// Unembed into a folder keeps a distorted image's corners, in one undo step.
#[test]
fn unembed_to_a_folder_keeps_a_distorted_images_corners() {
let dir = Folder::new("distorted-unembed-folder");
let (photo, out) = (dir.file("photo.png"), dir.file("out"));
std::fs::create_dir_all(&out).unwrap();
write(&photo, &png(20, 10, RED));
let mut s = session();
let id = place(&mut s, &photo);
s.execute("links.embed", &json!({"ids": [id.0]})).unwrap();
s.execute("select.set", &json!({"ids": [id.0]})).unwrap();
s.execute("object.distort", &json!({"corners": [[150, 100], [250, 110], [260, 200], [140, 190]]})).unwrap();
let corners = |s: &Session| s.doc().unwrap().doc.node(id).unwrap().image_corners().unwrap();
let before = corners(&s);
let undo = s.doc().unwrap().history.undo.len();
let r = s.execute("links.unembed", &json!({"ids": [id.0], "folder": out})).unwrap();
assert_eq!(r["unembedded"][0]["id"], json!(id.0), "{r}");
assert_eq!(s.doc().unwrap().history.undo.len(), undo + 1);
assert!(s.doc().unwrap().doc.node(id).unwrap().is_distorted_image());
assert_eq!(corners(&s), before);
assert!(image(&s, id).link.is_some());
assert!(near(centre_colour(&s.doc().unwrap().doc), RED));
}
/// Embed reads the file of a distorted image that shows its saved preview and keeps the file's
/// pixels in the document between the image's corners, in one undo step.
#[test]
fn embed_reads_a_distorted_images_file_between_its_corners() {
let dir = Folder::new("distorted-embed-preview");
let photo = dir.file("photo.png");
// Large enough that the document saves a smaller preview of it.
write(&photo, &png(600, 300, RED));
let mut s = session();
let id = place(&mut s, &photo);
s.execute("select.set", &json!({"ids": [id.0]})).unwrap();
s.execute("object.distort", &json!({"corners": [[150, 100], [250, 110], [260, 200], [140, 190]]})).unwrap();
let corners = |s: &Session| s.doc().unwrap().doc.node(id).unwrap().image_corners().unwrap();
let before = corners(&s);
let doc_path = dir.file("poster.vectorcraft");
save(&mut s, &doc_path);
std::fs::remove_file(&photo).unwrap();
open(&mut s, &doc_path);
assert!(s.doc().unwrap().doc.images[&image(&s, id).key].is_proxy(), "the preview stands in");
assert!(s.doc().unwrap().doc.node(id).unwrap().is_distorted_image());
write(&photo, &png(400, 200, BLUE));
let undo = s.doc().unwrap().history.undo.len();
let r = s.execute("links.embed", &json!({"ids": [id.0]})).unwrap();
assert_eq!(r, json!({"embedded": [id.0], "missing": []}));
assert_eq!(s.doc().unwrap().history.undo.len(), undo + 1);
let n = s.doc().unwrap().doc.node(id).unwrap().clone();
assert!(n.is_distorted_image());
assert_eq!(n.image_corners().unwrap(), before);
let im = image(&s, id);
assert_eq!((im.width, im.height, im.link.is_none()), (400, 200, true));
assert!(!s.doc().unwrap().doc.images[&im.key].is_proxy(), "the file's pixels are in the document");
assert!(near(centre_colour(&s.doc().unwrap().doc), BLUE));
}
/// Update Links reads a changed file again for the images inside symbols, patterns and opacity
/// masks too: those showing the same content as an image in the layers, and those no object in the
/// layers shows. Each takes the file's place as its own Placement Options say, in one undo step,
-3
View File
@@ -723,9 +723,6 @@ fn distort_refuses_a_folded_image_and_crop_and_trace_refuse_a_distorted_one() {
for (cmd, params) in [
("object.cropImage", json!({})),
("imageTrace.make", json!({})),
("links.relink", json!({"path": "/nowhere/pic.png"})),
("links.embed", json!({"ids": [img.0]})),
("links.unembed", json!({})),
("object.createObjectMosaic", json!({})),
("object.mesh.create", json!({})),
(
+11 -7
View File
@@ -6662,12 +6662,14 @@ rules opens with the image placed by its transform. A drag is one undo step, and
where they are records none. Image info (`image.info`) gives a distorted image's resolution at its middle, and Link
Info (`links.info`) gives its scale and rotation there.
Crop Image (`object.cropImage`), Image Trace (`imageTrace.make`, `imageTrace.makeAndExpand`), Relink (`links.relink`),
Embed (`links.embed`), Unembed (`links.unembed`), Create Object Mosaic (`object.createObjectMosaic`), Create
Gradient Mesh (`object.mesh.create`) and Place with Replace (`file.place` with `replace`) refuse a distorted image with
an error that names the distortion. Update Links (`links.update`) puts a changed file's pixels between a distorted
image's corners, without applying its Placement Options. Mask (`object.maskImage`) draws its clipping path through the
image's corners. Rasterize (`object.rasterize`) draws the image between its corners and makes a plain image of the
Crop Image (`object.cropImage`), Image Trace (`imageTrace.make`, `imageTrace.makeAndExpand`), Create Object Mosaic
(`object.createObjectMosaic`), Create Gradient Mesh (`object.mesh.create`) and Place with Replace (`file.place` with
`replace`) refuse a distorted image with an error that names the distortion. Update Links (`links.update`) and Relink
(`links.relink`) put the file's pixels between a distorted image's corners, without applying its Placement Options or
Relink's `preserve`. The clipping path a PSD, PSB or DCS file names is drawn through the corners: a clip group of the
old file's clipping path takes the new file's, or becomes a plain group when the new file names none. Embed
(`links.embed`) and Unembed (`links.unembed`) keep the corners, each in one undo step. Mask (`object.maskImage`) draws
its clipping path through the image's corners. Rasterize (`object.rasterize`) draws the image between its corners and makes a plain image of the
result. These rules are VectorCraft's own.
```json
@@ -8773,7 +8775,9 @@ every object in the layers each time the list is read. A `dcsTransparency` that
`links.goTo {id}` selects an image (`onCanvas: true`); for an object outside the layer tree it clears the selection and
returns `{id, onCanvas: false, owner}`, and the panel says the link has no place on the canvas. `links.embed {ids?}` keeps linked files' pixels in the document (an image whose
file is missing stays linked: relink it first); `links.unembed {id, path}` writes an embedded image to a file
(another extension converts it) and links to it, and without `path` returns `{name, dataBase64}`.
(another extension converts it) and links to it, and without `path` returns `{name, dataBase64}`. An image from a PSD
or PSB file written as stored (PNG, or TIFF for a CMYK file) keeps the clip group of the clipping path that file
names, and the file written keeps the path for Place, Relink and Update Links.
`ids` of one image works as `id` does. `links.unembed {ids?, folder}` writes each embedded image of `ids` (or of
`id`; default: the selected embedded images) to a new
file in `folder`, in the format it is stored in (as PNG when that format is not one of VectorCraft's raster file formats), and links each image to its file, keeping its bounds, in one undo
+1 -1
View File
@@ -1069,7 +1069,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- After a rotation the Free Transform tool shows and drags the same turned bounding box as the Selection tool: its handles, their cursors and its rotate zone sit on the selection's own sides, a handle scales along those sides from the opposite handle ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/scale-objects.html)), Cmd/Ctrl on a side handle shears along that side, and Perspective Distort and Free Distort start from the turned box's corners (`object.distort` takes `angle` with `from`) (`bboxrotate::free_transform_handles_turn_with_the_object_and_scale_along_its_axes`, `free_transform_shears_along_the_turned_side`, `free_transform_distort_starts_from_the_turned_box`, `xform::distort_reads_from_in_a_turned_frame_and_rejects_a_bad_angle`, tools `xform::free::tests::the_box_and_its_handles_turn_with_the_selection`).
- After a rotation the Scale and Reflect tools, the Scale and Reflect dialogs, `object.scale`, `object.reflect` with a named axis and the Transform and Properties panels' flips act along the selection's turned bounding box until Reset Bounding Box: the horizontal and vertical scale stretch along its own width and height, and the vertical and horizontal reflection axes are its own. The Reflect tool's default axis and its Shift steps start from the box's axes, and an axis drawn with the tool is the line drawn on the page. `basis: "page"` keeps the page's axes (VectorCraft's own rules; `bboxrotate::scale_and_reflect_follow_the_turned_box`, tools `xform::transform::tests::scale_and_reflect_drags_follow_a_turned_bounding_box`).
- Perspective Distort and Free Distort (`object.distort`) turn each warped object's bounding box as the warp turns the object at its own center, the objects inside groups, compound paths and clip groups and the art of linked opacity masks included, so the next Selection or Free Transform drag uses the tilted box; Object › Transform › Reset Bounding Box squares it again, and corners left where they are add no undo step (VectorCraft's own rule; `bboxrotate::distort_turns_an_upright_box_with_the_warp_at_its_center`, `distort_turns_each_member_and_linked_mask_by_its_own_warp`, `mirrored_and_collapsing_distorts_keep_valid_angles`, `distort_angles_undo_redo_and_reopen_together`, `xform::unchanged_distort_records_no_history`).
- Perspective Distort and Free Distort (`object.distort`) move an image's four corners exactly onto the handles, alone or with other objects, and draw its pixels in perspective between them on the canvas, in print and in every export, as a mesh of affine image pieces (DXF and WMF write the nearest parallelogram and warn); the native file saves the corners; bounds, clicks, blends, the Eyedropper, Outline view, the Color Theme Picker and Weed Box and Lines follow them; Image info and Link Info measure the image at its middle; and corners that would fold the image over, fall on one line, cross the warp's horizon or lie too close together for a perspective map are refused. Crop Image, Image Trace, Relink, Embed, Unembed, Create Object Mosaic, Create Gradient Mesh and Place with Replace refuse a distorted image; Update Links puts a changed file's pixels between its corners; Rasterize makes a plain image of it. All of this is VectorCraft's own rule (doc `image_quad::tests`, `blend::tests::steps_between_distorted_images_have_corners_between_theirs`; engine `xform::distort_puts_an_images_corners_on_the_handles`, `distort_moves_an_image_and_a_path_as_one`, `distort_refuses_a_folded_image_and_crop_and_trace_refuse_a_distorted_one`, `distort_names_the_horizon_and_an_unchanged_distort_of_a_distorted_image_records_nothing`, `distort_of_a_blend_holding_an_image_is_not_refused`, `free_transform_distort_drag_on_an_image_is_one_undo_step`, `mask_on_a_distorted_image_follows_its_corners`, `a_transform_effect_moves_a_distorted_images_corners`, `a_transform_after_a_warp_moves_a_distorted_image_once`, `baked_raster_effect_pixels_replace_a_distortion`, `rasterize_draws_a_distorted_image_between_its_corners`, `image_info_measures_a_distorted_image_at_its_middle`, `a_distorted_image_saves_and_reads_back`, `links::update_links_keeps_a_distorted_images_corners`, `recolor::theme_picker_reads_a_distorted_image_where_it_is_drawn`, `addons::cutting::weed::tests::a_distorted_image_is_measured_by_the_frame_through_its_corners`; render `outline_mode_draws_a_distorted_images_frame_through_its_corners`, `meshwarp::outline_mode_paints_a_distorted_images_pixels_once_where_its_pieces_overlap`, `meshwarp::the_canvas_cuts_a_distorted_images_mesh_for_the_zoom`, `objectfx::a_distorted_image_is_opaque_between_its_corners_and_its_shadow_follows_them`, `objectfx::a_distorted_image_is_opaque_inside_its_corners_at_every_zoom`; svg `warp_pieces::a_distorted_image_is_written_between_its_corners`; pdf `compression::a_distorted_image_is_written_with_its_corners_on_its_quad`; eps `a_distorted_image_is_written_with_its_corners_on_its_quad`; cad `a_distorted_image_is_written_as_its_nearest_parallelogram_with_a_warning`; metafile `a_distorted_image_is_its_mesh_with_clips_and_its_nearest_parallelogram_without`; tools `xform::eyedropper::tests::clicking_an_image_samples_its_pixels`; plugins `objects::tests::a_distorted_image_comes_with_its_corners`; ui-egui `i18n::tests::distorted_image_messages_are_in_complete_catalogs`).
- Perspective Distort and Free Distort (`object.distort`) move an image's four corners exactly onto the handles, alone or with other objects, and draw its pixels in perspective between them on the canvas, in print and in every export, as a mesh of affine image pieces (DXF and WMF write the nearest parallelogram and warn); the native file saves the corners; bounds, clicks, blends, the Eyedropper, Outline view, the Color Theme Picker and Weed Box and Lines follow them; Image info and Link Info measure the image at its middle; and corners that would fold the image over, fall on one line, cross the warp's horizon or lie too close together for a perspective map are refused. Crop Image, Image Trace, Create Object Mosaic, Create Gradient Mesh and Place with Replace refuse a distorted image; Update Links and Relink put the file's pixels between its corners, with the file's clipping path drawn through them, and Embed and Unembed keep them; Rasterize makes a plain image of it. All of this is VectorCraft's own rule (doc `image_quad::tests`, `blend::tests::steps_between_distorted_images_have_corners_between_theirs`; engine `xform::distort_puts_an_images_corners_on_the_handles`, `distort_moves_an_image_and_a_path_as_one`, `distort_refuses_a_folded_image_and_crop_and_trace_refuse_a_distorted_one`, `distort_names_the_horizon_and_an_unchanged_distort_of_a_distorted_image_records_nothing`, `distort_of_a_blend_holding_an_image_is_not_refused`, `free_transform_distort_drag_on_an_image_is_one_undo_step`, `mask_on_a_distorted_image_follows_its_corners`, `a_transform_effect_moves_a_distorted_images_corners`, `a_transform_after_a_warp_moves_a_distorted_image_once`, `baked_raster_effect_pixels_replace_a_distortion`, `rasterize_draws_a_distorted_image_between_its_corners`, `image_info_measures_a_distorted_image_at_its_middle`, `a_distorted_image_saves_and_reads_back`, `links::update_links_keeps_a_distorted_images_corners`, `links::relink_embed_and_unembed_keep_a_distorted_images_corners`, `links::unembed_to_a_folder_keeps_a_distorted_images_corners`, `links::embed_reads_a_distorted_images_file_between_its_corners`, `links::relink_of_all_instances_keeps_the_corners_of_distorted_images_in_symbols`, `cmd::fileio::tests_psdread::relink_follows_the_clipping_path_of_a_distorted_psd`, `cmd::fileio::tests_psdread::unembed_keeps_the_clipping_path_of_an_embedded_psd`, `cmd::links::tests::points_past_the_horizon_are_mapped_as_a_distort_maps_them`, `recolor::theme_picker_reads_a_distorted_image_where_it_is_drawn`, `addons::cutting::weed::tests::a_distorted_image_is_measured_by_the_frame_through_its_corners`; render `outline_mode_draws_a_distorted_images_frame_through_its_corners`, `meshwarp::outline_mode_paints_a_distorted_images_pixels_once_where_its_pieces_overlap`, `meshwarp::the_canvas_cuts_a_distorted_images_mesh_for_the_zoom`, `objectfx::a_distorted_image_is_opaque_between_its_corners_and_its_shadow_follows_them`, `objectfx::a_distorted_image_is_opaque_inside_its_corners_at_every_zoom`; svg `warp_pieces::a_distorted_image_is_written_between_its_corners`; pdf `compression::a_distorted_image_is_written_with_its_corners_on_its_quad`; eps `a_distorted_image_is_written_with_its_corners_on_its_quad`; cad `a_distorted_image_is_written_as_its_nearest_parallelogram_with_a_warning`; metafile `a_distorted_image_is_its_mesh_with_clips_and_its_nearest_parallelogram_without`; tools `xform::eyedropper::tests::clicking_an_image_samples_its_pixels`; plugins `objects::tests::a_distorted_image_comes_with_its_corners`; ui-egui `i18n::tests::distorted_image_messages_are_in_complete_catalogs`).
- The Free Transform widget's Constrain works in Free Distort as well as in Free Transform ([the help page](https://helpx.adobe.com/illustrator/using/tool-techniques/free-transform-tool.html)). With Constrain on, or Shift held, a corner dragged in Free Distort moves only along the line through the opposite corner, in the box's own proportions, and the other three corners stay in place; on a turned box the line runs through the box's own corners. The line is VectorCraft's own rule. Cmd/Ctrl+Alt+Shift on a corner still drags in Perspective Distort, where Constrain stays unavailable (tools `xform::free::tests::free_distort_corner_keeps_to_its_diagonal_with_shift_or_constrain`, `shift_pressed_during_a_free_distort_drag_constrains_it`, `a_turned_box_is_constrained_along_its_own_diagonal`, `along_diagonal_of_a_degenerate_box`; engine `xform::free_transform_constrained_distort_keeps_the_corner_on_its_diagonal`; ui-egui `free_transform::tests::the_widget_sets_the_mode_and_a_corner_drag_then_distorts`).
- Native macOS menu bar, vector tool cursors, a command palette (Help › Search Commands…), middle-button panning with any tool. Native menus explicitly end tracking on command selection, outside window presses and Escape; menu updates wait until tracking ends, and a dismissing press never starts a canvas gesture (M14.8).
- Help › Search Commands… is the first item of the Help menu in the window, with its shortcut and a separator after it; in the native macOS menu bar it is the first item below the system's search field. This is VectorCraft's own order and does not raise a score (`menus::tests::help_starts_with_search_commands`, `tests::nativemenu::the_mac_help_menu_starts_with_search_commands`).