PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Content-Aware Move: live preview for large selections (TOOL-213-4, #6680)
David Mann2f21722eb436
diff --git a/crates/engine/src/retouch_cmds/content_aware_move.rs b/crates/engine/src/retouch_cmds/content_aware_move.rsindex ddca9c6e0..25bc52536 100644--- a/crates/engine/src/retouch_cmds/content_aware_move.rs+++ b/crates/engine/src/retouch_cmds/content_aware_move.rs@@ -149,31 +149,36 @@ fn mapped_bounds(h: &Homography, r: Rect) -> Rect {}/// `src` resampled (bilinear, edges clamped) through `inv` (destination → source) over `rect`:-/// the content as it lands. Works on float samples, so at any depth.+/// the content as it lands. Works on float samples, so at any depth; rows in parallel.fn resample(src: &Region, inv: &Homography, rect: Rect) -> Region {+ use rayon::prelude::*;let (sw, sh, n) = (src.rect.width() as usize, src.rect.height() as usize, src.ch);- let mut out = Region { rect, ch: n, data: vec![0.0; rect.width() as usize * rect.height() as usize * n] };- if sw == 0 || sh == 0 {+ let w = rect.width() as usize;+ let mut out = Region { rect, ch: n, data: vec![0.0; w * rect.height() as usize * n] };+ if sw == 0 || sh == 0 || w == 0 || n == 0 {return out;}let px = |x: usize, y: usize, c: usize| src.data.get((y * sw + x) * n + c).copied().unwrap_or(0.0);- for (i, dst) in out.data.chunks_exact_mut(n).enumerate() {- let (qx, qy) = (rect.x0 + (i % rect.width() as usize) as i32, rect.y0 + (i / rect.width() as usize) as i32);- let (sx, sy) = inv.apply(f64::from(qx) + 0.5, f64::from(qy) + 0.5);- let fx = (sx - 0.5 - f64::from(src.rect.x0)).clamp(0.0, (sw - 1) as f64);- let fy = (sy - 0.5 - f64::from(src.rect.y0)).clamp(0.0, (sh - 1) as f64);- if !(fx.is_finite() && fy.is_finite()) {- continue;- }- let (x0, y0) = (fx.floor() as usize, fy.floor() as usize);- let (x1, y1) = ((x0 + 1).min(sw - 1), (y0 + 1).min(sh - 1));- let (tx, ty) = ((fx - x0 as f64) as f32, (fy - y0 as f64) as f32);- for (c, d) in dst.iter_mut().enumerate() {- let top = px(x0, y0, c) * (1.0 - tx) + px(x1, y0, c) * tx;- let bottom = px(x0, y1, c) * (1.0 - tx) + px(x1, y1, c) * tx;- *d = top * (1.0 - ty) + bottom * ty;+ out.data.par_chunks_mut(w * n).enumerate().for_each(|(row, line)| {+ let qy = rect.y0 + row as i32;+ for (col, dst) in line.chunks_exact_mut(n).enumerate() {+ let qx = rect.x0 + col as i32;+ let (sx, sy) = inv.apply(f64::from(qx) + 0.5, f64::from(qy) + 0.5);+ let fx = (sx - 0.5 - f64::from(src.rect.x0)).clamp(0.0, (sw - 1) as f64);+ let fy = (sy - 0.5 - f64::from(src.rect.y0)).clamp(0.0, (sh - 1) as f64);+ if !(fx.is_finite() && fy.is_finite()) {+ continue;+ }+ let (x0, y0) = (fx.floor() as usize, fy.floor() as usize);+ let (x1, y1) = ((x0 + 1).min(sw - 1), (y0 + 1).min(sh - 1));+ let (tx, ty) = ((fx - x0 as f64) as f32, (fy - y0 as f64) as f32);+ for (c, d) in dst.iter_mut().enumerate() {+ let top = px(x0, y0, c) * (1.0 - tx) + px(x1, y0, c) * tx;+ let bottom = px(x0, y1, c) * (1.0 - tx) + px(x1, y1, c) * tx;+ *d = top * (1.0 - ty) + bottom * ty;+ }}- }+ });out}@@ -217,18 +222,26 @@ fn plan(s: &Session, p: &Value, margin: i32) -> Result<Plan> {return Err(bad(CMD, format!("the selection is too large to move ({pixels} pixels, at most {MAX_PIXELS})")));}let map = placement(p, area, (dx, dy))?;- let dest = match &map {+ if map.is_none() && (dx, dy) == (0, 0) {+ return Err(bad(CMD, "drag the selection to where the content should go"));+ }+ let dest = landing(map.as_ref(), area, (dx, dy), canvas)?;+ let all_layers = flag(p, "sampleAllLayers", false) && targets_pixels(p);+ Ok(Plan { target: Target { id, all_layers }, canvas, area, offset: (dx, dy), map, dest, mode, structure, color, margin })+}++/// Where the content of `area` lands on `canvas`: moved by `offset`, or (Transform On Drop) the+/// bounds of the area mapped by `map`, clipped to the canvas.+fn landing(map: Option<&Homography>, area: Rect, (dx, dy): (i32, i32), canvas: Rect) -> Result<Rect> {+ match map {None => {- if (dx, dy) == (0, 0) {- return Err(bad(CMD, "drag the selection to where the content should go"));- }// Content dropped beyond the edge would be lost: keep it on the canvas, as the Patch// Tool does.let dest = area.translate(dx, dy);if !canvas.contains_rect(&dest) {return Err(bad(CMD, "the moved selection must stay inside the canvas"));}- dest+ Ok(dest)}Some(h) => {let landed = mapped_bounds(h, area);@@ -240,11 +253,9 @@ fn plan(s: &Session, p: &Value, margin: i32) -> Result<Plan> {if dest.is_empty() {return Err(bad(CMD, "the transformed selection must land on the canvas"));}- dest+ Ok(dest)}- };- let all_layers = flag(p, "sampleAllLayers", false) && targets_pixels(p);- Ok(Plan { target: Target { id, all_layers }, canvas, area, offset: (dx, dy), map, dest, mode, structure, color, margin })+ }}/// Width in pixels of the edge band re-synthesised at the new place, for Structure 1..7 and content@@ -528,18 +539,24 @@ pub(super) fn content_aware_move(s: &mut Session, p: &Value) -> Result<Value> {)}-/// Largest selection (bounding box, in pixels) the live preview computes.+/// Largest area (the selection's bounding box, or where it lands if that is larger, in pixels) a+/// preview solves at full resolution. A larger one is solved on a copy scaled down to about this+/// size ([`ContentAwarePreview::is_coarse`]).const PREVIEW_MAX_PIXELS: u64 = 256 * 256;/// Sampling margin of a preview: a fraction of the command's, so a preview is a small solve.const PREVIEW_MARGIN: i32 = 48;/// A live preview of `paint.contentAwareMove` that can run on any thread: the document as of-/// [`preview`], with the move's params. Cheaper than the command (a small sampling margin, and-/// only small selections), so the result is close to, not the same as, what the command makes.+/// [`preview`], with the move's params. Cheaper than the command: a small sampling margin, and a+/// selection larger than [`PREVIEW_MAX_PIXELS`] is solved scaled down and enlarged back (coarse).+/// The result is close to, not the same as, what the command makes; [`Self::refine`] gives the+/// command's own result for a coarse one.pub struct ContentAwarePreview {doc: std::sync::Arc<Document>,plan: Plan,params: Value,+ /// Below 1: the scale the move is solved at before it is enlarged back.+ scale: f64,}impl ContentAwarePreview {@@ -548,19 +565,197 @@ impl ContentAwarePreview {pub fn run(&self, ctx: &crate::jobs::JobCtx) -> Result<(Document, Rect)> {let mut work = (*self.doc).clone();let sel = self.doc.selection.as_ref().ok_or_else(|| bad(CMD, "select the area to move first"))?;+ if self.is_coarse() {+ let damage = run_scaled(&mut work, sel, &self.plan, &self.params, self.scale, ctx)?;+ return Ok((work, damage));+ }let (_, damage, _) = run_move(&mut work, sel, &self.plan, &self.params, ctx, "Content-Aware Move preview")?;Ok((work, damage))}++ /// Whether the preview is solved on a scaled-down copy (a selection larger than a preview+ /// solves at full resolution): fast, but softer than the result.+ pub fn is_coarse(&self) -> bool {+ self.scale < 1.0+ }++ /// For a coarse preview, the full-resolution one: exactly what `paint.contentAwareMove` makes+ /// (the command's sampling margin), and as slow. `None` when this preview already is at full+ /// resolution.+ pub fn refine(&self) -> Option<ContentAwarePreview> {+ self.is_coarse().then(|| ContentAwarePreview {+ doc: self.doc.clone(),+ plan: Plan { margin: MAX_MARGIN, ..self.plan },+ params: self.params.clone(),+ scale: 1.0,+ })+ }}/// Prepare the preview of `paint.contentAwareMove` with params `p` on the active document. Errors-/// like the command does, and for a selection larger than a preview takes.+/// as the command does (bad params, nothing to move, a selection larger than the command takes).pub fn preview(s: &Session, p: &Value) -> Result<ContentAwarePreview> {let plan = plan(s, p, PREVIEW_MARGIN)?;- let pixels = u64::from(plan.area.width()) * u64::from(plan.area.height());- if pixels > PREVIEW_MAX_PIXELS {- return Err(bad(CMD, format!("the selection is too large to preview ({pixels} pixels, at most {PREVIEW_MAX_PIXELS})")));- }+ let px = |r: Rect| u64::from(r.width()) * u64::from(r.height());+ let pixels = px(plan.area).max(px(plan.dest));+ let scale = if pixels > PREVIEW_MAX_PIXELS { (PREVIEW_MAX_PIXELS as f64 / pixels as f64).sqrt() } else { 1.0 };let d = s.active().ok_or(EngineError::NoDocument)?;- Ok(ContentAwarePreview { doc: d.doc.clone(), plan, params: p.clone() })+ Ok(ContentAwarePreview { doc: d.doc.clone(), plan, params: p.clone(), scale })+}++/// The surface's tiles over `r` (shared, not copied) on a surface of their own: what a resize of+/// that part reads.+fn crop(surf: &Surface, r: Rect) -> Surface {+ let mut all = surf.clone();+ let mut out = Surface::with_default(surf.format(), &surf.default_pixel());+ out.put_tiles(all.take_tiles(r));+ out+}++/// A translation by `(dx, dy)`.+fn shift(dx: f64, dy: f64) -> Homography {+ Homography([1.0, 0.0, dx, 0.0, 1.0, dy, 0.0, 0.0, 1.0])+}++/// [`run_move`] solved `scale` times smaller (`scale` < 1) and enlarged back: the area around the+/// selection and where it lands is scaled down (area average), moved there with a preview's+/// sampling margin, and the result enlarged (bilinear) over the selection's shape where it lands+/// and, for a move, where it left. The landed content is sampled where the scaled solve put it, so+/// rounding the scaled offset doesn't shift it. Writes into `doc` (a copy) and returns the+/// rectangle it changed.+fn run_scaled(doc: &mut Document, sel: &Surface, plan: &Plan, p: &Value, scale: f64, ctx: &crate::jobs::JobCtx) -> Result<Rect> {+ use photocraft_algo::resample::{Resample, resize_surface_in_canvas, scaled_rect};+ let f = scale;+ if !(f > 0.0 && f < 1.0) {+ return Err(EngineError::Other("internal error: a coarse preview needs a scale below 1".into()));+ }+ let (dx, dy) = plan.offset;+ let full_map = plan.map.unwrap_or_else(|| shift(f64::from(dx), f64::from(dy)));+ let full_inv = full_map.inverse().ok_or_else(|| bad(CMD, "the transform collapses the selection"))?;+ // What the scaled solve reads: both windows, with two scaled pixels to spare for the filter.+ let reach = (f64::from(PREVIEW_MARGIN + 2) / f).ceil().min(1e6) as i32;+ let reach_rect = plan.area.union(&plan.dest).inflate(reach).intersect(&plan.canvas);+ ctx.check()?;++ // 1. The pixels and the selection scaled down, on a document of their own (one layer).+ let fmt = crate::channel_cmds::target_surface(doc, plan.target.id, p)?.0.format();+ let src = if plan.target.all_layers {+ let region = read(doc, plan.target, p, reach_rect)?;+ let mut s = Surface::new(fmt);+ s.write_region(reach_rect, ®ion.data);+ s+ } else {+ crop(crate::channel_cmds::target_surface(doc, plan.target.id, p)?.0, reach_rect)+ };+ let small = resize_surface_in_canvas(&src, f, f, Resample::Bilinear, plan.canvas);+ let small_sel = resize_surface_in_canvas(&crop(sel, reach_rect), f, f, Resample::Bilinear, plan.canvas);+ ctx.check()?;+ let canvas = scaled_rect(plan.canvas, f, f);+ let size = photocraft_geom::Size { width: canvas.width(), height: canvas.height() };+ let mut mini = Document::new("Content-Aware Move preview", size, doc.mode, doc.depth);+ let layer = photocraft_doc::Layer::new("preview", LayerContent::Raster(small));+ let id = layer.id;+ mini.layers.push(layer);++ // 2. The move, scaled.+ let area = selection_area(&small_sel, canvas);+ if area.is_empty() {+ return Err(bad(CMD, "the selection is empty"));+ }+ let mut offset = ((f64::from(dx) * f).round() as i32, (f64::from(dy) * f).round() as i32);+ if plan.map.is_none() {+ // Rounding may push the scaled patch a pixel past the edge: keep it on the canvas.+ let moved = area.translate(offset.0, offset.1);+ offset.0 += (canvas.x0 - moved.x0).max(0) - (moved.x1 - canvas.x1).max(0);+ offset.1 += (canvas.y0 - moved.y0).max(0) - (moved.y1 - canvas.y1).max(0);+ }+ let map = match plan.map {+ Some(_) => placement(p, area, offset)?,+ None => None,+ };+ let dest = landing(map.as_ref(), area, offset, canvas)?;+ let small_plan = Plan { target: Target { id: Some(id), all_layers: false }, canvas, area, offset, map, dest, margin: PREVIEW_MARGIN, ..*plan };+ // The small document's layer is the target: no channel or mask targeting there.+ let mut small_p = p.clone();+ if let Some(o) = small_p.as_object_mut() {+ o.remove("target");+ }+ let (solved, _, _) = run_move(&mut mini, &small_sel, &small_plan, &small_p, ctx, "Content-Aware Move preview")?;+ ctx.check()?;++ // 3. Enlarged back over the selection's shape: where it lands (through the scaled placement)+ // and, for a move, where it left (in place).+ let solved = Region::read(&solved, scaled_rect(reach_rect, f, f).inflate(1).intersect(&canvas));+ let to_small = Homography([f, 0.0, 0.0, 0.0, f, 0.0, 0.0, 0.0, 1.0]);+ let small_map = map.unwrap_or_else(|| shift(f64::from(offset.0), f64::from(offset.1)));+ let cov = if plan.map.is_some() { coverage(sel, plan.area) } else { Vec::new() };+ let landed_in = |r: Rect| -> Vec<bool> {+ match &plan.map {+ None => mask(sel, r.translate(-dx, -dy)),+ Some(_) => landed_mask(&cov, plan.area, &full_inv, r),+ }+ };+ let landed = landed_in(plan.dest);+ let content = resample(&solved, &small_map.mul(&to_small).mul(&full_inv), plan.dest);+ let mut damage = replace(doc, plan.target, p, &content, &landed)?;+ if plan.mode == Mode::Move {+ ctx.check()?;+ let hole: Vec<bool> = mask(sel, plan.area).iter().zip(landed_in(plan.area)).map(|(s, l)| *s && !l).collect();+ if hole.iter().any(|h| *h) {+ damage = damage.union(&replace(doc, plan.target, p, &resample(&solved, &to_small, plan.area), &hole)?);+ }+ }+ Ok(damage)+}++#[cfg(test)]+mod tests {+ use super::*;+ use crate::jobs::JobCtx;++ fn textured(w: u32, h: u32) -> Session {+ let mut s = Session::new();+ s.execute("file.new", json!({"width": w, "height": h})).unwrap();+ s.edit("setup", |doc, active| {+ let b = doc.bounds();+ let surf = doc.layer_mut(active.unwrap()).unwrap().surface_mut().unwrap();+ let fmt = surf.format();+ let mut data = Vec::new();+ for y in b.y0..b.y1 {+ for x in b.x0..b.x1 {+ let v = ((x * 7 + y * 13) % 17) as f32 / 17.0;+ data.extend(photocraft_raster::from_rgba(&fmt, [v, 1.0 - v, 0.5, 1.0]));+ }+ }+ surf.write_region(b, &data);+ Ok(())+ })+ .unwrap();+ s+ }++ #[test]+ fn a_preview_within_the_full_resolution_budget_is_the_plain_solve_bit_for_bit() {+ let mut s = textured(300, 300);+ s.execute("select.rect", json!({"x": 20, "y": 30, "width": 60, "height": 50})).unwrap();+ for p in [json!({"offset": [120, 90]}), json!({"offset": [120, 90], "rotate": 30, "mode": "extend"})] {+ let job = preview(&s, &p).unwrap();+ assert!(!job.is_coarse());+ let (got, damage) = job.run(&JobCtx::new()).unwrap();+ // What the preview has always computed: the move at full resolution, with the+ // preview's margin.+ let plan = plan(&s, &p, PREVIEW_MARGIN).unwrap();+ let d = s.active().unwrap();+ let mut want = (*d.doc).clone();+ let (_, want_damage, _) = run_move(&mut want, d.doc.selection.as_ref().unwrap(), &plan, &p, &JobCtx::new(), "test").unwrap();+ let b = want.bounds();+ assert_eq!(damage, want_damage);+ assert!(got.layers[0].surface().unwrap().read_region(b) == want.layers[0].surface().unwrap().read_region(b), "{p}");+ }+ // 256 × 256 is the largest selection solved at full resolution.+ s.execute("select.rect", json!({"x": 0, "y": 0, "width": 256, "height": 256})).unwrap();+ assert!(!preview(&s, &json!({"offset": [20, 20]})).unwrap().is_coarse());+ s.execute("select.rect", json!({"x": 0, "y": 0, "width": 257, "height": 256})).unwrap();+ assert!(preview(&s, &json!({"offset": [20, 20]})).unwrap().is_coarse());+ }}diff --git a/crates/engine/src/retouch_cmds/tests.rs b/crates/engine/src/retouch_cmds/tests.rsindex e20706857..4c8e2e624 100644--- a/crates/engine/src/retouch_cmds/tests.rs+++ b/crates/engine/src/retouch_cmds/tests.rs@@ -1097,14 +1097,92 @@ fn content_aware_move_preview_shows_the_result_without_touching_the_session() {// The session is untouched.assert!(is_object(rgba(&s, 25, 31)) && !is_object(rgba(&s, 95, 31)));assert_eq!(s.active().unwrap().revision, before);- // A cancelled preview stops; a selection past the preview's size and bad params are errors.+ // A small selection is solved at full resolution, with nothing to refine.+ let job = content_aware_move_preview(&s, &p).unwrap();+ assert!(!job.is_coarse() && job.refine().is_none());+ // A cancelled preview stops; bad params are errors.let ctx = JobCtx::new();ctx.cancel();assert!(matches!(content_aware_move_preview(&s, &p).unwrap().run(&ctx), Err(EngineError::Cancelled)));assert!(content_aware_move_preview(&s, &json!({"offset": [0, 0]})).is_err());assert!(content_aware_move_preview(&s, &json!({"offset": [70, 0], "rotate": "x"})).is_err());- s.execute("select.rect", json!({"x": 0, "y": 0, "width": 300, "height": 300})).unwrap();- assert!(content_aware_move_preview(&s, &json!({"offset": [1, 0]})).is_err());+ assert!(content_aware_move_preview(&s, &json!({"offset": [70, 0], "mode": "copy"})).is_err());+}++/// A 30×30 object in the middle of a 400×300 selection (over the 256×256 a preview solves at full+/// resolution) on a 700×400 canvas, dragged by (250, 60).+fn large_move(depth: u64) -> Session {+ let mut s = session(700, 400, depth, "rgb");+ paint_layer(&mut s, |x, y| if (195..225).contains(&x) && (145..175).contains(&y) { [0.05, 0.1, 0.9, 1.0] } else { texture(x, y) });+ s.execute("select.rect", json!({"x": 10, "y": 10, "width": 400, "height": 300})).unwrap();+ s+}++#[test]+fn content_aware_move_previews_large_selections_coarse_then_exact_at_all_depths() {+ use crate::jobs::JobCtx;+ let p = json!({"offset": [250, 60]});+ for depth in DEPTHS {+ let mut s = large_move(depth);+ let before = s.active().unwrap().revision;+ let job = content_aware_move_preview(&s, &p).unwrap();+ assert!(job.is_coarse(), "depth {depth}: solved scaled down");+ let (coarse, damage) = job.run(&JobCtx::new()).unwrap();+ let px = |d: &Document, x, y| d.layers[0].surface().unwrap().rgba(x, y);+ // The object lands where the command puts it (its middle; the coarse pass softens the+ // edges) and its old place is filled.+ for (x, y) in [(460, 220), (470, 230), (455, 215), (465, 225)] {+ assert!(is_object(px(&coarse, x, y)), "depth {depth}: the object lands at {x},{y}: {:?}", px(&coarse, x, y));+ }+ for (x, y) in [(435, 220), (485, 220), (460, 195), (460, 245)] {+ assert!(!is_object(px(&coarse, x, y)), "depth {depth}: nothing of the object at {x},{y}");+ }+ assert!(!is_object(px(&coarse, 210, 160)), "depth {depth}: the old place is filled");+ assert!(damage.contains(470, 230) && damage.contains(210, 160), "{damage:?}");+ // Outside the selection and where it lands, nothing changes.+ for (x, y) in [(5, 5), (690, 20), (20, 390)] {+ assert_eq!(px(&coarse, x, y), rgba(&s, x, y), "depth {depth}: {x},{y} untouched");+ }+ // The session is untouched.+ assert!(is_object(rgba(&s, 210, 160)) && !is_object(rgba(&s, 460, 220)));+ assert_eq!(s.active().unwrap().revision, before);+ // Cancelled, either pass stops.+ let ctx = JobCtx::new();+ ctx.cancel();+ assert!(matches!(job.run(&ctx), Err(EngineError::Cancelled)), "depth {depth}");+ let fine = job.refine().unwrap();+ assert!(!fine.is_coarse() && fine.refine().is_none());+ assert!(matches!(fine.run(&ctx), Err(EngineError::Cancelled)), "depth {depth}");+ if depth != 8 {+ continue;+ }+ // The refined preview is the command's result, bit for bit.+ let (exact, _) = fine.run(&JobCtx::new()).unwrap();+ assert_eq!(s.active().unwrap().revision, before);+ s.execute("paint.contentAwareMove", p.clone()).unwrap();+ let b = exact.bounds();+ let made = s.active().unwrap().doc.layers[0].surface().unwrap().read_region(b);+ assert!(exact.layers[0].surface().unwrap().read_region(b) == made, "refined preview = command");+ }+}++#[test]+fn content_aware_move_coarse_preview_handles_transform_extend_and_limits() {+ use crate::jobs::JobCtx;+ let s = large_move(8);+ let px = |d: &Document, x, y| d.layers[0].surface().unwrap().rgba(x, y);+ // Transform On Drop: turned 90° about the selection's centre (210, 160), then moved; the+ // object sits at the centre, so it lands at (460, 220) either way.+ let (turned, _) = content_aware_move_preview(&s, &json!({"offset": [250, 60], "rotate": 90})).unwrap().run(&JobCtx::new()).unwrap();+ assert!(is_object(px(&turned, 460, 220)) && !is_object(px(&turned, 210, 160)));+ // Extend keeps the original.+ let (extended, _) = content_aware_move_preview(&s, &json!({"offset": [250, 60], "mode": "extend"})).unwrap().run(&JobCtx::new()).unwrap();+ assert!(is_object(px(&extended, 460, 220)) && is_object(px(&extended, 210, 160)));+ // Off the canvas, or past the command's own limit, is still an error.+ assert!(content_aware_move_preview(&s, &json!({"offset": [400, 0]})).is_err());+ let mut big = session(5000, 4000, 8, "rgb");+ big.execute("select.rect", json!({"x": 0, "y": 0, "width": 4500, "height": 3900})).unwrap();+ assert!(content_aware_move_preview(&big, &json!({"offset": [10, 10]})).is_err());}#[test]diff --git a/crates/ui-egui/src/cam_preview.rs b/crates/ui-egui/src/cam_preview.rsindex 4065e3353..45f6c5f1e 100644--- a/crates/ui-egui/src/cam_preview.rs+++ b/crates/ui-egui/src/cam_preview.rs@@ -1,16 +1,18 @@//! Content-Aware Move drags and its Transform On Drop box shown with the result: once the pointer//! (or the box) rests for a moment, the move is computed as a background job//! ([`photocraft_engine::retouch_cmds::content_aware_move_preview`]: a smaller sampling window than-//! the command and only small selections) and the canvas shows the document with it. Any change of-//! the offset, scale or rotation cancels the job and starts the wait again, so the UI never waits-//! for the blend. Releasing (or Enter) runs the exact `paint.contentAwareMove`; the document is-//! untouched until then. Not available on wasm (no threads).+//! the command) and the canvas shows the document with it. A selection too large to solve at once+//! shows a coarse result first (solved scaled down), then the exact one, computed as a second job.+//! Any change of the offset, scale or rotation cancels the jobs and starts the wait again, so the+//! UI never waits for the blend. Releasing (or Enter) runs the exact `paint.contentAwareMove`; the+//! document is untouched until then. Not available on wasm (no threads).use std::sync::Arc;use std::sync::mpsc::{Receiver, TryRecvError};use photocraft_doc::{DocId, Document};use photocraft_engine::jobs::JobCtx;+use photocraft_engine::retouch_cmds::ContentAwarePreview;use serde_json::Value;use crate::PhotocraftApp;@@ -27,6 +29,10 @@ struct Running {key: String,ctx: JobCtx,rx: Receiver<photocraft_engine::Result<Document>>,+ /// The full-resolution job that follows a coarse one.+ refine: Option<ContentAwarePreview>,+ /// This job refines a coarse preview already shown: its failure leaves that one shown.+ refining: bool,}pub(crate) struct CamPreview {@@ -35,7 +41,7 @@ pub(crate) struct CamPreview {/// The params the move has now, and when they last changed (ms).key: String,since: f64,- /// Params whose preview failed (too large a selection, say): not tried again.+ /// Params whose preview failed (a locked layer, say): not tried again.failed: Option<String>,running: Option<Running>,/// The latest finished preview, with the params it shows.@@ -126,15 +132,21 @@ fn step(app: &mut PhotocraftApp, now: f64) -> Option<(Arc<Document>, u64)> {(Ok(d), Some(r)) => {// Duotone documents display through their inks.let d = photocraft_engine::mode_cmds::display_document(&d).unwrap_or(d);- p.shown = Some((r.key, Arc::new(d)));+ p.shown = Some((r.key.clone(), Arc::new(d)));p.serial += 1;+ // A coarse result: the exact one follows.+ if let Some(job) = r.refine {+ p.running = spawn(job, r.key, true);+ }}+ // A failed refinement leaves the coarse result shown.+ (_, Some(r)) if r.refining => {}(_, Some(r)) => p.failed = Some(r.key),_ => {}}}Err(TryRecvError::Disconnected) => {- if let Some(r) = p.running.take() {+ if let Some(r) = p.running.take().filter(|r| !r.refining) {p.failed = Some(r.key);}}@@ -158,6 +170,12 @@ fn step(app: &mut PhotocraftApp, now: f64) -> Option<(Arc<Document>, u64)> {/// Compute the preview of `params` on a worker thread.fn start(app: &PhotocraftApp, params: &Value, key: String) -> Option<Running> {let job = photocraft_engine::retouch_cmds::content_aware_move_preview(&app.session, params).ok()?;+ spawn(job, key, false)+}++/// Run `job` on a worker thread (`refining` a coarse preview already shown).+fn spawn(job: ContentAwarePreview, key: String, refining: bool) -> Option<Running> {+ let refine = job.refine();let ctx = JobCtx::new();let (tx, rx) = std::sync::mpsc::channel();let worker = ctx.clone();@@ -167,7 +185,7 @@ fn start(app: &PhotocraftApp, params: &Value, key: String) -> Option<Running> {let _ = tx.send(job.run(&worker).map(|(d, _)| d));}).ok()?;- Some(Running { key, ctx, rx })+ Some(Running { key, ctx, rx, refine, refining })}/// Keep frames coming while a preview waits out its debounce or computes.@@ -268,18 +286,72 @@ mod tests {assert!(step(&mut app, now + 1.0).is_none() && app.cam_preview.is_none());}+ /// Step until the canvas shows a preview with a key past `after`, or give up after a while.+ fn wait_for(app: &mut PhotocraftApp, now: &mut f64, after: u64) -> Option<(Arc<Document>, u64)> {+ for _ in 0..6000 {+ if let Some(shown) = step(app, *now).filter(|s| s.1 > after) {+ return Some(shown);+ }+ std::thread::sleep(std::time::Duration::from_millis(10));+ *now += 10.0;+ }+ None+ }+#[test]- fn a_selection_too_large_to_preview_is_not_retried() {+ fn a_large_selection_shows_a_coarse_result_then_the_exact_one() {let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());app.run("file.new", json!({"width": 600, "height": 400})).unwrap();+ app.run("paint.pencil", json!({"points": [[150, 160], [170, 160]], "size": 12, "color": "#0000ff"})).unwrap();app.run("select.rect", json!({"x": 10, "y": 10, "width": 300, "height": 300})).unwrap();app.ui.tool = Tool::ContentAwareMove;let m = egui::Modifiers::NONE;tool_event(&mut app, ToolEvent::Down { x: 100.0, y: 100.0, pressure: 1.0 }, m);- tool_event(&mut app, ToolEvent::Move { x: 140.0, y: 100.0, pressure: 1.0 }, m);+ tool_event(&mut app, ToolEvent::Move { x: 340.0, y: 100.0, pressure: 1.0 }, m);assert!(step(&mut app, 0.0).is_none());- assert!(step(&mut app, DEBOUNCE_MS + 1.0).is_none());+ let mut now = DEBOUNCE_MS;+ // First the coarse result, while the exact one computes.+ let (coarse, first) = wait_for(&mut app, &mut now, 0).expect("a coarse preview");+ assert!(blue(&coarse, 400, 160) && !blue(&coarse, 160, 160), "the coarse preview shows the move");+ let refining = app.cam_preview.as_ref().unwrap().running.as_ref().is_some_and(|r| r.refining);+ assert!(refining || app.cam_preview.as_ref().unwrap().serial > 1, "the exact result follows");+ // Then the exact one: the command's own result.+ let (exact, _) = wait_for(&mut app, &mut now, first).expect("the exact preview");+ assert!(app.cam_preview.as_ref().unwrap().running.is_none() && showing(&app));+ assert!(!blue(&app.session.active().unwrap().doc, 400, 160), "the document is untouched");+ tool_event(&mut app, ToolEvent::Up { x: 340.0, y: 100.0 }, m);+ let doc = app.session.active().unwrap().doc.clone();+ let b = doc.bounds();+ assert!(+ exact.layers[0].surface().unwrap().read_region(b) == doc.layers[0].surface().unwrap().read_region(b),+ "the exact preview is what release makes"+ );+ }++ #[test]+ fn a_failed_preview_is_not_retried() {+ let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());+ app.run("file.new", json!({"width": 100, "height": 60})).unwrap();+ app.run("select.rect", json!({"x": 6, "y": 14, "width": 32, "height": 32})).unwrap();+ app.run("layer.lockLayers", json!({"pixels": true})).unwrap();+ app.ui.tool = Tool::ContentAwareMove;+ let m = egui::Modifiers::NONE;+ tool_event(&mut app, ToolEvent::Down { x: 22.0, y: 30.0, pressure: 1.0 }, m);+ tool_event(&mut app, ToolEvent::Move { x: 72.0, y: 30.0, pressure: 1.0 }, m);+ assert!(step(&mut app, 0.0).is_none());+ let mut now = DEBOUNCE_MS;+ for _ in 0..3000 {+ assert!(step(&mut app, now).is_none(), "nothing to show");+ if app.cam_preview.as_ref().unwrap().failed.is_some() {+ break;+ }+ std::thread::sleep(std::time::Duration::from_millis(10));+ now += 10.0;+ }let p = app.cam_preview.as_ref().unwrap();- assert!(p.running.is_none() && p.failed.as_deref() == Some(p.key.as_str()));+ assert!(p.running.is_none() && p.shown.is_none() && p.failed.as_deref() == Some(p.key.as_str()));+ // Resting longer starts nothing new.+ assert!(step(&mut app, now + 1000.0).is_none());+ assert!(app.cam_preview.as_ref().unwrap().running.is_none());}}diff --git a/docs/gaps.md b/docs/gaps.mdindex faf0884c8..1862eb564 100644--- a/docs/gaps.md+++ b/docs/gaps.md@@ -1,6 +1,6 @@# Where PhotoCraft falls short of Photoshop-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (G1: smart filter masks show on PSD open, Photoshop-oracle floor 188/258; G10: DPX read and write, #1049, Cineon read; G1: CMYK Hue/Saturation and Color Balance keep the black ink; G1: CMYK Posterize on the stored values, psd-tools oracle floor 242/309; G1: CMYK adjustment layers composite on the document's inks, Photoshop-oracle floor 165/258; G1: CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; G1: modern Brightness/Contrast's brightness curve matches Photoshop, Photoshop-oracle floor 151/258; G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-16 · **Change:** minor (G7: Content-Aware Move previews every selection the command takes, coarse then exact, TOOL-213-4 done, #6680; G1: smart filter masks show on PSD open, Photoshop-oracle floor 188/258; G10: DPX read and write, #1049, Cineon read; G1: CMYK Hue/Saturation and Color Balance keep the black ink; G1: CMYK Posterize on the stored values, psd-tools oracle floor 242/309; G1: CMYK adjustment layers composite on the document's inks, Photoshop-oracle floor 165/258; G1: CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; G1: modern Brightness/Contrast's brightness curve matches Photoshop, Photoshop-oracle floor 151/258; G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026Every known shortfall against Photoshop 2026 (27.11.0), one entry each, ranked by user impacton the way to beta. This is the work list agents pick from: take the highest-ranked entry that@@ -66,9 +66,10 @@ what an agent can't finish alone.### G7. Workspaces shown as parameter dialogs- **Missing:** Select and Mask workspace layout(TOOL-214-1, Refine Hair #2671; its view modes preview live since #1754, Refine Edge Brush #2972); Content-Aware Fill workspace with a paintable sampling area- (TOOL-214-15); Vanishing Point plane editor (TOOL-214-14); Content-Aware Move's live preview- of the result (TOOL-213-4; Transform On Drop and Content-Aware Scale through the transform box,- TOOL-214-7, are done).+ (TOOL-214-15); Vanishing Point plane editor (TOOL-214-14). Content-Aware Move's live preview+ of the result is done (TOOL-213-4, 2026-10-16, #6680: every selection the command takes, coarse+ first for large ones, then the exact result), as are Transform On Drop and Content-Aware Scale+ through the transform box (TOOL-214-7).Blur Gallery: Field, Iris, Tilt-Shift and Spin Blur are edited on the image with Photoshop's pinsand handles (2026-10-11, #3373); Tilt-Shift has one band (the engine takes one), and Path Blur(#1759) is still a parameter dialog.@@ -270,6 +271,7 @@ what an agent can't finish alone.| Date | Change | Summary ||---|---|---|+| 2026-10-16 | minor | G7: Content-Aware Move's live preview covers every selection the command takes (over 256 × 256: a coarse result solved scaled down, then the exact one); TOOL-213-4 done (#6680) || 2026-10-14 | minor | G1: a PSD smart object's filter mask shows when the file opens (Photoshop stores the filtered pixels unmasked); export stores them that way too; Photoshop-oracle floor 185 → 188 of 258 || 2026-10-13 | minor | G14: D90 image area measured (4288 × 2848 at (10, 10)); gap remains open || 2026-10-14 | minor | Corpus floors raised to the measured results of the CMYK, Lab, 32-bit, Levels, Threshold, Posterize, feather and pass-through fixes landed together: Photoshop-authored 165 → 185 of 258, io 146 → 148 of 170, psd-tools 242 → 249 of 309 |diff --git a/docs/scorecard.md b/docs/scorecard.mdindex 377ce8583..366a4a255 100644--- a/docs/scorecard.md+++ b/docs/scorecard.md@@ -8,7 +8,7 @@ Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.js|---|---:|---:|---:|---|| [Performance](#performance) | 3 | 22 | 24 | 58 scenarios: 3 within budget, 22 over budget or failing, 9 tracked only, 19 not run, 5 not measurable yet (baseline 2026-10-05) || [File compatibility](#file-compatibility) | 7 | 14 | 6 | io corpus: oracle ≥ 148/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 249/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 188/256, round trip ≥ 258/256 |-| [Tools](#tools) | 33 | 11 | 0 | |+| [Tools](#tools) | 34 | 10 | 0 | || [Workspace and UI](#workspace-and-ui) | 13 | 6 | 4 | settings that do nothing: 26 of 168 (target 0) || [Type](#type) | 4 | 3 | 2 | || [Automation](#automation) | 5 | 2 | 4 | 631 of 631 menu items live (100.0%) |@@ -135,7 +135,7 @@ Corpus floors (`crates/io/tests/corpus.rs`): the enforced minimums; the corpus t| TOOL-213-1 | Pencil tool: aliased 1 px painting, square pixel-aligned cursor | done | [#213](https://github.com/storytold/photocraft/issues/213) | Tool::Pencil (B group): live aliased strokes on the pixel grid, square cursor, Auto Erase; pencil_tests.rs || TOOL-213-2 | Mixer Brush tool on the toolbar | done | [#213](https://github.com/storytold/photocraft/issues/213) | Tool::MixerBrush in the Brush (B) flyout; Wet/Load/Mix/Flow/Sample All Layers options, command/control dispatch and selection-clipping tests || TOOL-213-3 | Patch tool with a live preview of the patched area | done | [#213](https://github.com/storytold/photocraft/issues/213) | paint.patch (retouch_cmds/patch.rs, source/destination) + Tool::Patch (J group: lasso, then drag the selection); the drag shows the heal live (patch_preview.rs, coarse colour fit: 1000x1000 in 52 ms) |-| TOOL-213-4 | Content-Aware Move tool reusing inpaint completion | partial | [#213](https://github.com/storytold/photocraft/issues/213) | paint.contentAwareMove (retouch_cmds/content_aware_move.rs: move/extend, Structure 1-7, Color 0-10, Sample All Layers, Transform On Drop's scaleX/scaleY/rotate; background job) + Tool::ContentAwareMove (J group: lasso, then drag; Transform On Drop puts a scale/rotate box on the dropped patch, cam_transform.rs: Enter commits as one step, Esc cancels). cam_preview.rs: once the pointer or the box rests, the result shows (a cancellable background job on a smaller sampling window, small selections only, #4385). Missing: a progressive preview for big selections |+| TOOL-213-4 | Content-Aware Move tool reusing inpaint completion | done | [#213](https://github.com/storytold/photocraft/issues/213) | paint.contentAwareMove (retouch_cmds/content_aware_move.rs: move/extend, Structure 1-7, Color 0-10, Sample All Layers, Transform On Drop's scaleX/scaleY/rotate; background job) + Tool::ContentAwareMove (J group: lasso, then drag; Transform On Drop puts a scale/rotate box on the dropped patch, cam_transform.rs: Enter commits as one step, Esc cancels). cam_preview.rs: once the pointer or the box rests, the result shows (a cancellable background job on a smaller sampling window, #4385); a selection over 256x256 shows a coarse result solved scaled down first, then the command's exact result as a second job (#6680; 24 MP document, release: 600x400 coarse 0.26 s then exact 0.8 s, 1500x1000 0.38 s then 4.1 s, 3000x2000 0.69 s then 9.4 s; was no preview above 256x256). Tests: content_aware_move_previews_large_selections_coarse_then_exact_at_all_depths, content_aware_move_coarse_preview_handles_transform_extend_and_limits, a_preview_within_the_full_resolution_budget_is_the_plain_solve_bit_for_bit, a_large_selection_shows_a_coarse_result_then_the_exact_one || TOOL-213-5 | Painting a type/shape/smart/fill layer offers to rasterize, then continues the stroke | done | [#213](https://github.com/storytold/photocraft/issues/213) | rasterize_prompt.rs: OK rasterizes then paints (two history states), Cancel does nothing; drivable via ui.dialog.confirm || TOOL-213-6 | Fill dialog: contents, blend, opacity, preserve transparency; remembered; Shift+Backspace | done | [#213](https://github.com/storytold/photocraft/issues/213) | fill_ui.rs dialog over edit.fill (fill_cmds.rs): all contents, mode, opacity, preserve; remembered in prefs; Shift+F5 / Shift+Backspace || TOOL-213-7 | Live stroke preview for every brush-based retouch tool | partial | [#213](https://github.com/storytold/photocraft/issues/213) | Live (canvas.rs strokes_live): Brush, Pencil, Eraser, Blur, Sharpen, Smudge, Dodge, Burn, Sponge, Clone Stamp, Healing Brush, History Brush (#1026, #1040); the release commits the live stroke's pixels (P32). Not yet live: Spot Healing Brush, Mixer Brush, Background Eraser, Pattern Stamp |diff --git a/docs/target-app-parity.md b/docs/target-app-parity.mdindex c798116f8..3d42ced99 100644--- a/docs/target-app-parity.md+++ b/docs/target-app-parity.md@@ -1,6 +1,6 @@# PhotoCraft vs Adobe Photoshop: target-app parity-> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-13 · **Change:** minor (on-canvas corner radius widgets, TOOL-214-12; `.atn` import maps 112 events; Free Transform H/V skew fields; stale rows corrected against `main` and the scorecard, estimates unchanged; Photoshop Actions `.atn` load and save; 2026-10-10: Tilt-Shift measurements added; earlier the same day: major, full re-measure against Photoshop 2026 27.11.0; merged `parity-estimate.md` and the roadmap's honest assessment; stale missing-tool rows corrected: Color Replacement and Red Eye are live toolbar tools, Frame landed; percentages unchanged) · **Target:** Adobe Photoshop 2026+> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-16 · **Change:** minor (Content-Aware Move live preview for every selection size, TOOL-213-4 done, #6680; on-canvas corner radius widgets, TOOL-214-12; `.atn` import maps 112 events; Free Transform H/V skew fields; stale rows corrected against `main` and the scorecard, estimates unchanged; Photoshop Actions `.atn` load and save; 2026-10-10: Tilt-Shift measurements added; earlier the same day: major, full re-measure against Photoshop 2026 27.11.0; merged `parity-estimate.md` and the roadmap's honest assessment; stale missing-tool rows corrected: Color Replacement and Red Eye are live toolbar tools, Frame landed; percentages unchanged) · **Target:** Adobe Photoshop 2026The authoritative answer to "how close is PhotoCraft to Photoshop, and how much work is left". Theone-page summary is [`ROADMAP.md`](../ROADMAP.md); the ranked work list is [`gaps.md`](gaps.md);@@ -444,7 +444,7 @@ filled bar. This extends UI reachability and does not claim Photoshop-authored s| Smart filters / text / effect shapes in PSDs | Measured on our Photoshop-authored set (https://github.com/storytold/photocraft-corpus, `corpus/photoshop`, 258 files): see the per-group floors in `crates/io/tests/corpus.rs` and `crates/engine/tests/photoshop_oracles.rs`. Smart objects and smart filters now survive PSD save and open (41 corpus files, 206 smart objects, round trip strict; Photoshop opens our exports with live filters); re-rendering Photoshop's smart filters with ours matches 5/30 (was 1/30) | low–medium | Remaining re-render gaps are filter maths (Gaussian/Motion Blur, Unsharp Mask, Emboss, Add Noise RNG) and bicubic placement. || Core editing (layers, masks, selections, adjustments, filters, transforms) | Broad engine coverage; many interaction bugs fixed after 0.2.0 (adjustment dialogs, Curves, crop, Move/Transform modifiers, gesture origin) | medium | Fixes not yet user-validated. || UI / UX polish | Shortcut audit 214 → 0 failures; dock, Layers rows and menus reworked; first visual-QA sweep found 14 defects (#147–#157). 2026-10-07: the keyboard-only shortcuts with no menu item (⌥[ ⌥] ⌥, ⌥. layer navigation, ⇧⌥[ ⇧⌥] to extend the selection, 1–0 for opacity and ⇧ for flow or fill, ⇧[ ⇧] hardness, ⌥⌘T to transform a copy and ⌥⇧⌘T to step and repeat), ⌥-click colour sampling with painting tools, double-click a Layers row for Layer Style, File › New from Clipboard, a centred main window and remembered Liquify settings (#352, #417, #350, #368, #419, #418). 2026-10-09: canvas zoom is physical at any display scale — 100% is one document pixel per physical display pixel, and every screen-space overlay, cursor, scrollbar, navigator and fit follows it (#1943) | low–medium | Needs recurring visual QA with realistic documents. |-| Tools | 2026-10-10: Pencil, Mixer Brush, Color Replacement, Patch, Content-Aware Move, Vertical Type, Pattern Stamp and Rotate View are toolbar tools. The only tool still missing is Art History Brush: Frame landed (#2914), Red Eye is a live toolbar tool (`paint.redEye`, TOOL-213-17) and Perspective Crop landed (2026-10-10, #1043, `image.perspectiveCrop`) | low–medium | Patch has a live healing preview. Content-Aware Move is partial: Move/Extend, Structure/Color and Sample All Layers exist; Transform On Drop and a live result preview remain missing (`TOOL-213-4` in the scorecard). Magic/Background Eraser added; live gradients in progress (#180). Magnetic Lasso added 2026-10-08 (live-wire edge tracing, Width/Contrast/Frequency, `select.magneticLasso`). Pattern Stamp added 2026-10-08 (S flyout, `paint.patternStamp`, Aligned / Impressionist). Rotate View (2026-10-09) turns the canvas camera around its centre without rewriting pixels; Reset View and Match Rotation copy the angle. Crop rotation (2026-10-09, #1792): dragging outside the crop frame turns it (⇧ 15° steps, angle readout), and ↵ rotates the document and crops in one undo step (`image.crop` `angle`); the frame turns over the image as in Photoshop's Classic Mode, and the options-bar Straighten is still missing. |+| Tools | 2026-10-10: Pencil, Mixer Brush, Color Replacement, Patch, Content-Aware Move, Vertical Type, Pattern Stamp and Rotate View are toolbar tools. The only tool still missing is Art History Brush: Frame landed (#2914), Red Eye is a live toolbar tool (`paint.redEye`, TOOL-213-17) and Perspective Crop landed (2026-10-10, #1043, `image.perspectiveCrop`) | low–medium | Patch has a live healing preview. Content-Aware Move is done (`TOOL-213-4`): Move/Extend, Structure/Color, Sample All Layers, Transform On Drop, and a live result preview for every selection the command takes (coarse first for large ones, then exact; 2026-10-16, #6680). Magic/Background Eraser added; live gradients in progress (#180). Magnetic Lasso added 2026-10-08 (live-wire edge tracing, Width/Contrast/Frequency, `select.magneticLasso`). Pattern Stamp added 2026-10-08 (S flyout, `paint.patternStamp`, Aligned / Impressionist). Rotate View (2026-10-09) turns the canvas camera around its centre without rewriting pixels; Reset View and Match Rotation copy the angle. Crop rotation (2026-10-09, #1792): dragging outside the crop frame turns it (⇧ 15° steps, angle readout), and ↵ rotates the document and crops in one undo step (`image.crop` `angle`); the frame turns over the image as in Photoshop's Classic Mode, and the options-bar Straighten is still missing. || Painting | Brush model and Brush Settings panel near Photoshop; .abr/.grd import; persistent presets; pen pressure/tilt on Windows, web, macOS and X11 | medium | Native Wayland pen input open (#79; a pen opens the window through Xwayland meanwhile); X11 pressure confirmed by a user, macOS not yet verified on tablet hardware. || Text / typography | Engine works; caret placement and size editing fixed; OpenType features, text-on-path editing, composer parity partial | medium-low | Measure with the Photoshop-authored set. || Colour management | Colour-managed canvas (document → monitor), embedded CMYK profiles, linear EXR/HDR, 16-bit float canvas | medium-high | Monitor profile follows only at launch. |@@ -553,7 +553,7 @@ See [method, raw measurements and reproduction](five-algorithm-performance.md).checked against Photoshop's output on every build. Their pass rate becomes the headline paritynumber.4. **Tool coverage and workflow depth:** Pen variants (Direct Selection landed, #790; Add/Delete Anchor Point, #1044);- finish Content-Aware Move's Transform On Drop and live result preview.+ Content-Aware Move's Transform On Drop and live result preview are done (2026-10-16).Pencil, Mixer Brush, Patch, Vertical Type, Pattern Stamp and Rotate View are already available on the toolbar.5. **Complex-document performance** (#125/#128) and GPU tiling beyond the texture limit (#49).6. **Recurring visual QA** (`cargo run -p photocraft-engine --example designer_psd`) and fast@@ -565,6 +565,7 @@ See [method, raw measurements and reproduction](five-algorithm-performance.md).| Date | Change | Summary ||---|---|---|+| 2026-10-16 | minor | Content-Aware Move: live result preview for every selection the command takes (TOOL-213-4 done, #6680); percentages unchanged || 2026-10-13 | minor | Vector shapes: on-canvas corner radius widgets on live rectangles (TOOL-214-12); estimates unchanged || 2026-10-13 | minor | Stale "missing tool" rows corrected against main: Color Replacement (`paint.colorReplacement`), Red Eye (`paint.redEye`) and Add/Delete Anchor Point (the Pen flyout) are live toolbar tools and Frame landed, so Art History Brush is the only tool still missing; percentages unchanged || 2026-10-12 | minor | Free Transform options bar H/V skew fields; percentages unchanged |diff --git a/scorecard/tools.toml b/scorecard/tools.tomlindex 51f6b1cf3..dd4eb88ff 100644--- a/scorecard/tools.toml+++ b/scorecard/tools.toml@@ -29,9 +29,9 @@ note = "paint.patch (retouch_cmds/patch.rs, source/destination) + Tool::Patch (J[[item]]id = "TOOL-213-4"target = "Content-Aware Move tool reusing inpaint completion"-status = "partial"+status = "done"issue = 213-note = "paint.contentAwareMove (retouch_cmds/content_aware_move.rs: move/extend, Structure 1-7, Color 0-10, Sample All Layers, Transform On Drop's scaleX/scaleY/rotate; background job) + Tool::ContentAwareMove (J group: lasso, then drag; Transform On Drop puts a scale/rotate box on the dropped patch, cam_transform.rs: Enter commits as one step, Esc cancels). cam_preview.rs: once the pointer or the box rests, the result shows (a cancellable background job on a smaller sampling window, small selections only, #4385). Missing: a progressive preview for big selections"+note = "paint.contentAwareMove (retouch_cmds/content_aware_move.rs: move/extend, Structure 1-7, Color 0-10, Sample All Layers, Transform On Drop's scaleX/scaleY/rotate; background job) + Tool::ContentAwareMove (J group: lasso, then drag; Transform On Drop puts a scale/rotate box on the dropped patch, cam_transform.rs: Enter commits as one step, Esc cancels). cam_preview.rs: once the pointer or the box rests, the result shows (a cancellable background job on a smaller sampling window, #4385); a selection over 256x256 shows a coarse result solved scaled down first, then the command's exact result as a second job (#6680; 24 MP document, release: 600x400 coarse 0.26 s then exact 0.8 s, 1500x1000 0.38 s then 4.1 s, 3000x2000 0.69 s then 9.4 s; was no preview above 256x256). Tests: content_aware_move_previews_large_selections_coarse_then_exact_at_all_depths, content_aware_move_coarse_preview_handles_transform_extend_and_limits, a_preview_within_the_full_resolution_budget_is_the_plain_solve_bit_for_bit, a_large_selection_shows_a_coarse_result_then_the_exact_one"[[item]]id = "TOOL-213-5"