Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Blur Gallery: Iris Blur's pins and handles on the image (#3373) (#3822)

Timothy Dalyd56aa35bce72
diff --git a/crates/ui-egui/src/blur_pins.rs b/crates/ui-egui/src/blur_pins.rs
index 6a90d9910..0e10c65aa 100644
--- a/crates/ui-egui/src/blur_pins.rs
+++ b/crates/ui-egui/src/blur_pins.rs
@@ -1,13 +1,19 @@
-//! Filter › Blur Gallery › Field Blur… as Photoshop's workspace (#3373): pins on the image, each
-//! with its own blur, interpolated between them. While the dialog is open the image under it takes
-//! the pointer: a click on the image adds a pin (and selects it), a drag moves a pin, and a drag on
-//! the selected pin's ring turns its blur up or down (one turn = the full 0–500 px; the arc shows
-//! the amount). Delete or Backspace removes the selected pin. The dialog shows the selected pin's
-//! Blur and the Preview switch; OK runs `filter.blurGallery.fieldBlur` with the `pins`.
+//! Filter › Blur Gallery › Field Blur… and Iris Blur… as Photoshop's workspace (#3373): pins on the
+//! image, each with its own blur. While the dialog is open the image under it takes the pointer:
+//! a click on the image adds a pin (and selects it), a drag moves a pin, and a drag on the selected
+//! pin's ring turns its blur up or down (one turn = the full 0–500 px; the arc shows the amount).
+//! Delete or Backspace removes the selected pin. The dialog shows the selected pin's Blur and the
+//! Preview switch; OK runs the filter with the `pins`.
+//!
+//! Field Blur interpolates the pins' blur between them. An Iris Blur pin is a sharp superellipse,
+//! blurred outside: the selected pin shows Photoshop's handles, four on the outline (drag to resize
+//! that axis and turn the shape), a square at its corner (drag out to round it towards a rectangle)
+//! and four dots inside (drag to set the sharp core, where the blur starts).
//!
//! Everything lives in the dialog's fields, so automation drives it with `ui.dialog.set`: `pins`
-//! (`[{x, y, blur}]`, x and y as fractions of the filter's bounds) and `__selected`. The bounds are
-//! the engine's: the selection's when there is one, else the canvas.
+//! (as the command takes them; x and y as fractions of the filter's bounds, Iris radii as fractions
+//! of their shorter side) and `__selected`. The bounds are the engine's: the selection's when there
+//! is one, else the canvas.
use egui::{Color32, Pos2, Stroke, vec2};
use serde_json::{Map, Value, json};
@@ -16,7 +22,8 @@ use crate::PhotocraftApp;
use crate::canvas::ViewXform;
pub const COMMAND: &str = "filter.blurGallery.fieldBlur";
-/// Field Blur's range, in pixels.
+pub const IRIS: &str = "filter.blurGallery.irisBlur";
+/// The Blur Gallery range, in pixels.
const MAX_BLUR: f64 = 500.0;
/// Photoshop's first pin.
const DEFAULT_BLUR: f64 = 15.0;
@@ -27,13 +34,76 @@ const DOT: f32 = 5.0;
const GRAB: f32 = 9.0;
const RING: f32 = 24.0;
const RING_BAND: f32 = 5.0;
+/// Screen size (points) of an Iris handle.
+const HANDLE: f32 = 4.5;
+/// Iris radii, as the command bounds them.
+const MIN_RADIUS: f64 = 0.01;
+const MAX_FEATHER: f64 = 0.99;
+
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+enum Kind {
+ Field,
+ Iris,
+}
+
+fn kind(fields: &Map<String, Value>) -> Option<Kind> {
+ match fields.get("__command").and_then(Value::as_str) {
+ Some(COMMAND) => Some(Kind::Field),
+ Some(IRIS) => Some(Kind::Iris),
+ _ => None,
+ }
+}
pub fn owns(fields: &Map<String, Value>) -> bool {
- fields.get("__command").and_then(Value::as_str) == Some(COMMAND)
+ kind(fields).is_some()
+}
+
+/// The Blur Gallery filters that open as this workspace.
+pub fn handles(command: &str) -> bool {
+ command == COMMAND || command == IRIS
+}
+
+/// An Iris Blur pin's shape, as the command takes it.
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct Iris {
+ /// Radii as fractions of the bounds' shorter side.
+ pub rx: f64,
+ pub ry: f64,
+ /// Degrees, clockwise on screen.
+ pub angle: f64,
+ /// 0 = ellipse … 100 = rounded rectangle.
+ pub roundness: f64,
+ /// Where the blur starts, as a fraction of the shape (the sharp core).
+ pub feather: f64,
+}
+
+impl Default for Iris {
+ /// The command's defaults.
+ fn default() -> Self {
+ Iris { rx: 0.35, ry: 0.25, angle: 0.0, roundness: 0.0, feather: 0.5 }
+ }
+}
+
+impl Iris {
+ fn clean(self) -> Self {
+ let f = |v: f64, d: f64| if v.is_finite() { v } else { d };
+ Iris {
+ rx: f(self.rx, 0.35).clamp(MIN_RADIUS, 1.0),
+ ry: f(self.ry, 0.25).clamp(MIN_RADIUS, 1.0),
+ angle: (f(self.angle, 0.0) + 180.0).rem_euclid(360.0) - 180.0,
+ roundness: f(self.roundness, 0.0).clamp(0.0, 100.0),
+ feather: f(self.feather, 0.5).clamp(0.0, MAX_FEATHER),
+ }
+ }
+
+ /// The superellipse exponent the engine uses (2 = ellipse … 8).
+ fn exponent(self) -> f64 {
+ 2.0 + self.roundness / 100.0 * 6.0
+ }
}
-/// Turn a freshly opened Field Blur dialog into the workspace: one pin in the middle of the
-/// filter's bounds with the remembered blur, selected.
+/// Turn a freshly opened Field or Iris Blur dialog into the workspace: one pin in the middle of
+/// the filter's bounds with the remembered settings, selected.
pub fn init(app: &mut PhotocraftApp, fields: &mut Map<String, Value>) {
reset(fields);
let bounds = app.session.active().map(|st| (st.doc.id, st.doc.bounds(), st.doc.selection.clone()));
@@ -43,14 +113,21 @@ pub fn init(app: &mut PhotocraftApp, fields: &mut Map<String, Value>) {
}
}
-/// One pin in the middle with the dialog's blur, selected. Alt+Cancel (Reset) runs this alone, so
-/// the bounds captured on opening stay.
+/// One pin in the middle with the dialog's settings, selected. Alt+Cancel (Reset) runs this
+/// alone, so the bounds captured on opening stay.
pub fn reset(fields: &mut Map<String, Value>) {
- let blur = fields.get("blur").and_then(Value::as_f64).filter(|b| b.is_finite()).unwrap_or(DEFAULT_BLUR).clamp(0.0, MAX_BLUR);
- fields.remove("centerX");
- fields.remove("centerY");
+ let num = |k: &str, d: f64| fields.get(k).and_then(Value::as_f64).filter(|v| v.is_finite()).unwrap_or(d);
+ let blur = num("blur", DEFAULT_BLUR).clamp(0.0, MAX_BLUR);
+ let iris = (kind(fields) == Some(Kind::Iris)).then(|| {
+ Iris { rx: num("radiusX", 0.35), ry: num("radiusY", 0.25), angle: num("angle", 0.0), roundness: num("roundness", 0.0), feather: num("feather", 0.5) }
+ .clean()
+ });
+ // The pins replace the single shape's params.
+ for k in ["centerX", "centerY", "radiusX", "radiusY", "angle", "roundness", "feather"] {
+ fields.remove(k);
+ }
fields.insert("blur".into(), json!(blur));
- fields.insert("pins".into(), json!([{"x": 0.5, "y": 0.5, "blur": blur}]));
+ set_pins(fields, &[Pin { x: 0.5, y: 0.5, blur, iris }]);
fields.insert("__selected".into(), json!(0));
}
@@ -61,26 +138,51 @@ pub fn first_place(fields: &Map<String, Value>, ctx: &egui::Context) -> Option<e
owns(fields).then(|| vec2((ctx.content_rect().width() - 480.0).max(0.0), 96.0))
}
-/// One pin: position as fractions of the bounds, blur in pixels.
+/// One pin: position as fractions of the bounds, blur in pixels, and an Iris pin's shape.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Pin {
pub x: f64,
pub y: f64,
pub blur: f64,
+ pub iris: Option<Iris>,
}
/// The pins in `fields`, cleaned (finite, in range, at most [`MAX_PINS`]).
pub fn pins(fields: &Map<String, Value>) -> Vec<Pin> {
let Some(list) = fields.get("pins").and_then(Value::as_array) else { return Vec::new() };
+ let iris = kind(fields) == Some(Kind::Iris);
let num = |v: &Value, k: &str, d: f64| v.get(k).and_then(Value::as_f64).filter(|x| x.is_finite()).unwrap_or(d);
list.iter()
.take(MAX_PINS)
- .map(|v| Pin { x: num(v, "x", 0.5).clamp(0.0, 1.0), y: num(v, "y", 0.5).clamp(0.0, 1.0), blur: num(v, "blur", DEFAULT_BLUR).clamp(0.0, MAX_BLUR) })
+ .map(|v| Pin {
+ x: num(v, "x", 0.5).clamp(0.0, 1.0),
+ y: num(v, "y", 0.5).clamp(0.0, 1.0),
+ blur: num(v, "blur", DEFAULT_BLUR).clamp(0.0, MAX_BLUR),
+ iris: iris.then(|| {
+ let d = Iris::default();
+ Iris {
+ rx: num(v, "radiusX", d.rx),
+ ry: num(v, "radiusY", d.ry),
+ angle: num(v, "angle", d.angle),
+ roundness: num(v, "roundness", d.roundness),
+ feather: num(v, "feather", d.feather),
+ }
+ .clean()
+ }),
+ })
.collect()
}
fn set_pins(fields: &mut Map<String, Value>, pins: &[Pin]) {
- let list: Vec<Value> = pins.iter().map(|p| json!({"x": p.x, "y": p.y, "blur": p.blur})).collect();
+ let list: Vec<Value> = pins
+ .iter()
+ .map(|p| match p.iris {
+ None => json!({"x": p.x, "y": p.y, "blur": p.blur}),
+ Some(s) => {
+ json!({"x": p.x, "y": p.y, "blur": p.blur, "radiusX": s.rx, "radiusY": s.ry, "angle": s.angle, "roundness": s.roundness, "feather": s.feather})
+ }
+ })
+ .collect();
fields.insert("pins".into(), Value::Array(list));
}
@@ -92,7 +194,7 @@ pub fn selected(fields: &Map<String, Value>) -> Option<usize> {
fn select(fields: &mut Map<String, Value>, i: Option<usize>) {
fields.insert("__selected".into(), i.map_or(Value::Null, |i| json!(i)));
- // The dialog's Blur (remembered for the next Field Blur) follows the selected pin.
+ // The dialog's Blur (remembered for the next time) follows the selected pin.
if let Some(p) = i.and_then(|i| pins(fields).get(i).copied()) {
fields.insert("blur".into(), json!(p.blur));
}
@@ -106,6 +208,11 @@ fn bounds(fields: &Map<String, Value>) -> Option<[f64; 4]> {
(r[2] > r[0] && r[3] > r[1]).then_some(r)
}
+/// The bounds' shorter side, which Iris radii are fractions of.
+fn short_side(b: [f64; 4]) -> f64 {
+ (b[2] - b[0]).min(b[3] - b[1]).max(1.0)
+}
+
fn to_doc(b: [f64; 4], p: Pin) -> [f64; 2] {
[b[0] + p.x * (b[2] - b[0]), b[1] + p.y * (b[3] - b[1])]
}
@@ -114,6 +221,45 @@ fn from_doc(b: [f64; 4], d: [f64; 2]) -> (f64, f64) {
(((d[0] - b[0]) / (b[2] - b[0])).clamp(0.0, 1.0), ((d[1] - b[1]) / (b[3] - b[1])).clamp(0.0, 1.0))
}
+/// An Iris pin's local point `(u, v)` (1 = on the shape along that axis) in document pixels.
+fn iris_point(b: [f64; 4], p: Pin, s: Iris, u: f64, v: f64) -> [f64; 2] {
+ let c = to_doc(b, p);
+ let ss = short_side(b);
+ let (x, y) = (u * s.rx * ss, v * s.ry * ss);
+ let (sin, cos) = s.angle.to_radians().sin_cos();
+ [c[0] + x * cos - y * sin, c[1] + x * sin + y * cos]
+}
+
+/// A document point in an Iris pin's local coordinates (the engine's `u`, `v`).
+fn iris_local(b: [f64; 4], p: Pin, s: Iris, d: [f64; 2]) -> (f64, f64) {
+ let c = to_doc(b, p);
+ let ss = short_side(b);
+ let (dx, dy) = (d[0] - c[0], d[1] - c[1]);
+ let (sin, cos) = s.angle.to_radians().sin_cos();
+ ((dx * cos + dy * sin) / (s.rx * ss), (-dx * sin + dy * cos) / (s.ry * ss))
+}
+
+/// The superellipse's diagonal point `t` (on the shape at (t, t)): 2^(−1/m).
+fn diagonal(s: Iris) -> f64 {
+ 0.5f64.powf(1.0 / s.exponent())
+}
+
+/// The selected Iris pin's handles in local coordinates: the four on the outline (along the axes),
+/// the roundness square (upper right) and the four feather dots inside (on the diagonals).
+fn axis_handles() -> [(f64, f64); 4] {
+ [(1.0, 0.0), (0.0, 1.0), (-1.0, 0.0), (0.0, -1.0)]
+}
+
+fn round_handle(s: Iris) -> (f64, f64) {
+ let t = diagonal(s);
+ (t, -t)
+}
+
+fn feather_handles(s: Iris) -> [(f64, f64); 4] {
+ let k = s.feather * diagonal(s);
+ [(k, k), (-k, k), (-k, -k), (k, -k)]
+}
+
/// Remove the selected pin; the one before it (or the new first) is selected.
pub fn remove_selected(fields: &mut Map<String, Value>) -> bool {
let Some(i) = selected(fields) else { return false };
@@ -144,14 +290,14 @@ pub fn body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
}
}
ui.add_space(4.0);
- ui.add(
- egui::Label::new(
- egui::RichText::new(tl!("Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin."))
- .color(t.text_dim)
- .size(11.5),
- )
- .wrap(),
- );
+ let hint = |ui: &mut egui::Ui, text: &str| ui.add(egui::Label::new(egui::RichText::new(text).color(t.text_dim).size(11.5)).wrap());
+ hint(ui, tl!("Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin."));
+ if kind(f) == Some(Kind::Iris) {
+ hint(
+ ui,
+ tl!("Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts."),
+ );
+ }
// Delete removes the selected pin, unless a field is being typed in.
let typing = ui.ctx().memory(|m| m.focused().is_some());
if !typing && ui.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Delete) || i.consume_key(egui::Modifiers::NONE, egui::Key::Backspace)) {
@@ -165,9 +311,13 @@ pub fn body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
}
}
-/// What a press at screen point `at` grabs: the selected pin's ring, a pin, or nothing (a new pin).
+/// What a press at screen point `at` grabs: one of the selected Iris pin's handles (axis 0–3 =
+/// +u, +v, −u, −v), the selected pin's ring, a pin, or nothing (a new pin).
#[derive(Clone, Copy, Debug, PartialEq)]
enum Grab {
+ Axis(usize, usize),
+ Round(usize),
+ Feather(usize),
Ring(usize),
Pin(usize),
New,
@@ -176,19 +326,30 @@ enum Grab {
fn grab(fields: &Map<String, Value>, xf: &ViewXform, at: Pos2) -> Grab {
let Some(b) = bounds(fields) else { return Grab::New };
let list = pins(fields);
- let screen = |p: Pin| {
- let d = to_doc(b, p);
- xf.to_screen(d[0] as f32, d[1] as f32)
- };
+ let screen = |d: [f64; 2]| xf.to_screen(d[0] as f32, d[1] as f32);
+ let near = |d: [f64; 2]| screen(d).distance(at) <= GRAB;
if let Some(i) = selected(fields)
- && let Some(p) = list.get(i)
- && (screen(*p).distance(at) - RING).abs() <= RING_BAND
+ && let Some(p) = list.get(i).copied()
{
- return Grab::Ring(i);
+ if let Some(s) = p.iris {
+ if let Some(k) = axis_handles().iter().position(|&(u, v)| near(iris_point(b, p, s, u, v))) {
+ return Grab::Axis(i, k);
+ }
+ let (u, v) = round_handle(s);
+ if near(iris_point(b, p, s, u, v)) {
+ return Grab::Round(i);
+ }
+ if feather_handles(s).iter().any(|&(u, v)| near(iris_point(b, p, s, u, v))) {
+ return Grab::Feather(i);
+ }
+ }
+ if (screen(to_doc(b, p)).distance(at) - RING).abs() <= RING_BAND {
+ return Grab::Ring(i);
+ }
}
list.iter()
.enumerate()
- .map(|(i, p)| (i, screen(*p).distance(at)))
+ .map(|(i, p)| (i, screen(to_doc(b, *p)).distance(at)))
.filter(|(_, d)| *d <= GRAB)
.min_by(|a, b| a.1.total_cmp(&b.1))
.map_or(Grab::New, |(i, _)| Grab::Pin(i))
@@ -203,7 +364,8 @@ pub fn canvas(app: &mut PhotocraftApp, ctx: &egui::Context, xf: &ViewXform, over
let Some(b) = bounds(f) else { return false };
let (start, down) = ctx.input(|i| (i.pointer.primary_pressed(), i.pointer.primary_down()));
ctx.set_cursor_icon(match grab(f, xf, over) {
- Grab::Ring(_) => egui::CursorIcon::Alias,
+ Grab::Ring(_) | Grab::Round(_) => egui::CursorIcon::Alias,
+ Grab::Axis(..) | Grab::Feather(_) => egui::CursorIcon::Move,
Grab::Pin(_) => egui::CursorIcon::Grab,
Grab::New => egui::CursorIcon::Crosshair,
});
@@ -216,6 +378,9 @@ pub fn canvas(app: &mut PhotocraftApp, ctx: &egui::Context, xf: &ViewXform, over
let mut list = pins(f);
if start {
let drag = match grab(f, xf, at) {
+ Grab::Axis(i, k) => json!({"axis": i, "k": k}),
+ Grab::Round(i) => json!({"round": i}),
+ Grab::Feather(i) => json!({"feather": i}),
Grab::Ring(i) => {
let c = list.get(i).map(|p| to_doc(b, *p)).unwrap_or(doc);
json!({"ring": i, "angle": (doc[1] - c[1]).atan2(doc[0] - c[0])})
@@ -226,10 +391,12 @@ pub fn canvas(app: &mut PhotocraftApp, ctx: &egui::Context, xf: &ViewXform, over
json!({"pin": i, "dx": c[0] - doc[0], "dy": c[1] - doc[1]})
}
Grab::New if list.len() < MAX_PINS && (b[0]..=b[2]).contains(&doc[0]) && (b[1]..=b[3]).contains(&doc[1]) => {
- // A new pin takes the selected pin's blur, as the dialog's Blur shows it.
+ // A new pin takes the selected pin's blur (as the dialog's Blur shows it) and an
+ // Iris pin its shape too.
let blur = f.get("blur").and_then(Value::as_f64).filter(|v| v.is_finite()).unwrap_or(DEFAULT_BLUR).clamp(0.0, MAX_BLUR);
+ let iris = (kind(f) == Some(Kind::Iris)).then(|| selected(f).and_then(|i| list.get(i)).and_then(|p| p.iris).unwrap_or_default());
let (x, y) = from_doc(b, doc);
- list.push(Pin { x, y, blur });
+ list.push(Pin { x, y, blur, iris });
set_pins(f, &list);
select(f, Some(list.len() - 1));
json!({"pin": list.len() - 1, "dx": 0.0, "dy": 0.0})
@@ -241,13 +408,13 @@ pub fn canvas(app: &mut PhotocraftApp, ctx: &egui::Context, xf: &ViewXform, over
return true;
}
let Some(drag) = f.get("__drag").cloned() else { return true };
- if let Some(i) = drag.get("pin").and_then(Value::as_u64).map(|i| i as usize)
+ let index = |k: &str| drag.get(k).and_then(Value::as_u64).map(|i| i as usize);
+ if let Some(i) = index("pin")
&& let Some(p) = list.get_mut(i)
{
let num = |k: &str| drag.get(k).and_then(Value::as_f64).unwrap_or(0.0);
(p.x, p.y) = from_doc(b, [doc[0] + num("dx"), doc[1] + num("dy")]);
- set_pins(f, &list);
- } else if let Some(i) = drag.get("ring").and_then(Value::as_u64).map(|i| i as usize)
+ } else if let Some(i) = index("ring")
&& let Some(p) = list.get_mut(i)
{
// The angle turned since the last frame, the short way round: clockwise raises the blur.
@@ -256,44 +423,111 @@ pub fn canvas(app: &mut PhotocraftApp, ctx: &egui::Context, xf: &ViewXform, over
let last = drag.get("angle").and_then(Value::as_f64).unwrap_or(a);
let turn = (a - last + std::f64::consts::PI).rem_euclid(std::f64::consts::TAU) - std::f64::consts::PI;
p.blur = (p.blur + turn / std::f64::consts::TAU * MAX_BLUR).clamp(0.0, MAX_BLUR);
- set_pins(f, &list);
- select(f, Some(i));
f.insert("__drag".into(), json!({"ring": i, "angle": a}));
+ } else if let Some(i) = index("axis")
+ && let Some(p) = list.get_mut(i)
+ && let Some(mut s) = p.iris
+ {
+ // The handle follows the pointer: its distance is that axis's radius, its direction turns
+ // the shape (the +v handle sits a quarter turn after +u).
+ let c = to_doc(b, *p);
+ let (dx, dy) = (doc[0] - c[0], doc[1] - c[1]);
+ let r = (dx.hypot(dy) / short_side(b)).clamp(MIN_RADIUS, 1.0);
+ let k = index("k").unwrap_or(0);
+ if k % 2 == 0 {
+ s.rx = r;
+ } else {
+ s.ry = r;
+ }
+ s.angle = dy.atan2(dx).to_degrees() - 90.0 * k as f64;
+ p.iris = Some(s.clean());
+ } else if let Some(i) = index("round")
+ && let Some(p) = list.get_mut(i)
+ && let Some(s) = p.iris
+ {
+ // Out along the diagonal rounds towards a rectangle: the handle is the shape's diagonal
+ // point (t, t), t = 2^(−1/m), so t gives the exponent back.
+ let (u, v) = iris_local(b, *p, s, doc);
+ let t = ((u.abs() + v.abs()) / 2.0).clamp(0.5f64.sqrt(), 0.5f64.powf(1.0 / 8.0));
+ let m = -std::f64::consts::LN_2 / t.ln();
+ p.iris = Some(Iris { roundness: (m - 2.0) / 6.0 * 100.0, ..s }.clean());
+ } else if let Some(i) = index("feather")
+ && let Some(p) = list.get_mut(i)
+ && let Some(s) = p.iris
+ {
+ // The dots sit where the blur starts: the pointer's distance in the shape's own measure.
+ let (u, v) = iris_local(b, *p, s, doc);
+ let m = s.exponent();
+ let e = (u.abs().powf(m) + v.abs().powf(m)).powf(1.0 / m);
+ p.iris = Some(Iris { feather: if e.is_finite() { e } else { s.feather }, ..s }.clean());
+ }
+ set_pins(f, &list);
+ if let Some(i) = ["pin", "ring", "axis", "round", "feather"].into_iter().find_map(index) {
+ select(f, Some(i));
}
ctx.request_repaint();
true
}
/// Draw the pins over the image while the workspace is open: a dot per pin (filled when
-/// selected) and, round the selected one, its ring with the blur as an arc from the top.
+/// selected) and, round the selected one, its ring with the blur as an arc from the top, and an
+/// Iris pin's outline and handles.
pub fn draw(app: &PhotocraftApp, painter: &egui::Painter, xf: &ViewXform) {
let Some(d) = app.ui.dialogs.last().filter(|d| owns(&d.fields)) else { return };
let Some(b) = bounds(&d.fields) else { return };
let sel = selected(&d.fields);
let (dark, light) = (Stroke::new(3.0, Color32::from_black_alpha(150)), Stroke::new(1.5, Color32::from_white_alpha(235)));
+ let screen = |p: [f64; 2]| xf.to_screen(p[0] as f32, p[1] as f32);
for (i, p) in pins(&d.fields).into_iter().enumerate() {
- let c = to_doc(b, p);
- let c = xf.to_screen(c[0] as f32, c[1] as f32);
- if sel == Some(i) {
- painter.circle_stroke(c, RING, dark);
- painter.circle_stroke(c, RING, Stroke::new(1.0, Color32::from_white_alpha(140)));
- let frac = (p.blur / MAX_BLUR) as f32;
- let steps = (frac * 64.0).ceil().max(1.0) as usize;
- let arc: Vec<Pos2> = (0..=steps)
+ let c = screen(to_doc(b, p));
+ if sel != Some(i) {
+ painter.circle_stroke(c, DOT, dark);
+ painter.circle_stroke(c, DOT, light);
+ continue;
+ }
+ if let Some(s) = p.iris {
+ // The outline: the superellipse the blur reaches its full amount at.
+ let m = s.exponent();
+ let outline: Vec<Pos2> = (0..=128)
.map(|k| {
- let a = -std::f32::consts::FRAC_PI_2 + std::f32::consts::TAU * frac * k as f32 / steps as f32;
- c + vec2(a.cos(), a.sin()) * RING
+ let a = std::f64::consts::TAU * f64::from(k) / 128.0;
+ let (cos, sin) = (a.cos(), a.sin());
+ let r = (cos.abs().powf(m) + sin.abs().powf(m)).powf(-1.0 / m);
+ screen(iris_point(b, p, s, r * cos, r * sin))
})
.collect();
- if frac > 0.0 {
- painter.add(egui::Shape::line(arc.clone(), Stroke::new(4.5, Color32::from_black_alpha(150))));
- painter.add(egui::Shape::line(arc, Stroke::new(2.5, Color32::WHITE)));
+ painter.add(egui::Shape::line(outline.clone(), dark));
+ painter.add(egui::Shape::line(outline, light));
+ for (u, v) in axis_handles() {
+ painter.circle(screen(iris_point(b, p, s, u, v)), HANDLE, Color32::WHITE, Stroke::new(1.0, Color32::from_black_alpha(180)));
}
- painter.circle(c, DOT, Color32::WHITE, Stroke::new(1.0, Color32::from_black_alpha(180)));
- } else {
- painter.circle_stroke(c, DOT, dark);
- painter.circle_stroke(c, DOT, light);
+ let (u, v) = round_handle(s);
+ let r = egui::Rect::from_center_size(screen(iris_point(b, p, s, u, v)), vec2(HANDLE * 2.0, HANDLE * 2.0));
+ painter.rect(r, 1.0, Color32::WHITE, Stroke::new(1.0, Color32::from_black_alpha(180)), egui::StrokeKind::Middle);
+ for (u, v) in feather_handles(s) {
+ painter.circle(
+ screen(iris_point(b, p, s, u, v)),
+ HANDLE + 1.0,
+ Color32::from_white_alpha(230),
+ Stroke::new(1.0, Color32::from_black_alpha(180)),
+ );
+ }
+ }
+ painter.circle_stroke(c, RING, dark);
+ painter.circle_stroke(c, RING, Stroke::new(1.0, Color32::from_white_alpha(140)));
+ let frac = (p.blur / MAX_BLUR) as f32;
+ let steps = (frac * 64.0).ceil().max(1.0) as usize;
+ let arc: Vec<Pos2> = (0..=steps)
+ .map(|k| {
+ let a = -std::f32::consts::FRAC_PI_2 + std::f32::consts::TAU * frac * k as f32 / steps as f32;
+ c + vec2(a.cos(), a.sin()) * RING
+ })
+ .collect();
+ if frac > 0.0 {
+ painter.add(egui::Shape::line(arc.clone(), Stroke::new(4.5, Color32::from_black_alpha(150))));
+ painter.add(egui::Shape::line(arc, Stroke::new(2.5, Color32::WHITE)));
}
+ painter.circle(c, DOT, Color32::WHITE, Stroke::new(1.0, Color32::from_black_alpha(180)));
}
}
diff --git a/crates/ui-egui/src/blur_pins_tests.rs b/crates/ui-egui/src/blur_pins_tests.rs
index 33a691d3d..69013d506 100644
--- a/crates/ui-egui/src/blur_pins_tests.rs
+++ b/crates/ui-egui/src/blur_pins_tests.rs
@@ -6,11 +6,16 @@ use egui_kittest::Harness;
use serde_json::json;
use crate::PhotocraftApp;
-use crate::blur_pins::{COMMAND, Pin, pins, selected};
+use crate::blur_pins::{COMMAND, IRIS, Iris, Pin, pins, selected};
use crate::canvas::ViewXform;
/// A 400×300 document at 400 %, so it fills the window round the dialog, with Field Blur open.
fn harness(selection: bool) -> Harness<'static, PhotocraftApp> {
+ harness_for(COMMAND, selection)
+}
+
+/// [`harness`] with the Blur Gallery `command` open.
+fn harness_for(command: &str, selection: bool) -> Harness<'static, PhotocraftApp> {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
if selection {
@@ -34,7 +39,7 @@ fn harness(selection: bool) -> Harness<'static, PhotocraftApp> {
h.run_steps(4);
let v = &mut h.state_mut().ui.views[0];
(v.zoom, v.center, v.fit_pending) = (4.0, [200.0, 150.0], false);
- crate::filter_dialog::open(h.state_mut(), COMMAND).unwrap();
+ crate::filter_dialog::open(h.state_mut(), command).unwrap();
h.run_steps(4);
h
}
@@ -86,7 +91,7 @@ fn on_screen(h: &Harness<'static, PhotocraftApp>, p: Pin, bounds: [f64; 4]) -> P
fn it_opens_with_one_selected_pin_in_the_middle_of_the_bounds() {
let h = harness(false);
let f = fields(&h);
- assert_eq!(pins(&f), vec![Pin { x: 0.5, y: 0.5, blur: 15.0 }]);
+ assert_eq!(pins(&f), vec![Pin { x: 0.5, y: 0.5, blur: 15.0, iris: None }]);
assert_eq!(selected(&f), Some(0));
assert_eq!(f["__bounds"], json!([0, 0, 400, 300]));
assert!(!f.contains_key("centerX") && !f.contains_key("centerY"), "the pins replace the single centre");
@@ -173,8 +178,107 @@ fn proxy_previews_scale_the_pins_blur() {
assert_eq!(p["pins"][0]["blur"], json!(10.0));
}
+/// Screen point of an Iris pin's local point `(u, v)` (1 = on the outline along that axis), on the
+/// 400×300 canvas (shorter side 300), as the engine places it.
+fn iris_at(h: &Harness<'static, PhotocraftApp>, p: Pin, u: f64, v: f64) -> Pos2 {
+ let s = p.iris.unwrap();
+ let (cx, cy) = (p.x * 400.0, p.y * 300.0);
+ let (x, y) = (u * s.rx * 300.0, v * s.ry * 300.0);
+ let (sin, cos) = s.angle.to_radians().sin_cos();
+ xf(h).to_screen((cx + x * cos - y * sin) as f32, (cy + x * sin + y * cos) as f32)
+}
+
+fn only_pin(h: &Harness<'static, PhotocraftApp>) -> Pin {
+ pins(&fields(h))[0]
+}
+
+#[test]
+fn iris_opens_with_its_shape_as_a_pin() {
+ let h = harness_for(IRIS, false);
+ let f = fields(&h);
+ let list = pins(&f);
+ assert_eq!(list.len(), 1);
+ let (p, s, d) = (list[0], list[0].iris.unwrap(), Iris::default());
+ assert_eq!((p.x, p.y, p.blur), (0.5, 0.5, 15.0));
+ // The dialog's defaults come from the command spec (f32), so compare loosely.
+ for (got, want) in [(s.rx, d.rx), (s.ry, d.ry), (s.angle, d.angle), (s.roundness, d.roundness), (s.feather, d.feather)] {
+ assert!((got - want).abs() < 1e-6, "{s:?}");
+ }
+ for k in ["centerX", "radiusX", "radiusY", "angle", "roundness", "feather"] {
+ assert!(!f.contains_key(k), "{k} is in the pin now");
+ }
+ assert!(f["pins"][0]["radiusX"].as_f64().is_some_and(|r| (r - 0.35).abs() < 1e-6), "the command's own keys: {}", f["pins"]);
+}
+
+/// The selected Iris pin's handles: an outline handle resizes its axis and turns the shape, the
+/// square rounds it, the inner dots set where the blur starts; a new pin copies the shape; OK
+/// applies them all.
+#[test]
+fn iris_handles_resize_turn_round_and_feather() {
+ let mut h = harness_for(IRIS, false);
+ // A small shape, so its handles sit in the free middle of the window, left of the dialog.
+ let small = json!([{"x": 0.5, "y": 0.5, "blur": 15.0, "radiusX": 0.1, "radiusY": 0.08, "angle": 0.0, "roundness": 0.0, "feather": 0.5}]);
+ h.state_mut().ui.dialogs.last_mut().unwrap().fields.insert("pins".into(), small);
+ h.run_steps(2);
+ // Drag the +u handle (30 px right of the centre) to 40 px below it: radius 40/300, a quarter turn.
+ let p = only_pin(&h);
+ let below = xf(&h).to_screen(200.0, 190.0);
+ let from = iris_at(&h, p, 1.0, 0.0);
+ drag(&mut h, &[from, from.lerp(below, 0.5), below]);
+ let s = only_pin(&h).iris.unwrap();
+ assert!((s.rx - 40.0 / 300.0).abs() < 2e-3 && (s.angle - 90.0).abs() < 0.5, "{s:?}");
+ assert_eq!(s.ry, 0.08, "the other axis keeps its radius");
+ // Drag the corner square out along the diagonal to 0.9: the exponent 6.58, roundness 76.
+ let p = only_pin(&h);
+ let t = 0.5f64.sqrt();
+ let path = [iris_at(&h, p, t, -t), iris_at(&h, p, 0.8, -0.8), iris_at(&h, p, 0.9, -0.9)];
+ drag(&mut h, &path);
+ let s = only_pin(&h).iris.unwrap();
+ let m = -std::f64::consts::LN_2 / 0.9f64.ln();
+ assert!((s.roundness - (m - 2.0) / 6.0 * 100.0).abs() < 1.0, "{s:?}");
+ // Drag a feather dot in to a fifth of the way along the diagonal.
+ let p = only_pin(&h);
+ let k = 0.5 * 0.9;
+ let path = [iris_at(&h, p, k, k), iris_at(&h, p, 0.3, 0.3), iris_at(&h, p, 0.2, 0.2)];
+ drag(&mut h, &path);
+ let s = only_pin(&h).iris.unwrap();
+ let want = 0.2 * 2f64.powf(1.0 / m);
+ assert!((s.feather - want).abs() < 0.01, "{} vs {want}", s.feather);
+ // A click away from the shape adds a pin with the same shape and blur.
+ let r = h.state().last_canvas_rect;
+ let at = pos2(r.left() + 80.0, r.bottom() - 80.0);
+ move_to(&mut h, at);
+ button(&mut h, at, true);
+ button(&mut h, at, false);
+ h.run_steps(2);
+ let list = pins(&fields(&h));
+ assert_eq!(list.len(), 2);
+ assert_eq!(list[1].iris, list[0].iris);
+ assert_eq!(selected(&fields(&h)), Some(1));
+ let id = h.state().ui.dialogs.last().unwrap().id;
+ crate::dialogs::confirm(h.state_mut(), id).unwrap();
+ let (cmd, params) = h.state().session.journal.last().cloned().unwrap();
+ assert_eq!(cmd, IRIS);
+ assert_eq!(params["pins"].as_array().map(Vec::len), Some(2));
+ assert_eq!(params["pins"][0]["angle"], json!(s.angle), "{params}");
+}
+
+/// Hostile pin values from automation are cleaned before anything uses them.
+#[test]
+fn iris_pins_are_cleaned() {
+ let mut h = harness_for(IRIS, false);
+ let bad = json!([{"x": 7, "y": -3, "blur": -1, "radiusX": 0, "radiusY": 1e9, "angle": 540.0, "roundness": 300, "feather": 2}]);
+ h.state_mut().ui.dialogs.last_mut().unwrap().fields.insert("pins".into(), bad);
+ let p = only_pin(&h);
+ assert_eq!((p.x, p.y, p.blur), (1.0, 0.0, 0.0));
+ let s = p.iris.unwrap();
+ assert_eq!((s.rx, s.ry, s.angle, s.roundness, s.feather), (0.01, 1.0, -180.0, 100.0, 0.99));
+ h.run_steps(2);
+}
+
/// Alt+Cancel → Reset (#3871) starts the workspace again from one pin in the middle, as when it
-/// opened, instead of leaving it with no pins; the bounds captured on opening stay.
+/// opened, instead of leaving it with no pins; the bounds captured on opening stay. An Iris pin
+/// gets the command's default shape back.
#[test]
fn alt_reset_starts_again_from_one_pin() {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
@@ -186,8 +290,21 @@ fn alt_reset_starts_again_from_one_pin() {
fields.insert("__selected".into(), json!(1));
assert!(crate::dialog_alt_reset::supported(&fields));
crate::dialog_alt_reset::apply(&mut app, &egui::Context::default(), &mut fields);
- assert_eq!(pins(&fields), [Pin { x: 0.5, y: 0.5, blur: 15.0 }]);
+ assert_eq!(pins(&fields), [Pin { x: 0.5, y: 0.5, blur: 15.0, iris: None }]);
assert_eq!(selected(&fields), Some(0));
assert_eq!(fields["__bounds"], bounds);
assert!(!fields.contains_key("centerX") && !fields.contains_key("centerY"), "{fields:?}");
+ let id = crate::filter_dialog::open(&mut app, IRIS).unwrap();
+ let mut fields = app.ui.dialog_mut(id).unwrap().fields.clone();
+ let bent = json!([{"x": 0.2, "y": 0.2, "blur": 40.0, "radiusX": 0.1, "radiusY": 0.1, "angle": 30.0, "roundness": 50.0, "feather": 0.2}]);
+ fields.insert("pins".into(), bent);
+ crate::dialog_alt_reset::apply(&mut app, &egui::Context::default(), &mut fields);
+ let list = pins(&fields);
+ assert_eq!(list.len(), 1);
+ assert_eq!((list[0].x, list[0].y, list[0].blur), (0.5, 0.5, 15.0));
+ // The dialog's defaults come from the command spec (f32), so compare loosely.
+ let (s, d) = (list[0].iris.unwrap(), Iris::default());
+ for (got, want) in [(s.rx, d.rx), (s.ry, d.ry), (s.angle, d.angle), (s.roundness, d.roundness), (s.feather, d.feather)] {
+ assert!((got - want).abs() < 1e-6, "{s:?}");
+ }
}
diff --git a/crates/ui-egui/src/filter_dialog.rs b/crates/ui-egui/src/filter_dialog.rs
index f4dacbc57..2172bc69c 100644
--- a/crates/ui-egui/src/filter_dialog.rs
+++ b/crates/ui-egui/src/filter_dialog.rs
@@ -436,7 +436,7 @@ pub fn reset_fields(app: &PhotocraftApp, fields: &mut Map<String, Value>) {
}
apply_command_defaults(app, &command, fields);
// The schema has no default for the Blur Gallery's pins: start again from the opening one.
- if command == crate::blur_pins::COMMAND {
+ if crate::blur_pins::handles(&command) {
crate::blur_pins::reset(fields);
}
}
@@ -458,7 +458,7 @@ pub fn open(app: &mut PhotocraftApp, command: &str) -> Option<u64> {
}
restore_remembered(app, command, spec.params, &mut fields);
apply_command_defaults(app, command, &mut fields);
- if command == crate::blur_pins::COMMAND {
+ if crate::blur_pins::handles(command) {
crate::blur_pins::init(app, &mut fields);
}
if parse_spec(spec.params).iter().any(|p| p.kind == Kind::Document) {
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index 4d651a097..01773e3c9 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -562,6 +562,7 @@
# Field Blur pins (#3373)
No pin selected Není vybrán žádný špendlík
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Kliknutím do obrazu přidáte špendlík; tažením špendlík přesunete, tažením jeho prstence změníte rozostření. Delete odstraní vybraný špendlík.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Tažením úchytů na obrysu ho změníte a otočíte, čtverečkem zaoblíte rohy a body uvnitř nastavíte, kde začíná rozostření.
Iris Blur… Rozostření clonou…
Tilt-Shift… Tilt-shift…
Path Blur… Rozostření podél cesty…
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index b1d214b15..448e775f8 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -561,6 +561,7 @@
# Field Blur pins (#3373)
No pin selected Kein Pin ausgewählt
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Klicken Sie ins Bild, um einen Pin hinzuzufügen; ziehen Sie einen Pin, um ihn zu verschieben, oder seinen Ring, um die Unschärfe zu ändern. Entf entfernt den ausgewählten Pin.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Ziehen Sie die Griffe am Umriss, um ihn zu skalieren und zu drehen, das Quadrat, um die Ecken abzurunden, und die Punkte innen, um festzulegen, wo die Unschärfe beginnt.
Iris Blur… Irisweichzeichner…
Tilt-Shift… Tilt-Shift…
Path Blur… Pfadweichzeichner…
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index 6bc441d0e..ebc1fd16e 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -2401,6 +2401,7 @@
# Field Blur pins (#3373)
No pin selected Δεν έχει επιλεγεί καρφίτσα
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Κάντε κλικ στην εικόνα για να προσθέσετε καρφίτσα· σύρετε μια καρφίτσα για να τη μετακινήσετε ή τον δακτύλιό της για να αλλάξετε τη θόλωση. Το Delete αφαιρεί την επιλεγμένη καρφίτσα.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Σύρετε τις λαβές στο περίγραμμα για αλλαγή μεγέθους και περιστροφή, το τετράγωνο για στρογγύλεμα των γωνιών και τις κουκκίδες μέσα για να ορίσετε πού αρχίζει η θόλωση.
File Info Πληροφορίες αρχείου
File Settings Ρυθμίσεις αρχείου
Fill Path Γέμισμα διαδρομής
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index aa947f228..49876d665 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -558,6 +558,7 @@
# Field Blur pins (#3373)
No pin selected Ningún pin seleccionado
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Haga clic en la imagen para añadir un pin; arrastre un pin para moverlo o su anillo para cambiar el desenfoque. Suprimir elimina el pin seleccionado.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Arrastre los manejadores del contorno para cambiar su tamaño y girarlo, el cuadrado para redondear las esquinas y los puntos interiores para fijar dónde empieza el desenfoque.
Iris Blur… Desenfoque de iris…
Tilt-Shift… Cambio de inclinación…
Path Blur… Desenfoque de trazado…
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index d597d4444..bf3be664d 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -546,6 +546,7 @@
# Field Blur pins (#3373)
No pin selected Aucune épingle sélectionnée
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Cliquez dans l’image pour ajouter une épingle ; faites glisser une épingle pour la déplacer, ou son anneau pour modifier le flou. Suppr supprime l’épingle sélectionnée.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Faites glisser les poignées du contour pour le redimensionner et le faire pivoter, le carré pour arrondir ses angles et les points intérieurs pour définir où commence le flou.
Iris Blur… Flou d'iris…
Tilt-Shift… Inclinaison-décalage…
Path Blur… Flou de tracé…
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index ded1a41a0..ec895457f 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -563,6 +563,7 @@
Field Blur… Mezőelmosás…
No pin selected Nincs kijelölt tű
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Kattints a képre tű hozzáadásához; húzd a tűt az áthelyezéséhez, vagy a gyűrűjét az elmosás módosításához. A Delete törli a kijelölt tűt.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Húzd a körvonal fogantyúit az átméretezéshez és az elforgatáshoz, a négyzetet a sarkok lekerekítéséhez, a belső pontokat pedig annak beállításához, hol kezdődjön az elmosás.
Fill Path… Útvonal kitöltése…
Fill Screen Képernyő kitöltése
Filter Szűrő
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 1f9e9f555..cef690031 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -539,6 +539,7 @@
# Field Blur pins (#3373)
No pin selected Tidak ada pin yang dipilih
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Klik gambar untuk menambah pin; seret pin untuk memindahkannya, atau cincinnya untuk mengubah blur. Delete menghapus pin yang dipilih.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Seret pegangan pada garis luar untuk mengubah ukuran dan memutarnya, kotak untuk membulatkan sudutnya, dan titik di dalam untuk menentukan di mana blur dimulai.
Iris Blur… Iris Blur…
Tilt-Shift… Tilt-Shift…
Path Blur… Path Blur…
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index 85313e7c6..c11061f36 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -554,6 +554,7 @@
# Field Blur pins (#3373)
No pin selected Nessuna puntina selezionata
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Fai clic sull’immagine per aggiungere una puntina; trascina una puntina per spostarla o il suo anello per cambiare la sfocatura. Canc rimuove la puntina selezionata.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Trascina le maniglie sul contorno per ridimensionarlo e ruotarlo, il quadrato per arrotondarne gli angoli e i punti interni per stabilire dove inizia la sfocatura.
Iris Blur… Sfocatura diaframma…
Tilt-Shift… Miniatura…
Path Blur… Sfocatura tracciato…
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 19ae9575e..a25950269 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -556,6 +556,7 @@
# Field Blur pins (#3373)
No pin selected ピンが選択されていません
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. 画像をクリックしてピンを追加します。ピンをドラッグして移動し、リングをドラッグしてぼかしを変更します。Delete キーで選択したピンを削除します。
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. 輪郭上のハンドルをドラッグしてサイズ変更と回転、四角形で角の丸み、内側の点でぼかしの開始位置を設定します。
Iris Blur… 虹彩絞りぼかし…
Tilt-Shift… チルトシフト…
Path Blur… パスぼかし…
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index 2371720eb..86b4c8c11 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -543,6 +543,7 @@
# Field Blur pins (#3373)
No pin selected 선택한 핀 없음
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. 이미지를 클릭하여 핀을 추가합니다. 핀을 드래그하여 이동하고, 링을 드래그하여 흐림 정도를 바꿉니다. Delete 키로 선택한 핀을 삭제합니다.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. 윤곽선의 핸들을 드래그하여 크기를 바꾸고 회전하고, 사각형으로 모서리를 둥글게 하며, 안쪽 점으로 흐림이 시작되는 위치를 설정합니다.
Iris Blur… 조리개 흐림 효과…
Tilt-Shift… 기울기-이동…
Path Blur… 패스 흐림 효과…
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index a6ba4b854..051ba7fb1 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -546,6 +546,7 @@
# Field Blur pins (#3373)
No pin selected Geen speld geselecteerd
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Klik in de afbeelding om een speld toe te voegen; sleep een speld om hem te verplaatsen, of zijn ring om de vervaging te wijzigen. Delete verwijdert de geselecteerde speld.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Sleep de grepen op de omtrek om hem te schalen en te draaien, het vierkantje om de hoeken af te ronden en de punten binnenin om in te stellen waar de vervaging begint.
Iris Blur… Irisvervaging…
Tilt-Shift… Tilt-shift…
Path Blur… Padvervaging…
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index ae92d2152..d472518aa 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -555,6 +555,7 @@
# Field Blur pins (#3373)
No pin selected Nie zaznaczono pinezki
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Kliknij obraz, aby dodać pinezkę; przeciągnij pinezkę, aby ją przesunąć, lub jej pierścień, aby zmienić rozmycie. Delete usuwa zaznaczoną pinezkę.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Przeciągnij uchwyty na obrysie, aby zmienić rozmiar i obrócić kształt, kwadrat, aby zaokrąglić narożniki, a punkty wewnątrz, aby ustawić, gdzie zaczyna się rozmycie.
Iris Blur… Rozmycie irysowe…
Tilt-Shift… Tilt-shift…
Path Blur… Rozmycie ścieżki…
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 10176e31e..97f7c5d72 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -540,6 +540,7 @@
# Field Blur pins (#3373)
No pin selected Nenhum alfinete selecionado
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Clique na imagem para adicionar um alfinete; arraste um alfinete para movê-lo ou o anel dele para alterar o desfoque. Delete remove o alfinete selecionado.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Arraste as alças do contorno para redimensionar e girar, o quadrado para arredondar os cantos e os pontos internos para definir onde o desfoque começa.
Iris Blur… Desfoque de íris…
Tilt-Shift… Tilt-shift…
Path Blur… Desfoque de demarcador…
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index f74b9f485..45e374c05 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -346,6 +346,7 @@
# Field Blur pins (#3373)
No pin selected Булавка не выбрана
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Щелкните изображение, чтобы добавить булавку; перетащите булавку, чтобы переместить ее, или ее кольцо, чтобы изменить размытие. Delete удаляет выбранную булавку.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Перетаскивайте маркеры на контуре, чтобы изменить размер и повернуть его, квадрат — чтобы скруглить углы, а точки внутри — чтобы задать, где начинается размытие.
Iris Blur… Диафрагменное размытие…
Tilt-Shift… Наклон-сдвиг…
Path Blur… Размытие по контуру…
diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv
index 9aebfe1f5..e9c5a8207 100644
--- a/crates/ui-egui/src/i18n/sr.tsv
+++ b/crates/ui-egui/src/i18n/sr.tsv
@@ -535,6 +535,7 @@
Field Blur… Zamućenje polja…
No pin selected Nijedna čioda nije izabrana
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Kliknite na sliku da dodate čiodu; prevucite čiodu da je pomerite ili njen prsten da promenite zamućenje. Delete uklanja izabranu čiodu.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Prevucite ručke na obrisu da promenite veličinu i rotirate ga, kvadrat da zaoblite uglove, a tačke unutra da odredite gde zamućenje počinje.
Iris Blur… Iris zamućenje…
Tilt-Shift… Tilt-shift…
Path Blur… Zamućenje duž putanje…
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index d6076ec35..0ff220a5f 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -534,6 +534,7 @@
Field Blur… Alan Bulanıklığı…
No pin selected Seçili pim yok
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Pim eklemek için görüntüye tıklayın; taşımak için pimi, bulanıklığını değiştirmek için halkasını sürükleyin. Delete seçili pimi siler.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Yeniden boyutlandırmak ve döndürmek için dış çizgideki tutamaçları, köşeleri yuvarlamak için kareyi, bulanıklığın nerede başlayacağını belirlemek için içerideki noktaları sürükleyin.
Iris Blur… İris Bulanıklığı…
Tilt-Shift… Tilt-Shift…
Path Blur… Yol Bulanıklığı…
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index 7255c24f1..d1b14dea5 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -324,6 +324,7 @@
# Field Blur pins (#3373)
No pin selected Шпильку не вибрано
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Клацніть зображення, щоб додати шпильку; перетягніть шпильку, щоб перемістити її, або її кільце, щоб змінити розмиття. Delete видаляє вибрану шпильку.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Перетягуйте маркери на контурі, щоб змінити розмір і повернути його, квадрат — щоб заокруглити кути, а точки всередині — щоб задати, де починається розмиття.
Iris Blur… Розмиття діафрагми…
Tilt-Shift… Нахил і зсув…
Path Blur… Розмиття вздовж контуру…
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index d6a82f203..9a2955733 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -511,6 +511,7 @@
# Field Blur pins (#3373)
No pin selected Chưa chọn ghim nào
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. Bấm vào ảnh để thêm ghim; kéo ghim để di chuyển, hoặc kéo vòng của ghim để đổi độ mờ. Delete xóa ghim đã chọn.
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. Kéo các tay nắm trên đường viền để đổi kích thước và xoay, kéo ô vuông để bo tròn góc, và kéo các chấm bên trong để đặt nơi bắt đầu làm mờ.
Filter Gallery… Thư viện bộ lọc…
Find Edges Tìm cạnh
Flame… Ngọn lửa…
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index d912da2c5..26c6c266a 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -561,6 +561,7 @@
# Field Blur pins (#3373)
No pin selected 未选择图钉
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. 单击图像以添加图钉;拖动图钉可移动它,拖动其圆环可更改模糊程度。按 Delete 键删除所选图钉。
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. 拖动轮廓上的手柄可调整大小并旋转,拖动方块可将角变圆,拖动内部的点可设置模糊开始的位置。
Iris Blur… 光圈模糊…
Tilt-Shift… 移轴模糊…
Path Blur… 路径模糊…
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index a92587214..583ae197c 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -566,6 +566,7 @@
# Field Blur pins (#3373)
No pin selected 未選取圖釘
Click the image to add a pin; drag a pin to move it, or its ring to change its blur. Delete removes the selected pin. 按一下影像即可新增圖釘;拖移圖釘可移動它,拖移其圓環可變更模糊程度。按 Delete 鍵刪除所選圖釘。
+ Drag the handles on the outline to resize and turn it, the square to round its corners, and the dots inside to set where the blur starts. 拖移輪廓上的控點可調整大小並旋轉,拖移方塊可將角變圓,拖移內部的點可設定模糊開始的位置。
Iris Blur… 光圈模糊…
Tilt-Shift… 傾斜偏移…
Path Blur… 路徑模糊…
diff --git a/docs/gaps.md b/docs/gaps.md
index 3c9561574..02efb1b5d 100644
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@ -69,8 +69,9 @@ what an agent can't finish alone.
(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).
- Blur Gallery: Field Blur has its on-canvas pins (2026-10-11, #3373); Iris, Tilt-Shift, Spin and
- Path Blur still edit their pins as parameter dialogs.
+ Blur Gallery: Field Blur's pins and Iris Blur's pins with their outline, roundness and feather
+ handles are edited on the image (2026-10-11, #3373); Tilt-Shift, Spin and Path Blur are still
+ parameter dialogs.
- **Evidence:** scorecard rows above, all partial or missing.
- **Impact:** these are the tools retouchers and compositors use daily; a slider dialog is not a
substitute.
@@ -290,6 +291,7 @@ what an agent can't finish alone.
| 2026-10-12 | minor | G4: checkbox-only Brush Settings rows preserve the open controls and Smoothing settings (#4283); no readiness percentage or estimate changed |
| 2026-10-12 | minor | G11: Load/Save Actions `.atn` landed (AUTO-219-2 partial); remaining panel work listed |
| 2026-10-12 | minor | Refreshed against main: G5 items fixed by #2480, #2327, #2609, #2684, #2675, #2556, #2396, #2527, #2625 and TOOL-214-5/#2442; G7 TOOL-214-7 and Transform On Drop done; G2 #2377 fixed (#2417); G9 UI scale (UI-217-9) and Stamp Visible (UI-217-22) done, prefs 27 of 156; G10 #2225 done (#2482); G13 Khmer, Lao, Myanmar fallback (#3259); G14 CR3 line; G17 Windows ARM64 done (DIST-220-2) |
+| 2026-10-11 | minor | G7: Iris Blur's pins, outline, roundness and feather handles on the image too; Tilt-Shift, Spin and Path Blur remain dialogs |
| 2026-10-11 | minor | G7: Field Blur pins are placed, dragged and tuned on the image (#3373); the other Blur Gallery filters remain dialogs |
| 2026-10-11 | minor | D5100 image area and Camera Raw tuning validation; G14 remains open |
| 2026-10-11 | minor | G13: Czech dynamic UI text localized; engine messages and native review remain open |