From b1a939f2654f41acd82e584e4d9fd898bb473af5 Mon Sep 17 00:00:00 2001 From: paulou-jpg <79102098+paulou-jpg@users.noreply.github.com> Date: Wed, 14 Oct 2026 02:59:01 -0700 Subject: [PATCH 1/2] Mode dropdowns for Clone Stamp, Pattern Stamp, History Brush, Healing and Paint Bucket Photoshop gives these painting tools a Mode in the options bar; here they always painted in Normal. - Clone Stamp, Pattern Stamp and History Brush offer the layer modes, and Healing its own list (Normal, Multiply, Screen, Darken, Lighten, Color, Luminosity). The mode is kept in each tool's own brush, like its size, and reaches the live stroke and the commit. - Paint Bucket: paint.bucket takes "mode" (any blend mode, or "clear" to erase the filled area). algo's bucket fill gains a FillMode for it. The options bar's Mode has Clear after Dissolve, as the Brush's does. - A tool's first brush now starts in Normal instead of inheriting the previous tool's mode, so a Multiply Brush no longer makes the first Clone Stamp stroke multiply. - The Shift+Alt letter and Shift+Plus/Minus mode keys reach these tools, within each tool's menu. Tools with no blend mode (the Erasers, Mixer Brush, Dodge, Burn, Sponge) now pass the keys to the selected layers. Not yet: Healing's Replace mode, and a Mode for Spot Healing, Color Replacement, Blur, Sharpen and Smudge (they ignore the keys meanwhile). Co-Authored-By: Claude Opus 5.5 --- crates/algo/src/paint.rs | 63 +++-- crates/engine/src/paint_cmds.rs | 54 ++++- crates/ui-egui/src/blend_keys.rs | 219 ++++++++++++++---- crates/ui-egui/src/canvas.rs | 5 +- .../src/options_bar_mode_wheel_tests.rs | 37 ++- crates/ui-egui/src/paint_mouse.rs | 7 +- crates/ui-egui/src/panels.rs | 37 ++- crates/ui-egui/src/retouch_ui.rs | 57 ++++- crates/ui-egui/src/state.rs | 6 + crates/ui-egui/src/tool_reset.rs | 2 +- docs/brush-parity.md | 11 +- docs/ui-parity.md | 5 +- 12 files changed, 410 insertions(+), 93 deletions(-) diff --git a/crates/algo/src/paint.rs b/crates/algo/src/paint.rs index c32f28c648a..a206c0c9a32 100644 --- a/crates/algo/src/paint.rs +++ b/crates/algo/src/paint.rs @@ -5,6 +5,14 @@ use photocraft_geom::Rect; use photocraft_raster::{Surface, from_rgba_into}; use serde::{Deserialize, Serialize}; +/// How a fill lays down its colour: blended with a mode, or Clear, which erases what it covers +/// (the Paint Bucket's Mode › Clear). +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum FillMode { + Blend(BlendMode), + Clear, +} + /// Gradient tool shape. #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Default)] #[serde(rename_all = "camelCase")] @@ -59,7 +67,7 @@ pub fn sample_stops(stops: &[(f32, [f32; 4])], t: f32) -> [f32; 4] { fn composite_area( s: &mut Surface, area: Rect, - blend_mode: BlendMode, + mode: FillMode, coverage: impl Fn(i32, i32) -> f32 + Sync, color: impl Fn(i32, i32) -> [f32; 4] + Sync, lock_transparency: bool, @@ -89,7 +97,10 @@ fn composite_area( let i = ((y - r.y0) as usize * w + (x - r.x0) as usize) * n; let px = &mut region[i..i + n]; let d = photocraft_raster::to_rgba(&fmt, px); - let mut o = blend::composite(blend_mode, d, color(x, y), k); + let mut o = match mode { + FillMode::Blend(m) => blend::composite(m, d, color(x, y), k), + FillMode::Clear => [d[0], d[1], d[2], d[3] * (1.0 - k.min(1.0))], + }; if lock_transparency { o[3] = d[3]; } @@ -97,7 +108,7 @@ fn composite_area( // A colour picked as CMYK inks replaces fully covered pixels of a CMYK target as it is. if let Some(i) = inks && fmt.mode == photocraft_color::ColorMode::Cmyk - && blend_mode == BlendMode::Normal + && mode == FillMode::Blend(BlendMode::Normal) && k >= 1.0 { enc[..4].copy_from_slice(&i); @@ -138,7 +149,7 @@ pub fn paint_gradient( composite_area( s, area, - blend_mode, + FillMode::Blend(blend_mode), |x, y| opacity * selection.map_or(1.0, |m| m.sample_channel(x, y, 0)), |x, y| { let t = tool_gradient_t(shape, from, to, x as f32 + 0.5, y as f32 + 0.5); @@ -190,11 +201,12 @@ pub fn bucket_fill_src( lock_transparency: bool, src: impl Fn(i32, i32) -> [f32; 4] + Sync, ) -> bool { - bucket_fill_inks(s, area, seed, tolerance, contiguous, anti_alias, opacity, selection, lock_transparency, src, None) + bucket_fill_inks(s, area, seed, tolerance, contiguous, anti_alias, opacity, selection, lock_transparency, src, None, FillMode::Blend(BlendMode::Normal)) } /// [`bucket_fill_src`] where `inks` (CMYK, 0..1) are what a fully covered pixel of a CMYK target -/// gets instead of `src`'s sRGB stand-in (a colour that was picked as CMYK). +/// gets instead of `src`'s sRGB stand-in (a colour that was picked as CMYK), laid down with `mode` +/// (the options bar's Mode). #[allow(clippy::too_many_arguments)] pub fn bucket_fill_inks( s: &mut Surface, @@ -208,6 +220,7 @@ pub fn bucket_fill_inks( lock_transparency: bool, src: impl Fn(i32, i32) -> [f32; 4] + Sync, inks: Option<[f32; 4]>, + mode: FillMode, ) -> bool { if !area.contains(seed.0, seed.1) { return false; @@ -215,7 +228,7 @@ pub fn bucket_fill_inks( let img = crate::selection::rgba8_image(s, area); let Some(region) = crate::selection::wand_region(&img, area, seed, tolerance, contiguous, anti_alias) else { return false }; drop(img); - bucket_fill_region_inks(s, ®ion, opacity, selection, lock_transparency, src, inks); + bucket_fill_region_inks(s, ®ion, opacity, selection, lock_transparency, src, inks, mode); true } @@ -229,10 +242,11 @@ pub fn bucket_fill_region_src( lock_transparency: bool, src: impl Fn(i32, i32) -> [f32; 4] + Sync, ) { - bucket_fill_region_inks(s, region, opacity, selection, lock_transparency, src, None); + bucket_fill_region_inks(s, region, opacity, selection, lock_transparency, src, None, FillMode::Blend(BlendMode::Normal)); } -/// [`bucket_fill_region_src`] with the CMYK `inks` of [`bucket_fill_inks`]. +/// [`bucket_fill_region_src`] with the CMYK `inks` and the `mode` of [`bucket_fill_inks`]. +#[allow(clippy::too_many_arguments)] pub fn bucket_fill_region_inks( s: &mut Surface, region: &crate::selection::Region, @@ -241,18 +255,11 @@ pub fn bucket_fill_region_inks( lock_transparency: bool, src: impl Fn(i32, i32) -> [f32; 4] + Sync, inks: Option<[f32; 4]>, + mode: FillMode, ) { // Composite only over the filled region's box. let b = region.bbox; - composite_area( - s, - b, - BlendMode::Normal, - |x, y| region.at(x, y) * opacity * selection.map_or(1.0, |m| m.sample_channel(x, y, 0)), - src, - lock_transparency, - inks, - ); + composite_area(s, b, mode, |x, y| region.at(x, y) * opacity * selection.map_or(1.0, |m| m.sample_channel(x, y, 0)), src, lock_transparency, inks); } #[cfg(test)] @@ -320,4 +327,24 @@ mod tests { assert_eq!(s.rgba(-1, 4), [0.0; 4], "outside the selection"); assert_eq!(s.rgba(-4, 4), [0.0; 4], "outside the region"); } + + /// The Paint Bucket's Mode: Multiply darkens what's there, Clear erases it (half at 50 %). + #[test] + fn bucket_mode_blends_or_clears() { + let a = Rect::new(0, 0, 4, 1); + let grey = [0.5, 0.5, 0.5, 1.0]; + for fmt in [PixelFormat::RGBA8, PixelFormat::RGBA16, PixelFormat::RGBA32F] { + let mut s = Surface::new(fmt); + s.fill_rect(a, &grey); + let red = |_, _| [1.0, 0.0, 0.0, 1.0]; + assert!(bucket_fill_inks(&mut s, a, (0, 0), 0.0, true, false, 1.0, None, false, red, None, FillMode::Blend(BlendMode::Multiply))); + let px = s.rgba(1, 0); + assert!((px[0] - 0.5).abs() < 0.01 && px[1] < 0.01 && (px[3] - 1.0).abs() < 1e-3, "{fmt:?} multiply: {px:?}"); + assert!(bucket_fill_inks(&mut s, a, (0, 0), 0.0, true, false, 0.5, None, false, red, None, FillMode::Clear)); + assert!((s.rgba(1, 0)[3] - 0.5).abs() < 0.01, "{fmt:?} clear at 50 %"); + // Locked transparency keeps the alpha, so Clear does nothing. + assert!(bucket_fill_inks(&mut s, a, (0, 0), 0.0, true, false, 1.0, None, true, red, None, FillMode::Clear)); + assert!((s.rgba(1, 0)[3] - 0.5).abs() < 0.01, "{fmt:?} locked"); + } + } } diff --git a/crates/engine/src/paint_cmds.rs b/crates/engine/src/paint_cmds.rs index 497d7f4fb18..7f23c6b8ba0 100644 --- a/crates/engine/src/paint_cmds.rs +++ b/crates/engine/src/paint_cmds.rs @@ -1,6 +1,6 @@ //! Paint helpers: Paint Bucket and Gradient tool. -use photocraft_algo::paint::{GradientShape, bucket_fill_inks, bucket_fill_region_inks, bucket_fill_region_src, bucket_fill_src, paint_gradient}; +use photocraft_algo::paint::{FillMode, GradientShape, bucket_fill_inks, bucket_fill_region_inks, paint_gradient}; use serde_json::{Value, json}; use crate::commands::{CommandSpec, blend_from_str}; @@ -41,12 +41,27 @@ fn opacity(p: &Value, cmd: &str) -> Result { Ok(crate::eraser_cmds::number(p, cmd, "opacity", 100.0, 1.0..=100.0)? as f32 / 100.0) } +/// The Paint Bucket's `mode`: a blend mode (not Pass Through, a group's) or `clear`. +fn fill_mode(p: &Value) -> Result { + let bad = |msg: String| EngineError::BadParams { cmd: "paint.bucket".into(), msg }; + match p.get("mode") { + None | Some(Value::Null) => Ok(FillMode::Blend(photocraft_color::BlendMode::Normal)), + Some(Value::String(m)) if m.eq_ignore_ascii_case("clear") => Ok(FillMode::Clear), + Some(Value::String(m)) => blend_from_str(m) + .filter(|m| *m != photocraft_color::BlendMode::PassThrough) + .map(FillMode::Blend) + .ok_or_else(|| bad(format!("unknown blend mode `{m}`"))), + Some(v) => Err(bad(format!("`mode` must be a blend mode name or `clear`, not {v}"))), + } +} + fn bucket(s: &mut Session, p: &Value) -> Result { let fg = s.tools.foreground; let c = color(p.get("color"), fg); let (x, y) = (f(p, "x", 0.0).floor() as i32, f(p, "y", 0.0).floor() as i32); let (tol, contiguous, aa) = (f(p, "tolerance", 32.0), b(p, "contiguous", true), b(p, "antiAlias", true)); let opacity = opacity(p, "paint.bucket")?; + let mode = fill_mode(p)?; let all = b(p, "sampleAllLayers", false) && crate::channel_cmds::target_of(p) == crate::channel_cmds::Target::Pixels; // Other visible layers can define the region, but the fill still writes only to the target. let region = if all { @@ -83,16 +98,16 @@ fn bucket(s: &mut Session, p: &Value) -> Result { let w = area.width() as usize; let src = |px: i32, py: i32| rendered[(py - area.y0) as usize * w + (px - area.x0) as usize]; if let Some(region) = ®ion { - bucket_fill_region_src(surf, region, opacity, sel.as_ref(), lock, src); + bucket_fill_region_inks(surf, region, opacity, sel.as_ref(), lock, src, None, mode); true } else { - bucket_fill_src(surf, area, (x, y), tol, contiguous, aa, opacity, sel.as_ref(), lock, src) + bucket_fill_inks(surf, area, (x, y), tol, contiguous, aa, opacity, sel.as_ref(), lock, src, None, mode) } } else if let Some(region) = ®ion { - bucket_fill_region_inks(surf, region, opacity, sel.as_ref(), lock, |_, _| c, inks); + bucket_fill_region_inks(surf, region, opacity, sel.as_ref(), lock, |_, _| c, inks, mode); true } else { - bucket_fill_inks(surf, area, (x, y), tol, contiguous, aa, opacity, sel.as_ref(), lock, |_, _| c, inks) + bucket_fill_inks(surf, area, (x, y), tol, contiguous, aa, opacity, sel.as_ref(), lock, |_, _| c, inks, mode) }; surf.prune(); Ok(ok) @@ -162,7 +177,7 @@ pub fn specs() -> Vec { label: "Paint Bucket", menu: &[], shortcut: None, - params: r##"{"x":px,"y":px,"tolerance":0..255=32,"contiguous":bool=true,"antiAlias":bool=true,"sampleAllLayers":bool=false,"contents":"foreground|pattern"="foreground","color":"#rrggbb"=foreground,"pattern":id|name (contents=pattern),"scale":%=100,"angle":deg,"opacity":1..100=100,"target":"pixels"|"mask"|"quickMask"|{"channel":i}=Channels panel target}"##, + params: r##"{"x":px,"y":px,"tolerance":0..255=32,"contiguous":bool=true,"antiAlias":bool=true,"sampleAllLayers":bool=false,"contents":"foreground|pattern"="foreground","color":"#rrggbb"=foreground,"pattern":id|name (contents=pattern),"scale":%=100,"angle":deg,"opacity":1..100=100,"mode":"normal|multiply|…|clear (erases the filled area)"="normal","target":"pixels"|"mask"|"quickMask"|{"channel":i}=Channels panel target}"##, enabled: crate::commands::has_paintable, run: bucket, journal: true, @@ -210,6 +225,33 @@ mod tests { (s, bottom) } + /// The options bar's Mode reaches the fill: Multiply over grey, Clear erases, a bad name or + /// Pass Through is an error and changes nothing. + #[test] + fn bucket_mode_multiplies_clears_and_rejects_bad_names() { + for depth in [8, 16, 32] { + let mut s = Session::new(); + s.execute("file.new", json!({"width": 8, "height": 8, "depth": depth})).unwrap(); + s.execute("layer.new.layer", json!({})).unwrap(); + let base = json!({"x": 1, "y": 1, "antiAlias": false, "tolerance": 0}); + let with = |extra: Value| { + let mut p = base.clone(); + p.as_object_mut().unwrap().extend(extra.as_object().unwrap().clone()); + p + }; + s.execute("paint.bucket", with(json!({"color": "#808080"}))).unwrap(); + s.execute("paint.bucket", with(json!({"color": "#ff0000", "mode": "multiply"}))).unwrap(); + let p = px(&s, 3, 3); + assert!((p[0] - 0.5).abs() < 0.01 && p[1] < 0.01 && p[3] > 0.99, "depth {depth}: {p:?}"); + for bad in [json!("passThrough"), json!("sparkle"), json!(3)] { + assert!(s.execute("paint.bucket", with(json!({"mode": bad}))).is_err(), "{bad}"); + } + assert_eq!(px(&s, 3, 3), p, "a refused mode paints nothing"); + s.execute("paint.bucket", with(json!({"mode": "Clear", "opacity": 50}))).unwrap(); + assert!((px(&s, 3, 3)[3] - 0.5).abs() < 0.01, "depth {depth}: half cleared"); + } + } + #[test] fn bucket_sample_all_layers_uses_visible_boundaries_at_all_depths() { for depth in [8, 16, 32] { diff --git a/crates/ui-egui/src/blend_keys.rs b/crates/ui-egui/src/blend_keys.rs index 81bd10026dd..8f4af6c363e 100644 --- a/crates/ui-egui/src/blend_keys.rs +++ b/crates/ui-egui/src/blend_keys.rs @@ -1,8 +1,8 @@ //! Blend mode keys, as in Photoshop. ⇧+ and ⇧− step through the modes (#3102), and ⇧⌥ plus a -//! letter picks one (⇧⌥M Multiply, ⇧⌥S Screen…). With a painting tool that has a mode of its own -//! they set that tool's mode and never the layer's: the Brush's or Pencil's (which also offer -//! Clear), the Gradient's; the other painting tools are left alone until their options bar has a -//! Mode. With any other tool (Move, the selection tools…) they set every selected layer's mode. +//! letter picks one (⇧⌥M Multiply, ⇧⌥S Screen…). With a painting tool that has a Mode of its own +//! (`tool_modes`: Brush, Pencil, Paint Bucket, Gradient, the stamps, History Brush, Healing) they +//! set that tool's mode within its menu and never the layer's. With a tool that has no blend mode +//! (Move, the selection tools, the Erasers…) they set every selected layer's mode. //! The step list wraps at either end. Each press is one call of an engine command per layer //! (`tools.setBrush`, `layer.setProps`), coalesced into one undo step. @@ -116,43 +116,85 @@ pub fn handle(app: &mut PhotocraftApp, ctx: &egui::Context) { } } +/// Photoshop's Healing Brush modes, less Replace (not implemented yet). +pub const HEALING_MODES: [BlendMode; 7] = + [BlendMode::Normal, BlendMode::Multiply, BlendMode::Screen, BlendMode::Darken, BlendMode::Lighten, BlendMode::Color, BlendMode::Luminosity]; + +/// A painting tool's options-bar Mode menu in order, `None` being Clear (after Dissolve, on the +/// tools Photoshop offers it on). `None` for a tool without a blend mode control. +pub fn tool_modes(tool: Tool) -> Option>> { + let layer = || BlendMode::LAYER_MODES.iter().copied().map(Some).collect::>(); + Some(match tool { + Tool::Brush | Tool::Pencil | Tool::PaintBucket => { + let mut modes = layer(); + let at = modes.iter().position(|m| *m == Some(BlendMode::Dissolve)).map_or(modes.len(), |i| i + 1); + modes.insert(at, None); + modes + } + Tool::Gradient | Tool::CloneStamp | Tool::PatternStamp | Tool::HistoryBrush => layer(), + Tool::Healing => HEALING_MODES.iter().copied().map(Some).collect(), + _ => return None, + }) +} + /// Where the active tool's blend mode keys go. enum Target { - /// The Brush's or Pencil's mode, Clear included. - Paint, - Gradient, - /// A painting tool whose mode has no options-bar control yet (or the Eraser, which has none): - /// the keys do nothing, and never reach the layer. + /// The tool's own Mode, one of these. + Tool(Vec>), + /// A painting tool with a blend mode in Photoshop but no Mode control here yet: the keys do + /// nothing, and never reach the layer. Nothing, Layers, } fn target(tool: Tool) -> Target { + if let Some(modes) = tool_modes(tool) { + return Target::Tool(modes); + } match tool { - Tool::Brush | Tool::Pencil => Target::Paint, - Tool::Gradient => Target::Gradient, - t if t.is_brushlike() || t == Tool::MagicEraser || t == Tool::PaintBucket => Target::Nothing, + Tool::SpotHealing | Tool::ColorReplacement | Tool::Blur | Tool::Sharpen | Tool::Smudge => Target::Nothing, + // No blend mode of their own (the Erasers, Dodge, Sponge…): the layer's, as in Photoshop. _ => Target::Layers, } } -/// The Brush's or Pencil's mode list: the layer modes with Clear (`None`) after Dissolve, as in -/// its options-bar dropdown. -fn paint_modes() -> Vec> { - let mut modes: Vec> = BlendMode::LAYER_MODES.iter().copied().map(Some).collect(); - let at = modes.iter().position(|m| *m == Some(BlendMode::Dissolve)).map_or(modes.len(), |i| i + 1); - modes.insert(at, None); - modes +/// The active tool's mode, `None` being Clear. A brush-based tool's lives in its own brush. +pub fn tool_mode(app: &mut PhotocraftApp) -> Option { + let o = &app.ui.tool_options; + match app.ui.tool { + Tool::Brush if o.brush_clear => None, + Tool::Pencil if o.pencil_clear => None, + Tool::PaintBucket if o.bucket_clear => None, + Tool::PaintBucket => Some(o.bucket_blend_mode), + Tool::Gradient => Some(o.gradient_blend_mode), + _ => { + crate::paint_mouse::sync_tool_brush(app); + Some(app.session.tools.brush.mode) + } + } } -/// The Brush's or Pencil's Clear flag. -fn clear_flag(app: &mut PhotocraftApp) -> &mut bool { - if app.ui.tool == Tool::Pencil { &mut app.ui.tool_options.pencil_clear } else { &mut app.ui.tool_options.brush_clear } -} - -/// Sets the Brush's or Pencil's mode; `None` is Clear. -fn set_paint_mode(app: &mut PhotocraftApp, mode: Option) { - *clear_flag(app) = mode.is_none(); +/// Sets the active tool's mode; `None` is Clear. +fn set_tool_mode(app: &mut PhotocraftApp, mode: Option) { + match app.ui.tool { + Tool::Gradient => { + if let Some(m) = mode { + set_gradient_mode(app, m); + } + return; + } + Tool::PaintBucket => { + app.ui.tool_options.bucket_clear = mode.is_none(); + if let Some(m) = mode { + app.ui.tool_options.bucket_blend_mode = m; + } + return; + } + Tool::Brush => app.ui.tool_options.brush_clear = mode.is_none(), + Tool::Pencil => app.ui.tool_options.pencil_clear = mode.is_none(), + _ => {} + } + crate::paint_mouse::sync_tool_brush(app); if let Some(m) = mode && let Ok(m) = serde_json::to_value(m) { @@ -189,15 +231,10 @@ fn set_layers_mode(app: &mut PhotocraftApp, mode: BlendMode) { /// layer's. pub fn press(app: &mut PhotocraftApp, step: i32) { match target(app.ui.tool) { - Target::Paint => { - let current = if *clear_flag(app) { None } else { Some(app.session.tools.brush.mode) }; - if let Some(mode) = stepped(&paint_modes(), current, step) { - set_paint_mode(app, mode); - } - } - Target::Gradient => { - if let Some(mode) = stepped(&BlendMode::LAYER_MODES, app.ui.tool_options.gradient_blend_mode, step) { - set_gradient_mode(app, mode); + Target::Tool(modes) => { + let current = tool_mode(app); + if let Some(mode) = stepped(&modes, current, step) { + set_tool_mode(app, mode); } } Target::Nothing => {} @@ -216,14 +253,21 @@ pub fn press(app: &mut PhotocraftApp, step: i32) { } } -/// One ⇧⌥ letter press. A mode the target doesn't have (Clear or Behind for layers, Pass Through -/// for a painting tool) does nothing. +/// One ⇧⌥ letter press. A mode the target's menu doesn't have (Clear or Behind for layers, Pass +/// Through for a painting tool, Overlay for the Healing Brush) does nothing. pub fn pick_mode(app: &mut PhotocraftApp, pick: Pick) { - match (target(app.ui.tool), pick) { - (Target::Paint, Pick::Mode(m)) if m != BlendMode::PassThrough => set_paint_mode(app, Some(m)), - (Target::Paint, Pick::Clear) => set_paint_mode(app, None), - (Target::Gradient, Pick::Mode(m)) if m != BlendMode::PassThrough => set_gradient_mode(app, m), - (Target::Layers, Pick::Mode(m)) => set_layers_mode(app, m), + let want = match pick { + Pick::Mode(m) => Some(m), + Pick::Clear => None, + Pick::Behind => return, + }; + match target(app.ui.tool) { + Target::Tool(modes) if modes.contains(&want) => set_tool_mode(app, want), + Target::Layers => { + if let Some(m) = want { + set_layers_mode(app, m); + } + } _ => {} } } @@ -459,20 +503,20 @@ mod tests { assert_eq!(layer_blend(&a), BlendMode::Normal); } - /// The Gradient takes the letters; a painting tool without a Mode control yet (Clone Stamp) - /// ignores them rather than changing the layer. + /// The Gradient takes the letters; Smudge, which has a blend mode in Photoshop but no Mode + /// control here yet, ignores them rather than changing the layer. #[test] - fn gradient_takes_the_letters_and_clone_stamp_ignores_them() { + fn gradient_takes_the_letters_and_smudge_ignores_them() { let ctx = egui::Context::default(); let mut a = app(Tool::Gradient); alt_shift(&mut a, &ctx, Key::O, Key::O); assert_eq!(a.ui.tool_options.gradient_blend_mode, BlendMode::Overlay); alt_shift(&mut a, &ctx, Key::R, Key::R); - assert_eq!(a.ui.tool_options.gradient_blend_mode, BlendMode::Overlay); - a.ui.tool = Tool::CloneStamp; + assert_eq!(a.ui.tool_options.gradient_blend_mode, BlendMode::Overlay, "no Clear for the Gradient"); + a.ui.tool = Tool::Smudge; alt_shift(&mut a, &ctx, Key::M, Key::M); assert_eq!(layer_blend(&a), BlendMode::Normal); - assert_eq!(a.ui.tool, Tool::CloneStamp); + assert_eq!(a.ui.tool, Tool::Smudge); let mut none = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default()); pick_mode(&mut none, Pick::Mode(BlendMode::Multiply)); } @@ -529,4 +573,81 @@ mod tests { assert_eq!(layer_blend(&a), BlendMode::Screen); assert!(a.distort.puppet.is_some(), "the warp stays open"); } + + /// The stamps and the History Brush keep their mode in their own brush: the keys set it there, + /// never the layer's, and another tool's brush keeps its own. + #[test] + fn clone_stamp_pattern_stamp_and_history_brush_take_the_keys_into_their_own_brush() { + let ctx = egui::Context::default(); + let mut a = app(Tool::Brush); + alt_shift(&mut a, &ctx, Key::M, Key::M); + for (tool, key, mode) in + [(Tool::CloneStamp, Key::S, BlendMode::Screen), (Tool::PatternStamp, Key::O, BlendMode::Overlay), (Tool::HistoryBrush, Key::K, BlendMode::Darken)] + { + a.ui.tool = tool; + assert_eq!(tool_mode(&mut a), Some(BlendMode::Normal), "{tool:?} starts in Normal"); + alt_shift(&mut a, &ctx, key, key); + assert_eq!(tool_mode(&mut a), Some(mode), "{tool:?}"); + alt_shift(&mut a, &ctx, Key::R, Key::R); + assert_eq!(tool_mode(&mut a), Some(mode), "{tool:?} has no Clear"); + key_press(&mut a, &ctx, 1); + assert_ne!(tool_mode(&mut a), Some(mode), "{tool:?} steps"); + assert_eq!(layer_blend(&a), BlendMode::Normal, "{tool:?} leaves the layer alone"); + } + a.ui.tool = Tool::Brush; + assert_eq!(tool_mode(&mut a), Some(BlendMode::Multiply), "the Brush keeps its own mode"); + } + + fn key_press(a: &mut PhotocraftApp, ctx: &egui::Context, step: i32) { + key(a, ctx, if step > 0 { Key::Plus } else { Key::Minus }, egui::Modifiers::SHIFT); + } + + /// The Healing Brush's menu is short: letters outside it do nothing, and ⇧+ steps within it. + #[test] + fn healing_brush_takes_only_its_own_modes() { + let ctx = egui::Context::default(); + let mut a = app(Tool::Healing); + alt_shift(&mut a, &ctx, Key::O, Key::O); + assert_eq!(tool_mode(&mut a), Some(BlendMode::Normal), "Overlay isn't a Healing mode"); + alt_shift(&mut a, &ctx, Key::Y, Key::Y); + assert_eq!(tool_mode(&mut a), Some(BlendMode::Luminosity)); + key_press(&mut a, &ctx, 1); + assert_eq!(tool_mode(&mut a), Some(BlendMode::Normal), "wraps within the Healing list"); + key_press(&mut a, &ctx, 1); + assert_eq!(tool_mode(&mut a), Some(BlendMode::Multiply)); + assert_eq!(layer_blend(&a), BlendMode::Normal); + } + + /// The Paint Bucket has its own Mode, Clear included. + #[test] + fn paint_bucket_takes_the_keys_with_clear() { + let ctx = egui::Context::default(); + let mut a = app(Tool::PaintBucket); + alt_shift(&mut a, &ctx, Key::M, Key::M); + assert_eq!(a.ui.tool_options.bucket_blend_mode, BlendMode::Multiply); + alt_shift(&mut a, &ctx, Key::R, Key::R); + assert!(a.ui.tool_options.bucket_clear); + key_press(&mut a, &ctx, 1); + assert!(!a.ui.tool_options.bucket_clear); + assert_eq!(a.ui.tool_options.bucket_blend_mode, BlendMode::Darken, "Clear is followed by Darken"); + assert_eq!(layer_blend(&a), BlendMode::Normal); + } + + /// Tools without a blend mode of their own (the Erasers, Dodge, the Mixer Brush) pass the keys + /// to the selected layers, as Photoshop does. + #[test] + fn tools_without_a_blend_mode_set_the_layer() { + let ctx = egui::Context::default(); + for (tool, key, mode) in [ + (Tool::Eraser, Key::M, BlendMode::Multiply), + (Tool::MagicEraser, Key::S, BlendMode::Screen), + (Tool::Dodge, Key::O, BlendMode::Overlay), + (Tool::MixerBrush, Key::E, BlendMode::Difference), + ] { + let mut a = app(tool); + alt_shift(&mut a, &ctx, key, key); + assert_eq!(layer_blend(&a), mode, "{tool:?}"); + assert_eq!(a.ui.tool, tool); + } + } } diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index d2e535f3f64..8abfff411e8 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -709,7 +709,7 @@ fn begin_live_stroke(app: &PhotocraftApp) -> Option { EngineStroke::Dab(photocraft_engine::retouch_cmds::LiveDab::begin(&app.session, cmd, &p).ok()?) } else if let Some(cmd) = live_retouch_command(d.tool) { // The params `retouch_ui::finish_stroke` commits. - let mut p = if d.tool == Tool::HistoryBrush { json!({}) } else { crate::retouch_ui::clone_params(app)? }; + let mut p = if d.tool == Tool::HistoryBrush { crate::retouch_ui::history_brush_params(app) } else { crate::retouch_ui::clone_params(app)? }; p["points"] = json!(d.points); p["target"] = paint_target(app); EngineStroke::Retouch(photocraft_engine::retouch_cmds::LiveRetouch::begin(&app.session, cmd, &p).ok()?) @@ -5608,7 +5608,8 @@ pub fn tool_event(app: &mut PhotocraftApp, ev: ToolEvent, mods: egui::Modifiers) Tool::PaintBucket => { let o = app.ui.tool_options.clone(); let contents = if o.bucket_fill_pattern { "pattern" } else { "foreground" }; - let _ = app.run("paint.bucket", json!({"x": x.floor(), "y": y.floor(), "tolerance": o.tolerance, "contiguous": o.contiguous, "antiAlias": o.anti_alias, "sampleAllLayers": o.sample_all.paint_bucket, "opacity": o.fill_opacity, "contents": contents, "target": paint_target(app)})); + let mode = if o.bucket_clear { "clear" } else { o.bucket_blend_mode.label() }; + let _ = app.run("paint.bucket", json!({"x": x.floor(), "y": y.floor(), "tolerance": o.tolerance, "contiguous": o.contiguous, "antiAlias": o.anti_alias, "sampleAllLayers": o.sample_all.paint_bucket, "opacity": o.fill_opacity, "contents": contents, "mode": mode, "target": paint_target(app)})); return; } Tool::RedEye => { diff --git a/crates/ui-egui/src/options_bar_mode_wheel_tests.rs b/crates/ui-egui/src/options_bar_mode_wheel_tests.rs index 068561b4a09..9e6d172a44e 100644 --- a/crates/ui-egui/src/options_bar_mode_wheel_tests.rs +++ b/crates/ui-egui/src/options_bar_mode_wheel_tests.rs @@ -1,5 +1,6 @@ -//! #2061: the scroll wheel over the options bar's Mode dropdown (Brush, Pencil, Gradient) steps -//! through the blend modes, as over the Layers panel's (#1747) and as in Photoshop. +//! #2061: the scroll wheel over the options bar's Mode dropdown (Brush, Pencil, Gradient, Paint +//! Bucket, the stamps, History Brush, Healing) steps through the blend modes, as over the Layers +//! panel's (#1747) and as in Photoshop. use egui::accesskit::Role; use egui::{Pos2, Rect, vec2}; @@ -81,3 +82,35 @@ fn the_wheel_over_the_gradient_mode_dropdown_steps_its_blend_mode() { wheel(&mut h, at, 1.0); assert_eq!(h.state().ui.tool_options.gradient_blend_mode, BlendMode::Dissolve); } + +/// The stamps, the History Brush and the Healing Brush have a Mode dropdown of their own brush's +/// mode; the Healing Brush's skips the modes it doesn't have. +#[test] +fn retouch_tools_have_a_mode_dropdown() { + for (tool, after_two) in [ + (Tool::CloneStamp, BlendMode::Darken), + (Tool::PatternStamp, BlendMode::Darken), + (Tool::HistoryBrush, BlendMode::Darken), + (Tool::Healing, BlendMode::Screen), + ] { + let mut h = harness(tool); + let at = mode_dropdown(&h).center(); + wheel(&mut h, at, -2.0); + assert_eq!(brush_mode(&h), after_two, "{tool:?}"); + assert_eq!(h.state().ui.tool, tool); + } +} + +/// The Paint Bucket's Mode dropdown has Clear after Dissolve, as the Brush's does. +#[test] +fn the_paint_bucket_mode_dropdown_has_clear() { + let mut h = harness(Tool::PaintBucket); + let at = mode_dropdown(&h).center(); + wheel(&mut h, at, -1.0); + assert_eq!(h.state().ui.tool_options.bucket_blend_mode, BlendMode::Dissolve); + wheel(&mut h, at, -1.0); + assert!(h.state().ui.tool_options.bucket_clear); + wheel(&mut h, at, -1.0); + assert!(!h.state().ui.tool_options.bucket_clear); + assert_eq!(h.state().ui.tool_options.bucket_blend_mode, BlendMode::Darken); +} diff --git a/crates/ui-egui/src/paint_mouse.rs b/crates/ui-egui/src/paint_mouse.rs index 6a19c9ff773..1188b70398e 100644 --- a/crates/ui-egui/src/paint_mouse.rs +++ b/crates/ui-egui/src/paint_mouse.rs @@ -31,8 +31,10 @@ pub fn sync_tool_brush(app: &mut PhotocraftApp) { save_brush(app, app.ui.brush_tool, current.clone()); app.session.tools.brush = match app.ui.tool_brushes.iter().find(|(t, _)| *t == tool) { Some((_, b)) => session_fields(¤t, b), - // A tool seen for the first time takes what the brush has, at Photoshop's smoothing. - None => BrushSettings { smoothing: first_smoothing(), ..current }, + // A tool seen for the first time takes what the brush has, at Photoshop's smoothing, but + // in Normal mode: each tool's Mode starts at Normal, so a Multiply Brush doesn't make the + // first Clone Stamp stroke multiply (or give Healing a mode its menu doesn't have). + None => BrushSettings { smoothing: first_smoothing(), mode: photocraft_color::BlendMode::Normal, ..current }, }; // The picked preset was the outgoing tool's brush: forget it, so Update Brush can't overwrite // that preset with this tool's brush. @@ -611,6 +613,7 @@ mod tests { // Mode, opacity, flow and the dynamics sections are per tool too. app.ui.tool = Tool::CloneStamp; sync_tool_brush(&mut app); + assert_eq!(mode(&brush(&app)), photocraft_color::BlendMode::Normal, "a new tool starts in Normal, not the Brush's Multiply"); app.run("tools.setBrush", json!({"brush": {"mode": "Screen", "opacity": 0.3}})).unwrap(); app.ui.tool = Tool::Brush; sync_tool_brush(&mut app); diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 18cef34c980..6fb870b93e0 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -1009,12 +1009,21 @@ pub fn options_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { crate::brush_picker::settings_toggle(app, ui); widgets::vline(ui, 22.0); } - if tool == Tool::CloneStamp { + if matches!(tool, Tool::CloneStamp | Tool::PatternStamp | Tool::HistoryBrush | Tool::Healing) { let before = app.session.tools.brush.clone(); let mut brush = before.clone(); - let width = if t.pro { 62.0 } else { 66.0 }; - percent_field(ui, tl!("Opacity"), &mut brush.opacity, 1.0..=100.0, width); - percent_field(ui, tl!("Flow"), &mut brush.flow, 1.0..=100.0, width); + // Mode is the tool's own brush's, kept per tool like its size. + if let Some(modes) = crate::blend_keys::tool_modes(tool) { + opt_label(ui, tl!("Mode")); + if let Some(Some(m)) = tool_mode_dropdown(ui, "retouch-mode", &modes, Some(brush.mode)) { + brush.mode = m; + } + } + if tool == Tool::CloneStamp { + let width = if t.pro { 62.0 } else { 66.0 }; + percent_field(ui, tl!("Opacity"), &mut brush.opacity, 1.0..=100.0, width); + percent_field(ui, tl!("Flow"), &mut brush.flow, 1.0..=100.0, width); + } crate::brush_panel::commit_gesture(app, ui.ctx(), &before, &brush); widgets::vline(ui, 22.0); } @@ -1267,6 +1276,17 @@ pub fn options_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { if widgets::dropdown(ui, "bucket-src", &mut src, &[(0u8, tl!("Foreground")), (1, tl!("Pattern"))], 100.0) { app.ui.tool_options.bucket_fill_pattern = src == 1; } + opt_label(ui, tl!("Mode")); + if let Some(modes) = crate::blend_keys::tool_modes(tool) { + let o = &mut app.ui.tool_options; + let current = if o.bucket_clear { None } else { Some(o.bucket_blend_mode) }; + if let Some(m) = tool_mode_dropdown(ui, "bucket-mode", &modes, current) { + o.bucket_clear = m.is_none(); + if let Some(m) = m { + o.bucket_blend_mode = m; + } + } + } opt_label(ui, tl!("Opacity")); widgets::value_field(ui, &mut app.ui.tool_options.fill_opacity, 1.0..=100.0, "%", 62.0); opt_label(ui, tl!("Tolerance")); @@ -4099,6 +4119,15 @@ fn brush_tip(p: &egui::Painter, c: egui::Pos2, rad: f32, hardness: f32, color: C /// The Brush's or Pencil's Mode dropdown: the blend modes, with Photoshop's painting-only Clear /// after Dissolve (#3439). Clear erases with the brush (`clear`); it shows while chosen, or while /// `~` is held (`held`). The wheel over it steps the mode, as over the Layers panel's (#2061). +/// A painting tool's Mode dropdown over `modes` (`None` is Clear); the wheel over it steps the +/// mode. Returns the mode picked this frame. +fn tool_mode_dropdown(ui: &mut egui::Ui, id: &str, modes: &[Option], current: Option) -> Option> { + let opts: Vec<(Option, &str)> = modes.iter().map(|m| (*m, m.map_or("Clear", BlendMode::label))).collect(); + let mut mode = current; + let chosen = widgets::dropdown_wheel_hovered(ui, id, &mut mode, &opts, 96.0).0; + chosen.last().copied() +} + fn paint_mode_dropdown(ui: &mut egui::Ui, id: &str, b: &mut photocraft_engine::BrushSettings, clear: &mut bool, held: bool) { let mut opts: Vec<(Option, &str)> = BlendMode::LAYER_MODES.iter().map(|m| (Some(*m), m.label())).collect(); let at = opts.iter().position(|o| o.0 == Some(BlendMode::Dissolve)).map_or(opts.len(), |i| i + 1); diff --git a/crates/ui-egui/src/retouch_ui.rs b/crates/ui-egui/src/retouch_ui.rs index 20efb9bc0bd..0f3da839475 100644 --- a/crates/ui-egui/src/retouch_ui.rs +++ b/crates/ui-egui/src/retouch_ui.rs @@ -27,7 +27,8 @@ pub(crate) fn alt_flipped(tool: Tool, alt: bool) -> Tool { /// point is set yet. pub(crate) fn clone_params(app: &PhotocraftApp) -> Option { let o = &app.ui.tool_options; - let mut p = json!({"aligned": o.clone_aligned, "sampleLayer": o.clone_sample}); + // The options bar's Mode is the tool's own brush's. + let mut p = json!({"aligned": o.clone_aligned, "sampleLayer": o.clone_sample, "mode": app.session.tools.brush.mode.label()}); if app.ui.tool == Tool::CloneStamp { p["wrap"] = json!(app.ui.view.pattern_preview); p["opacity"] = json!(app.session.tools.brush.opacity * 100.0); @@ -45,6 +46,12 @@ pub(crate) fn clone_params(app: &PhotocraftApp) -> Option { Some(p) } +/// History Brush params for the live preview and the commit (without `points` and `target`): the +/// options bar's Mode, which is the tool's own brush's. +pub(crate) fn history_brush_params(app: &PhotocraftApp) -> Value { + json!({"mode": app.session.tools.brush.mode.label()}) +} + /// The command and options-bar params (without `points` and `target`) of a sequential-dab tool: /// Blur, Sharpen, Smudge, Dodge, Burn, Sponge. Shared by the live preview and the commit. pub(crate) fn dab_params(app: &PhotocraftApp, tool: Tool) -> Option<(&'static str, Value)> { @@ -100,6 +107,7 @@ pub fn finish_stroke(app: &mut PhotocraftApp, tool: Tool, points: &[[f64; 3]], m "impressionist": o.pattern_stamp_impressionist, "scale": o.pattern_stamp_scale, "angle": o.pattern_stamp_angle, + "mode": app.session.tools.brush.mode.label(), }); if o.pattern_stamp_aligned && let Some(ph) = app.ui.pattern_stamp_phase @@ -125,7 +133,7 @@ pub fn finish_stroke(app: &mut PhotocraftApp, tool: Tool, points: &[[f64; 3]], m }; (if tool == Tool::Healing { "paint.healingBrush" } else { "paint.cloneStamp" }, p) } - Tool::HistoryBrush => ("paint.historyBrush", json!({})), + Tool::HistoryBrush => ("paint.historyBrush", history_brush_params(app)), Tool::Blur | Tool::Sharpen | Tool::Smudge | Tool::Dodge | Tool::Burn | Tool::Sponge => match dab_params(app, tool) { Some(cp) => cp, None => return false, @@ -781,6 +789,51 @@ mod tests { assert_eq!(params["flow"], 50.0); } + /// The options bar's Mode (each tool's own brush's) reaches the stamps', the History Brush's + /// and the Healing Brush's strokes, live and committed. + #[test] + fn retouch_mode_reaches_the_command() { + for (tool, cmd, mode) in [ + (Tool::CloneStamp, "paint.cloneStamp", "Multiply"), + (Tool::Healing, "paint.healingBrush", "Luminosity"), + (Tool::HistoryBrush, "paint.historyBrush", "Screen"), + (Tool::PatternStamp, "paint.patternStamp", "Overlay"), + ] { + let mut app = app(); + app.ui.tool = tool; + crate::paint_mouse::sync_tool_brush(&mut app); + app.run("tools.setBrush", json!({"brush": {"mode": mode}})).unwrap(); + app.ui.clone_source = Some([10.0, 10.0]); + drag(&mut app, tool); + let (id, params) = app.session.journal.last().unwrap(); + assert_eq!((id.as_str(), params["mode"].as_str()), (cmd, Some(mode)), "{tool:?}"); + } + } + + /// The Paint Bucket's Mode reaches the fill: Multiply darkens, Clear erases. + #[test] + fn paint_bucket_mode_reaches_the_fill() { + let mut app = app(); + app.run("layer.new.layer", json!({})).unwrap(); + app.ui.tool = Tool::PaintBucket; + app.session.tools.foreground = [0.5, 0.5, 0.5, 1.0]; + let click = |app: &mut PhotocraftApp| { + let m = egui::Modifiers::NONE; + tool_event(app, ToolEvent::Down { x: 20.0, y: 20.0, pressure: 1.0 }, m); + tool_event(app, ToolEvent::Up { x: 20.0, y: 20.0 }, m); + }; + click(&mut app); + app.session.tools.foreground = [1.0, 0.0, 0.0, 1.0]; + app.ui.tool_options.bucket_blend_mode = photocraft_color::BlendMode::Multiply; + click(&mut app); + let px = active(&app).surface().unwrap().rgba(20, 20); + assert!((px[0] - 0.5).abs() < 0.02 && px[1] < 0.02, "multiplied: {px:?}"); + app.ui.tool_options.bucket_clear = true; + click(&mut app); + assert_eq!(app.session.journal.last().unwrap().1["mode"], "clear"); + assert!(active(&app).surface().unwrap().rgba(20, 20)[3] < 0.01, "cleared"); + } + #[test] fn clone_without_a_source_names_the_platform_modifier() { // Option-click on the Mac, Alt-click elsewhere (#251). diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 974d3fde358..3d4c248f8ad 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -535,6 +535,10 @@ pub struct ToolOptions { pub fill_opacity: f32, /// Paint Bucket fill source: false = Foreground colour, true = Pattern (Patterns panel selection). pub bucket_fill_pattern: bool, + /// Paint Bucket › Mode (any layer mode; Clear is `bucket_clear`). + pub bucket_blend_mode: photocraft_color::BlendMode, + /// Paint Bucket › Mode: Clear, which erases the filled area (see `brush_clear`). + pub bucket_clear: bool, /// Type tool: family, style name, size (pt), anti-aliasing and paragraph alignment. pub type_font: String, pub type_style: String, @@ -828,6 +832,8 @@ impl Default for ToolOptions { gradient_blend_mode: photocraft_color::BlendMode::Normal, fill_opacity: 100.0, bucket_fill_pattern: false, + bucket_blend_mode: photocraft_color::BlendMode::Normal, + bucket_clear: false, type_font: "Inter".into(), type_style: "Regular".into(), type_size: 48.0, diff --git a/crates/ui-egui/src/tool_reset.rs b/crates/ui-egui/src/tool_reset.rs index 3c154d3a45c..b672b0825f6 100644 --- a/crates/ui-egui/src/tool_reset.rs +++ b/crates/ui-egui/src/tool_reset.rs @@ -190,7 +190,7 @@ pub fn option_keys(tool: Tool) -> &'static [&'static str] { Tool::ColorReplacement => reset!(cr_mode, cr_sampling, cr_limits, cr_tolerance, cr_anti_alias), Tool::MagicEraser => reset!(tolerance, anti_alias, contiguous, magic_eraser_opacity), Tool::Gradient => reset!(gradient_style, gradient_reverse, gradient_dither, gradient_classic, gradient_blend_mode, fill_opacity), - Tool::PaintBucket => reset!(bucket_fill_pattern, fill_opacity, tolerance, anti_alias, contiguous), + Tool::PaintBucket => reset!(bucket_fill_pattern, bucket_blend_mode, bucket_clear, fill_opacity, tolerance, anti_alias, contiguous), Tool::Type | Tool::VerticalType | Tool::HorizontalTypeMask | Tool::VerticalTypeMask => reset!(type_font, type_style, type_size, type_aa, type_align), Tool::Zoom => reset!(zoom_scrubby), Tool::SpotHealing => reset!(spot_type), diff --git a/docs/brush-parity.md b/docs/brush-parity.md index 5c75a3e55f9..18a62f69f13 100644 --- a/docs/brush-parity.md +++ b/docs/brush-parity.md @@ -1,6 +1,6 @@ # Brush and painting parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-14 · **Change:** minor (dragged preset tip preview; Hue Jitter amount track; Brush Settings minimum fields follow their Control; checkbox-only rows and non-destructive Smoothing switch; shaped-tip cursor follows the view; Color Replacement is a live toolbar tool; no brush-feel estimate changed) · **Target:** Adobe Photoshop 2026 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-14 · **Change:** minor (Mode for Clone Stamp, Pattern Stamp, History Brush, Healing and Paint Bucket; dragged preset tip preview; Hue Jitter amount track; Brush Settings minimum fields follow their Control; checkbox-only rows and non-destructive Smoothing switch; shaped-tip cursor follows the view; Color Replacement is a live toolbar tool; no brush-feel estimate changed) · **Target:** Adobe Photoshop 2026 Painting is where Photoshop users notice differences first, so it gets its own checklist: the brush engine (`crates/paint/src/brush.rs`), the Brush Settings UI @@ -92,10 +92,10 @@ tablets against Photoshop side by side. |---|---|---| | Brush, Pencil (aliased, Auto Erase), Eraser (Brush/Pencil/Block) | done | Pencil 1 px quality #2139 | | Mixer Brush (Wet, Load, Mix, Flow, Sample All Layers, Current Brush Load with Load Brush and Clean Brush, automatic Load and Clean) | partial | No live result while dragging, no Alt-click loading (#2247) | -| Clone Stamp (opacity, flow, aligned, sample, overlay) | partial | Clone Source W/H link and Alt target cursor (TOOL-213-8) | -| Pattern Stamp (aligned, impressionist) | done | | -| History Brush | done | Art History Brush missing | -| Spot Healing, Healing | partial | grain not matched on flat colour (#2104), "horrible in general" (#1092), stops responding after switching (#1751) | +| Clone Stamp (mode, opacity, flow, aligned, sample, overlay) | partial | Clone Source W/H link and Alt target cursor (TOOL-213-8) | +| Pattern Stamp (mode, aligned, impressionist) | done | | +| History Brush (mode) | done | Art History Brush missing | +| Spot Healing, Healing (Healing mode: Normal, Multiply, Screen, Darken, Lighten, Color, Luminosity) | partial | Healing's Replace mode and Spot Healing's Mode missing; grain not matched on flat colour (#2104), "horrible in general" (#1092), stops responding after switching (#1751) | | Blur, Sharpen, Smudge (premultiplied, Sample All Layers, spacing) | done | BUG-207-2/3, #2171 | | Dodge, Burn, Sponge | done | | | Background Eraser, Magic Eraser | done | | @@ -123,4 +123,5 @@ tablets against Photoshop side by side. | 2026-10-12 | minor | A shaped tip's cursor outline turns and flips with a rotated or flipped view, and follows pixel aspect correction | | 2026-10-13 | minor | Shape Dynamics and Transfer minimum inputs follow their Control and retain their values while disabled (#3825, partial). No brush-feel estimate changed. | | 2026-10-13 | minor | Hue Jitter uses the same themed amount slider as other jitter controls (#3825, partial). No brush-feel estimate changed. | +| 2026-10-14 | minor | Options-bar Mode for Clone Stamp, Pattern Stamp, History Brush and Healing (kept in each tool's brush) and Paint Bucket (with Clear); each tool's first brush starts in Normal. No brush-feel estimate changed. | | 2026-10-13 | minor | Dragging a brush preset shows its cached tip thumbnail and name in the Brushes panel and preset picker (#4225, partial). No brush-feel estimate changed. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index c01aee5c4d8..084bf3f87fe 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI parity: tools, handles, modifiers and feel -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-15 · **Change:** minor (⇧⌥ blend mode letters; Pen Auto Add/Delete on the path being drawn, #6140; Show Transform Controls frames every selected layer; guide keys and clicks; menu bar from the keyboard, #4988; Crop tool Content-Aware Fill; on-canvas corner radius widgets, TOOL-214-12; Curvature Pen edits the active path; Clip Thumbnails to Layer Bounds; Pen ⇧ 45°; last selected tool restored at launch; Layers panel filter-type dropdown with Kind, Name and Mode, #5048; Free Transform box and marching ants follow the selection, #5297; History: the trash deletes the selected snapshot, rows drag onto the trash, #5324; smart filter reordering by drag; smart object perspective row corrected to done, #426; Free Transform H/V skew fields; toolbar tool shortcuts can be reassigned; ⇧-dragged guides land on ruler ticks; layer and selection keys; tool keys; spring-loaded tool letters; type formatting keys; Pen Auto Add/Delete, #4144; smart filter rows; stale missing-tool rows corrected: Color Replacement, Red Eye and the Add/Delete Anchor Point pair are live toolbar tools, Frame landed; no percentage changed) · **Target:** Adobe Photoshop 2026 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-15 · **Change:** minor (⇧⌥ blend mode letters; painting tool Mode menus; Pen Auto Add/Delete on the path being drawn, #6140; Show Transform Controls frames every selected layer; guide keys and clicks; menu bar from the keyboard, #4988; Crop tool Content-Aware Fill; on-canvas corner radius widgets, TOOL-214-12; Curvature Pen edits the active path; Clip Thumbnails to Layer Bounds; Pen ⇧ 45°; last selected tool restored at launch; Layers panel filter-type dropdown with Kind, Name and Mode, #5048; Free Transform box and marching ants follow the selection, #5297; History: the trash deletes the selected snapshot, rows drag onto the trash, #5324; smart filter reordering by drag; smart object perspective row corrected to done, #426; Free Transform H/V skew fields; toolbar tool shortcuts can be reassigned; ⇧-dragged guides land on ruler ticks; layer and selection keys; tool keys; spring-loaded tool letters; type formatting keys; Pen Auto Add/Delete, #4144; smart filter rows; stale missing-tool rows corrected: Color Replacement, Red Eye and the Add/Delete Anchor Point pair are live toolbar tools, Frame landed; no percentage changed) · **Target:** Adobe Photoshop 2026 How PhotoCraft's direct manipulation compares with Photoshop 2026 (27.11.0): the toolbox, the handles and modifier keys of each gesture, nudging, snapping, numeric precision, navigation, @@ -195,7 +195,7 @@ Triangle and Curvature Pen (minus legacy Rounded Rectangle and Targeted Adjustme | Tool keys: ← / → turn the brush tip (1°, ⇧ 15°), ⇧-click with Type starts new text over old, Space+F / ⇧Space+F cycle the pasteboard colour | done (2026-10-11) | | | Type formatting keys while editing text | done: ⇧⌘K, U, B, I and / toggle All Caps, Underline, Faux Bold, Faux Italic, Strikethrough (off when every selected character has it, else on); ⌥↑/↓ leading ∓2 pt, ⇧⌥↑/↓ baseline shift ±2 pt (10 with ⌘); ⌥←/→ tracking ±20 over a selection (100 with ⌘; a collapsed caret still kerns); ⌥⇧⌘H toggles Hyphenate for the touched paragraphs. One `type.setStyle` step per press (new `leadingBy`/`baselineShiftBy`/`trackingBy`; auto leading starts from its laid-out value); the global ⇧⌘K/U/B/I never fire while typing. Differs: a collapsed caret in non-empty text changes nothing, since the model can't hold a pending style for the next characters typed (empty text takes it as its typing style) (`type_tool.rs`, `input_tests.rs` `type_tool_format_keys_*`) | | | Guides: click selects, Delete deletes, right-click menu, ⌥-click turns a guide, double-click opens Guides, Grid & Slices | done (2026-10-12) | | -| Blend mode keys: ⇧⌥ + letter picks a mode (N Normal, I Dissolve, R Clear, P Pass Through, K M B A darken, G S D W lighten, O F H V J Z L contrast, E X difference, U T C Y component), ⇧+ / ⇧− step through them | done (2026-10-14): Brush, Pencil and Gradient take them as their own mode (Clear on Brush and Pencil only), any non-painting tool sets every selected layer in one undo step (Pass Through on groups only; the Background is skipped); the typed letter wins, the physical key is the fallback for ⌥ characters on a Mac. ⇧⌥ letters no longer switch tools. While a Free Transform box, Puppet Warp or Perspective Warp is open they, and the number keys, still reach the tool (or the layers) without closing it. Differs: Behind (⇧⌥Q) is not implemented; Clone Stamp, Pattern Stamp, History Brush, Healing, Paint Bucket and Magic Eraser ignore the keys until their options bar has a Mode | `blend_keys.rs` | +| Blend mode keys: ⇧⌥ + letter picks a mode (N Normal, I Dissolve, R Clear, P Pass Through, K M B A darken, G S D W lighten, O F H V J Z L contrast, E X difference, U T C Y component), ⇧+ / ⇧− step through them | done (2026-10-14): Brush, Pencil and Gradient take them as their own mode (Clear on Brush and Pencil only), any non-painting tool sets every selected layer in one undo step (Pass Through on groups only; the Background is skipped); the typed letter wins, the physical key is the fallback for ⌥ characters on a Mac. ⇧⌥ letters no longer switch tools. While a Free Transform box, Puppet Warp or Perspective Warp is open they, and the number keys, still reach the tool (or the layers) without closing it. Clone Stamp, Pattern Stamp, History Brush, Healing (its own short list) and Paint Bucket (with Clear) take them as their own mode; tools without a blend mode (the Erasers, Mixer Brush, Dodge, Burn, Sponge) set the layers. Differs: Behind (⇧⌥Q) is not implemented; Spot Healing, Color Replacement, Blur, Sharpen and Smudge ignore the keys until their options bar has a Mode | `blend_keys.rs` | ## Panels and workspace @@ -260,3 +260,4 @@ Paragraph; the rest open as in-app floating windows. | 2026-10-14 | minor | Move › Show Transform Controls frames every selected layer and outlines the selected shapes | | 2026-10-14 | minor | ⇧⌥ + letter blend mode keys for the painting tool or every selected layer; ⇧+ / ⇧− now step every selected layer and include Clear for Brush and Pencil | | 2026-10-15 | minor | Blend mode and number keys work while a Free Transform, Puppet Warp or Perspective Warp is open | +| 2026-10-14 | minor | Mode dropdowns for Clone Stamp, Pattern Stamp, History Brush, Healing and Paint Bucket; the blend mode keys reach them, and tools without a blend mode pass the keys to the layers | From a8b23d947edbd5b69af15ddf0134bdb77adc174c Mon Sep 17 00:00:00 2001 From: David Mann Date: Thu, 22 Oct 2026 19:52:38 +0200 Subject: [PATCH 2/2] Integration: Dodge, Burn and Sponge keep the blend mode keys off the layer (#5504) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PR sent ⇧⌥ letters and ⇧+/⇧− to the selected layers whenever the tool has no Mode menu, Dodge, Burn and Sponge included. In Photoshop those keys pick the Dodge/Burn Range (⇧⌥S/M/H) and the Sponge's mode (⇧⌥D/S) and never touch the layer: with Dodge active, ⇧⌥M leaves the layer Normal (the Eraser and the Mixer Brush do set it). So Dodge + ⇧⌥S turned the layer Screen. They ignore the keys, as #5478 had them, until their own Range/mode keys exist. The Healing Brush's brush can hold a mode its short menu lacks: the Brush's Overlay remembered from before it had a Mode menu (restored at launch with the tool active, so no tool switch resets it), a brush preset with tool settings, or tools.setBrush. It then healed in Overlay, while its dropdown showed nothing and the first ⇧+ seemed dead. blend_keys::brush_tool_mode now treats such a mode as Normal for the stroke (clone_params), the dropdown and the keys. Also moves paint_mode_dropdown's doc comment back onto it, and the ui-parity row names the Paint Bucket's Clear. Tests: dodge_burn_and_sponge_leave_the_layer_alone and healing_brush_heals_in_normal_with_a_mode_outside_its_menu and healing_brush_with_a_mode_outside_its_menu_steps_from_normal fail without this change. Co-authored-by: paulou-jpg <79102098+paulou-jpg@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/blend_keys.rs | 56 ++++++++++++++++++++++++++------ crates/ui-egui/src/panels.rs | 8 ++--- crates/ui-egui/src/retouch_ui.rs | 19 ++++++++++- docs/ui-parity.md | 4 +-- 4 files changed, 70 insertions(+), 17 deletions(-) diff --git a/crates/ui-egui/src/blend_keys.rs b/crates/ui-egui/src/blend_keys.rs index 8f4af6c363e..5480d1476b3 100644 --- a/crates/ui-egui/src/blend_keys.rs +++ b/crates/ui-egui/src/blend_keys.rs @@ -120,6 +120,13 @@ pub fn handle(app: &mut PhotocraftApp, ctx: &egui::Context) { pub const HEALING_MODES: [BlendMode; 7] = [BlendMode::Normal, BlendMode::Multiply, BlendMode::Screen, BlendMode::Darken, BlendMode::Lighten, BlendMode::Color, BlendMode::Luminosity]; +/// The mode a brush-based tool paints with: its brush's, or Normal for a Healing Brush whose brush +/// holds a mode its short menu lacks (the Brush's Overlay remembered from before it had a menu, a +/// preset with tool settings, `tools.setBrush`). The stroke, the dropdown and the keys share it. +pub fn brush_tool_mode(tool: Tool, mode: BlendMode) -> BlendMode { + if tool == Tool::Healing && !HEALING_MODES.contains(&mode) { BlendMode::Normal } else { mode } +} + /// A painting tool's options-bar Mode menu in order, `None` being Clear (after Dissolve, on the /// tools Photoshop offers it on). `None` for a tool without a blend mode control. pub fn tool_modes(tool: Tool) -> Option>> { @@ -153,7 +160,10 @@ fn target(tool: Tool) -> Target { } match tool { Tool::SpotHealing | Tool::ColorReplacement | Tool::Blur | Tool::Sharpen | Tool::Smudge => Target::Nothing, - // No blend mode of their own (the Erasers, Dodge, Sponge…): the layer's, as in Photoshop. + // Photoshop's ⇧⌥S/M/H pick the Dodge and Burn Range and ⇧⌥D/S the Sponge's mode: never + // the layer's. + Tool::Dodge | Tool::Burn | Tool::Sponge => Target::Nothing, + // No blend mode of their own (the Erasers, the Mixer Brush…): the layer's, as in Photoshop. _ => Target::Layers, } } @@ -169,7 +179,7 @@ pub fn tool_mode(app: &mut PhotocraftApp) -> Option { Tool::Gradient => Some(o.gradient_blend_mode), _ => { crate::paint_mouse::sync_tool_brush(app); - Some(app.session.tools.brush.mode) + Some(brush_tool_mode(app.ui.tool, app.session.tools.brush.mode)) } } } @@ -618,6 +628,19 @@ mod tests { assert_eq!(layer_blend(&a), BlendMode::Normal); } + /// A Healing Brush whose brush holds Overlay (outside its menu) counts as Normal for the keys, + /// as for its stroke: ⇧+ steps on to Multiply. + #[test] + fn healing_brush_with_a_mode_outside_its_menu_steps_from_normal() { + let ctx = egui::Context::default(); + let mut a = app(Tool::Healing); + crate::paint_mouse::sync_tool_brush(&mut a); + a.session.tools.brush.mode = BlendMode::Overlay; + assert_eq!(tool_mode(&mut a), Some(BlendMode::Normal)); + key_press(&mut a, &ctx, 1); + assert_eq!(tool_mode(&mut a), Some(BlendMode::Multiply)); + } + /// The Paint Bucket has its own Mode, Clear included. #[test] fn paint_bucket_takes_the_keys_with_clear() { @@ -633,21 +656,34 @@ mod tests { assert_eq!(layer_blend(&a), BlendMode::Normal); } - /// Tools without a blend mode of their own (the Erasers, Dodge, the Mixer Brush) pass the keys - /// to the selected layers, as Photoshop does. + /// Tools without a blend mode of their own (the Erasers, the Mixer Brush) pass the keys to the + /// selected layers, as Photoshop does. #[test] fn tools_without_a_blend_mode_set_the_layer() { let ctx = egui::Context::default(); - for (tool, key, mode) in [ - (Tool::Eraser, Key::M, BlendMode::Multiply), - (Tool::MagicEraser, Key::S, BlendMode::Screen), - (Tool::Dodge, Key::O, BlendMode::Overlay), - (Tool::MixerBrush, Key::E, BlendMode::Difference), - ] { + for (tool, key, mode) in + [(Tool::Eraser, Key::M, BlendMode::Multiply), (Tool::MagicEraser, Key::S, BlendMode::Screen), (Tool::MixerBrush, Key::E, BlendMode::Difference)] + { let mut a = app(tool); alt_shift(&mut a, &ctx, key, key); assert_eq!(layer_blend(&a), mode, "{tool:?}"); assert_eq!(a.ui.tool, tool); } } + + /// Dodge, Burn and Sponge use ⇧⌥S/M/H and ⇧⌥D/S for their own Range and mode in Photoshop, so + /// neither the letters nor ⇧+ change the layer's blend mode. + #[test] + fn dodge_burn_and_sponge_leave_the_layer_alone() { + let ctx = egui::Context::default(); + for tool in [Tool::Dodge, Tool::Burn, Tool::Sponge] { + let mut a = app(tool); + for k in [Key::S, Key::M, Key::H, Key::D] { + alt_shift(&mut a, &ctx, k, k); + } + key_press(&mut a, &ctx, 1); + assert_eq!(layer_blend(&a), BlendMode::Normal, "{tool:?}"); + assert_eq!(a.ui.tool, tool); + } + } } diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index b6e8789c408..30aa58af237 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -1029,7 +1029,7 @@ pub fn options_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { // Mode is the tool's own brush's, kept per tool like its size. if let Some(modes) = crate::blend_keys::tool_modes(tool) { opt_label(ui, tl!("Mode")); - if let Some(Some(m)) = tool_mode_dropdown(ui, "retouch-mode", &modes, Some(brush.mode)) { + if let Some(Some(m)) = tool_mode_dropdown(ui, "retouch-mode", &modes, Some(crate::blend_keys::brush_tool_mode(tool, brush.mode))) { brush.mode = m; } } @@ -4466,9 +4466,6 @@ fn brush_tip(p: &egui::Painter, c: egui::Pos2, rad: f32, hardness: f32, color: C } } -/// The Brush's or Pencil's Mode dropdown: the blend modes, with Photoshop's painting-only Clear -/// after Dissolve (#3439). Clear erases with the brush (`clear`); it shows while chosen, or while -/// `~` is held (`held`). The wheel over it steps the mode, as over the Layers panel's (#2061). /// A painting tool's Mode dropdown over `modes` (`None` is Clear); the wheel over it steps the /// mode. Returns the mode picked this frame. fn tool_mode_dropdown(ui: &mut egui::Ui, id: &str, modes: &[Option], current: Option) -> Option> { @@ -4478,6 +4475,9 @@ fn tool_mode_dropdown(ui: &mut egui::Ui, id: &str, modes: &[Option], chosen.last().copied() } +/// The Brush's or Pencil's Mode dropdown: the blend modes, with Photoshop's painting-only Clear +/// after Dissolve (#3439). Clear erases with the brush (`clear`); it shows while chosen, or while +/// `~` is held (`held`). The wheel over it steps the mode, as over the Layers panel's (#2061). fn paint_mode_dropdown(ui: &mut egui::Ui, id: &str, b: &mut photocraft_engine::BrushSettings, clear: &mut bool, held: bool) { let mut opts: Vec<(Option, &str)> = BlendMode::LAYER_MODES.iter().map(|m| (Some(*m), m.label())).collect(); let at = opts.iter().position(|o| o.0 == Some(BlendMode::Dissolve)).map_or(opts.len(), |i| i + 1); diff --git a/crates/ui-egui/src/retouch_ui.rs b/crates/ui-egui/src/retouch_ui.rs index 8f257f4f23c..30709f8051d 100644 --- a/crates/ui-egui/src/retouch_ui.rs +++ b/crates/ui-egui/src/retouch_ui.rs @@ -28,7 +28,8 @@ pub(crate) fn alt_flipped(tool: Tool, alt: bool) -> Tool { pub(crate) fn clone_params(app: &PhotocraftApp) -> Option { let o = &app.ui.tool_options; // The options bar's Mode is the tool's own brush's. - let mut p = json!({"aligned": o.clone_aligned, "sampleLayer": o.clone_sample, "mode": app.session.tools.brush.mode.label()}); + let mode = crate::blend_keys::brush_tool_mode(app.ui.tool, app.session.tools.brush.mode); + let mut p = json!({"aligned": o.clone_aligned, "sampleLayer": o.clone_sample, "mode": mode.label()}); if app.ui.tool == Tool::CloneStamp { p["wrap"] = json!(app.ui.view.pattern_preview); p["opacity"] = json!(app.session.tools.brush.opacity * 100.0); @@ -806,6 +807,22 @@ mod tests { assert_eq!(params["flow"], 50.0); } + /// A Healing Brush whose brush holds a mode outside its menu (Overlay, restored with the tool + /// active, so no tool switch sees it) heals in Normal; the Clone Stamp keeps Overlay. + #[test] + fn healing_brush_heals_in_normal_with_a_mode_outside_its_menu() { + for (tool, want) in [(Tool::Healing, "Normal"), (Tool::CloneStamp, "Overlay")] { + let mut app = app(); + app.ui.tool = tool; + crate::paint_mouse::sync_tool_brush(&mut app); + app.session.tools.brush.mode = photocraft_color::BlendMode::Overlay; + app.ui.clone_source = Some([10.0, 10.0]); + drag(&mut app, tool); + let (_, params) = app.session.journal.last().unwrap(); + assert_eq!(params["mode"], want, "{tool:?}"); + } + } + /// The options bar's Mode (each tool's own brush's) reaches the stamps', the History Brush's /// and the Healing Brush's strokes, live and committed. #[test] diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 82b6a066fe7..e2fcd802296 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -206,7 +206,7 @@ Triangle and Curvature Pen (minus legacy Rounded Rectangle and Targeted Adjustme | Tool keys: ← / → turn the brush tip (1°, ⇧ 15°), ⇧-click with Type starts new text over old, Space+F / ⇧Space+F cycle the pasteboard colour | done (2026-10-11) | | | Type formatting keys while editing text | done: ⇧⌘K, U, B, I and / toggle All Caps, Underline, Faux Bold, Faux Italic, Strikethrough (off when every selected character has it, else on); ⌥↑/↓ leading ∓2 pt, ⇧⌥↑/↓ baseline shift ±2 pt (10 with ⌘); ⌥←/→ tracking ±20 over a selection (100 with ⌘; a collapsed caret still kerns); ⌥⇧⌘H toggles Hyphenate for the touched paragraphs. One `type.setStyle` step per press (new `leadingBy`/`baselineShiftBy`/`trackingBy`; auto leading starts from its laid-out value); the global ⇧⌘K/U/B/I never fire while typing. Differs: a collapsed caret in non-empty text changes nothing, since the model can't hold a pending style for the next characters typed (empty text takes it as its typing style) (`type_tool.rs`, `input_tests.rs` `type_tool_format_keys_*`) | | | Guides: click selects, Delete deletes, right-click menu, ⌥-click turns a guide, double-click opens Guides, Grid & Slices | done (2026-10-12) | a guide let go over either ruler is removed, not only off the canvas (#6286) | -| Blend mode keys: ⇧⌥ + letter picks a mode (N Normal, I Dissolve, R Clear, P Pass Through, K M B A darken, G S D W lighten, O F H V J Z L contrast, E X difference, U T C Y component), ⇧+ / ⇧− step through them | done (2026-10-14): Brush, Pencil and Gradient take them as their own mode (Clear on Brush and Pencil only), any non-painting tool sets every selected layer in one undo step (Pass Through on groups only; the Background is skipped); the typed letter wins, the physical key is the fallback for ⌥ characters on a Mac. ⇧⌥ letters no longer switch tools. While a Free Transform box, Puppet Warp or Perspective Warp is open they, and the number keys, still reach the tool (or the layers) without closing it. Clone Stamp, Pattern Stamp, History Brush, Healing (its own short list) and Paint Bucket (with Clear) take them as their own mode; tools without a blend mode (the Erasers, Mixer Brush, Dodge, Burn, Sponge) set the layers. Differs: Behind (⇧⌥Q) is not implemented; Spot Healing, Color Replacement, Blur, Sharpen and Smudge ignore the keys until their options bar has a Mode | `blend_keys.rs` | +| Blend mode keys: ⇧⌥ + letter picks a mode (N Normal, I Dissolve, R Clear, P Pass Through, K M B A darken, G S D W lighten, O F H V J Z L contrast, E X difference, U T C Y component), ⇧+ / ⇧− step through them | done (2026-10-14): Brush, Pencil and Gradient take them as their own mode (Clear on Brush, Pencil and Paint Bucket only), any non-painting tool sets every selected layer in one undo step (Pass Through on groups only; the Background is skipped); the typed letter wins, the physical key is the fallback for ⌥ characters on a Mac. ⇧⌥ letters no longer switch tools. While a Free Transform box, Puppet Warp or Perspective Warp is open they, and the number keys, still reach the tool (or the layers) without closing it. Clone Stamp, Pattern Stamp, History Brush, Healing (its own short list) and Paint Bucket (with Clear) take them as their own mode; tools without a blend mode (the Erasers, Mixer Brush) set the layers. Differs: Behind (⇧⌥Q) is not implemented; Spot Healing, Color Replacement, Blur, Sharpen and Smudge ignore the keys until their options bar has a Mode, and Dodge, Burn and Sponge ignore them until their Range and mode keys (⇧⌥S/M/H, ⇧⌥D/S) exist | `blend_keys.rs` | ## Panels and workspace @@ -292,4 +292,4 @@ Paragraph; the rest open as in-app floating windows. | 2026-10-14 | minor | Rounded corners on live triangles, polygons and stars: Properties field and on-canvas widgets (TOOL-214-12) | | 2026-10-14 | minor | ⇧⌥ + letter blend mode keys for the painting tool or every selected layer; ⇧+ / ⇧− now step every selected layer and include Clear for Brush and Pencil | | 2026-10-15 | minor | Blend mode and number keys work while a Free Transform, Puppet Warp or Perspective Warp is open | -| 2026-10-14 | minor | Mode dropdowns for Clone Stamp, Pattern Stamp, History Brush, Healing and Paint Bucket; the blend mode keys reach them, and tools without a blend mode pass the keys to the layers | +| 2026-10-14 | minor | Mode dropdowns for Clone Stamp, Pattern Stamp, History Brush, Healing and Paint Bucket; the blend mode keys reach them, and tools without a blend mode (not Dodge, Burn or Sponge) pass the keys to the layers |