Skip to content

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

Brush Settings: a response curve per dynamic control (#3294) (#3302)

Valentin Kleinf5606093cd66
diff --git a/crates/engine/src/brush_cmds/tests.rs b/crates/engine/src/brush_cmds/tests.rs
index f1c818824..eaf69281b 100644
--- a/crates/engine/src/brush_cmds/tests.rs
+++ b/crates/engine/src/brush_cmds/tests.rs
@@ -942,6 +942,23 @@ fn an_offer_that_does_not_match_the_commit_is_ignored() {
assert!(r.get("fromLive").is_none());
}
+#[test]
+fn set_brush_takes_a_per_dynamic_curve_and_a_patch_resets_it() {
+ let mut s = session(20, 20);
+ let curve = json!([[0.0, 0.0], [0.5, 0.2], [1.0, 1.0]]);
+ s.execute("tools.setBrush", json!({"shapeDynamics": {"enabled": true, "size": {"control": "penPressure", "curve": curve}}})).unwrap();
+ let with = s.tools.brush.clone();
+ assert_eq!(with.shape_dynamics.size.curve.points(), vec![[0.0, 0.0], [0.5, 0.2], [1.0, 1.0]]);
+ assert!(with.transfer.opacity.curve.is_linear(), "other dynamics keep their own curve");
+ // The panel's diff back to linear is a real patch, and applying it restores the linear curve.
+ let mut linear = with.clone();
+ linear.shape_dynamics.size.curve = photocraft_paint::ResponseCurve::LINEAR;
+ let patch = brush_patch(&with, &linear);
+ assert_eq!(patch["shapeDynamics"]["size"]["curve"], json!([[0.0, 0.0], [1.0, 1.0]]));
+ s.execute("tools.setBrush", patch).unwrap();
+ assert!(s.tools.brush.shape_dynamics.size.curve.is_linear());
+}
+
#[test]
fn last_brush_is_remembered_when_the_revision_moves_only() {
let mut s = session(8, 8);
diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs
index b805466f8..f5f31c11e 100644
--- a/crates/engine/src/prefs.rs
+++ b/crates/engine/src/prefs.rs
@@ -400,100 +400,10 @@ impl Default for Tools {
}
}
-/// Preferences › Tools › Pressure Curve, ready to evaluate: a monotone cubic (Fritsch–Carlson)
-/// through the control points, so a firmer press never gives less pressure. The points are
-/// sanitised here, not trusted: a whole-section update or a hand-edited preferences file can store
-/// anything. Non-finite points are dropped, the rest clamped to 0..1, sorted by input (one point
-/// per input), capped at [`Self::MAX_POINTS`], and their outputs made non-decreasing; before the
-/// first point and after the last the curve stays flat. Fewer than two usable points is linear.
-#[derive(Clone, Debug, PartialEq)]
-pub struct PressureCurve {
- xs: Vec<f32>,
- ys: Vec<f32>,
- /// Tangents at the points.
- ms: Vec<f32>,
-}
-
-impl PressureCurve {
- pub const MAX_POINTS: usize = 16;
-
- pub fn new(points: &[[f32; 2]]) -> Self {
- let mut pts: Vec<[f32; 2]> =
- points.iter().filter(|p| p[0].is_finite() && p[1].is_finite()).map(|p| [p[0].clamp(0.0, 1.0), p[1].clamp(0.0, 1.0)]).collect();
- pts.sort_by(|a, b| a[0].total_cmp(&b[0]));
- pts.dedup_by(|b, a| {
- // Same input: keep the later point's output.
- let same = (a[0] - b[0]).abs() < 1e-6;
- if same {
- a[1] = b[1];
- }
- same
- });
- pts.truncate(Self::MAX_POINTS);
- if pts.len() < 2 {
- pts = vec![[0.0, 0.0], [1.0, 1.0]];
- }
- let xs: Vec<f32> = pts.iter().map(|p| p[0]).collect();
- let mut ys: Vec<f32> = pts.iter().map(|p| p[1]).collect();
- for i in 1..ys.len() {
- ys[i] = ys[i].max(ys[i - 1]);
- }
- // Fritsch–Carlson tangents: secant averages, zero at flat steps, limited so the cubic
- // never overshoots (which keeps it monotone).
- let n = xs.len();
- let d: Vec<f32> = (0..n - 1).map(|k| (ys[k + 1] - ys[k]) / (xs[k + 1] - xs[k])).collect();
- let mut ms = vec![0.0f32; n];
- ms[0] = d[0];
- ms[n - 1] = d[n - 2];
- for k in 1..n - 1 {
- ms[k] = if d[k - 1] * d[k] <= 0.0 { 0.0 } else { (d[k - 1] + d[k]) / 2.0 };
- }
- for k in 0..n - 1 {
- if d[k] == 0.0 {
- ms[k] = 0.0;
- ms[k + 1] = 0.0;
- continue;
- }
- let (a, b) = (ms[k] / d[k], ms[k + 1] / d[k]);
- let s = a * a + b * b;
- if s > 9.0 {
- let t = 3.0 / s.sqrt();
- ms[k] = t * a * d[k];
- ms[k + 1] = t * b * d[k];
- }
- }
- Self { xs, ys, ms }
- }
-
- /// The curve's output for pen pressure `x` (0..1; anything else is clamped, NaN reads as 0).
- pub fn eval(&self, x: f32) -> f32 {
- let x = if x.is_nan() { 0.0 } else { x.clamp(0.0, 1.0) };
- let n = self.xs.len();
- let (Some(&x0), Some(&xn)) = (self.xs.first(), self.xs.last()) else { return x };
- if x <= x0 {
- return self.ys.first().copied().unwrap_or(x);
- }
- if x >= xn {
- return self.ys.last().copied().unwrap_or(x);
- }
- let k = self.xs.partition_point(|&v| v <= x).saturating_sub(1).min(n.saturating_sub(2));
- let (Some(&xa), Some(&xb), Some(&ya), Some(&yb), Some(&ma), Some(&mb)) =
- (self.xs.get(k), self.xs.get(k + 1), self.ys.get(k), self.ys.get(k + 1), self.ms.get(k), self.ms.get(k + 1))
- else {
- return x;
- };
- let h = xb - xa;
- let t = (x - xa) / h;
- let (t2, t3) = (t * t, t * t * t);
- let y = (2.0 * t3 - 3.0 * t2 + 1.0) * ya + (t3 - 2.0 * t2 + t) * h * ma + (-2.0 * t3 + 3.0 * t2) * yb + (t3 - t2) * h * mb;
- y.clamp(ya.min(yb), ya.max(yb))
- }
-
- /// The identity (the default curve): pressure passes through unchanged.
- pub fn is_linear(&self) -> bool {
- self.xs == [0.0, 1.0] && self.ys == [0.0, 1.0]
- }
-}
+/// Preferences › Tools › Pressure Curve, ready to evaluate: the same monotone cubic every brush
+/// dynamic uses for its own control ([`photocraft_paint::ResponseCurve`]), sanitised the same way,
+/// since a whole-section update or a hand-edited preferences file can store anything.
+pub use photocraft_paint::ResponseCurve as PressureCurve;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
diff --git a/crates/io/src/abr_map.rs b/crates/io/src/abr_map.rs
index 53cfd205f..549ac4097 100644
--- a/crates/io/src/abr_map.rs
+++ b/crates/io/src/abr_map.rs
@@ -290,6 +290,7 @@ impl Mapper<'_> {
control,
fade_steps: num(d, "fStp").map_or(25, |v| v.clamp(1.0, 9999.0) as u32),
minimum: pct(d, "Mnm ").unwrap_or(0.0).clamp(0.0, 1.0),
+ ..Dynamic::default()
}
}
diff --git a/crates/paint/src/brush.rs b/crates/paint/src/brush.rs
index 354dd61d5..d60412a58 100644
--- a/crates/paint/src/brush.rs
+++ b/crates/paint/src/brush.rs
@@ -10,6 +10,7 @@
use photocraft_color::BlendMode;
use serde::{Deserialize, Serialize};
+use crate::curve::ResponseCurve;
use crate::mixer::MixerSettings;
use crate::tile::{GrayTile, StoredTile};
@@ -51,20 +52,24 @@ pub struct Dynamic {
pub fade_steps: u32,
/// 0..1 floor the control/jitter may reduce the value to (minimum diameter, roundness, depth…).
pub minimum: f32,
+ /// This dynamic's own response to its control (Fade, Pen Pressure, Pen Tilt, Stylus Wheel,
+ /// Rotation), applied after the global pen curve. Linear by default. Always written to JSON, so
+ /// a `tools.setBrush` patch can set it back to linear. Angle Jitter's controls ignore it.
+ pub curve: ResponseCurve,
}
impl Default for Dynamic {
fn default() -> Self {
- Self { jitter: 0.0, control: Control::Off, fade_steps: 25, minimum: 0.0 }
+ Self { jitter: 0.0, control: Control::Off, fade_steps: 25, minimum: 0.0, curve: ResponseCurve::LINEAR }
}
}
impl Dynamic {
pub const fn controlled(control: Control) -> Self {
- Self { jitter: 0.0, control, fade_steps: 25, minimum: 0.0 }
+ Self { jitter: 0.0, control, fade_steps: 25, minimum: 0.0, curve: ResponseCurve::LINEAR }
}
pub const fn jitter(jitter: f32) -> Self {
- Self { jitter, control: Control::Off, fade_steps: 25, minimum: 0.0 }
+ Self { jitter, control: Control::Off, fade_steps: 25, minimum: 0.0, curve: ResponseCurve::LINEAR }
}
pub fn is_active(&self) -> bool {
self.jitter > 0.0 || self.control != Control::Off
diff --git a/crates/paint/src/brush_tests.rs b/crates/paint/src/brush_tests.rs
index 284b7ae3b..d0d7de411 100644
--- a/crates/paint/src/brush_tests.rs
+++ b/crates/paint/src/brush_tests.rs
@@ -263,6 +263,28 @@ fn pressure_controls_size_with_minimum() {
assert!(d.windows(2).all(|w| w[1].radius >= w[0].radius - 1e-4));
}
+#[test]
+fn each_dynamic_responds_through_its_own_curve() {
+ // A hard size curve (half pressure gives a fifth of the size range) and a linear opacity.
+ let curve = crate::ResponseCurve::new(&[[0.0, 0.0], [0.5, 0.2], [1.0, 1.0]]);
+ let b = BrushSettings {
+ size: 40.0,
+ shape_dynamics: ShapeDynamics { enabled: true, size: Dynamic { curve, ..Dynamic::controlled(Control::PenPressure) }, ..Default::default() },
+ transfer: Transfer { enabled: true, opacity: Dynamic::controlled(Control::PenPressure), ..Default::default() },
+ ..brush()
+ };
+ let d = dabs_of(&b, &[StrokePoint::new(0.0, 0.0, 0.5), StrokePoint::new(1.0, 0.0, 0.5)]);
+ assert!((d[0].radius - 4.0).abs() < 1e-3, "20 % of a 40 px diameter → r 4, got {}", d[0].radius);
+ assert!((d[0].opacity - 0.5).abs() < 1e-3, "opacity keeps its linear response: {}", d[0].opacity);
+ // The curve is part of the brush's JSON.
+ let json = serde_json::to_value(&b).unwrap();
+ let stored: Vec<[f32; 2]> = serde_json::from_value(json["shapeDynamics"]["size"]["curve"].clone()).unwrap();
+ assert_eq!(stored, vec![[0.0, 0.0], [0.5, 0.2], [1.0, 1.0]]);
+ assert_eq!(json["transfer"]["opacity"]["curve"], serde_json::json!([[0.0, 0.0], [1.0, 1.0]]));
+ let back: BrushSettings = serde_json::from_value(json).unwrap();
+ assert_eq!(back.shape_dynamics.size.curve, curve);
+}
+
#[test]
fn fade_ramps_over_steps() {
let b = BrushSettings {
diff --git a/crates/paint/src/curve.rs b/crates/paint/src/curve.rs
new file mode 100644
index 000000000..4ee766ae9
--- /dev/null
+++ b/crates/paint/src/curve.rs
@@ -0,0 +1,173 @@
+//! A response curve: how a 0..1 input (pen pressure, tilt, wheel, a fade ramp) maps to a 0..1
+//! output. Preferences › Tools › Pressure Curve shapes the pen's pressure globally; every brush
+//! dynamic carries its own curve for its control ([`crate::Dynamic::curve`]).
+
+use serde::{Deserialize, Deserializer, Serialize, Serializer};
+
+/// Most control points a curve keeps.
+const MAX: usize = 16;
+
+/// A monotone cubic (Fritsch–Carlson) through `[input, output]` control points, so a stronger
+/// input never gives less output. Points are sanitised, not trusted: non-finite points are dropped,
+/// the rest clamped to 0..1, sorted by input (one point per input, the later output wins), capped
+/// at [`Self::MAX_POINTS`], and their outputs made non-decreasing. Before the first point and after
+/// the last the curve stays flat. Fewer than two usable points is linear.
+///
+/// Fixed-size and `Copy`, so a brush evaluates it per dab without allocating. In JSON it is its
+/// list of points, `[[0,0],[0.5,0.2],[1,1]]`.
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct ResponseCurve {
+ n: u8,
+ xs: [f32; MAX],
+ ys: [f32; MAX],
+ /// Tangents at the points.
+ ms: [f32; MAX],
+}
+
+const fn padded(a: f32, b: f32) -> [f32; MAX] {
+ let mut v = [0.0; MAX];
+ v[0] = a;
+ v[1] = b;
+ v
+}
+
+impl Default for ResponseCurve {
+ fn default() -> Self {
+ Self::LINEAR
+ }
+}
+
+impl ResponseCurve {
+ pub const MAX_POINTS: usize = MAX;
+
+ /// The identity: input passes through unchanged.
+ pub const LINEAR: Self = Self { n: 2, xs: padded(0.0, 1.0), ys: padded(0.0, 1.0), ms: padded(1.0, 1.0) };
+
+ pub fn new(points: &[[f32; 2]]) -> Self {
+ let mut pts: Vec<[f32; 2]> =
+ points.iter().filter(|p| p[0].is_finite() && p[1].is_finite()).map(|p| [p[0].clamp(0.0, 1.0), p[1].clamp(0.0, 1.0)]).collect();
+ pts.sort_by(|a, b| a[0].total_cmp(&b[0]));
+ pts.dedup_by(|b, a| {
+ // Same input: keep the later point's output.
+ let same = (a[0] - b[0]).abs() < 1e-6;
+ if same {
+ a[1] = b[1];
+ }
+ same
+ });
+ pts.truncate(MAX);
+ let n = pts.len();
+ if n < 2 {
+ return Self::LINEAR;
+ }
+ let mut c = Self { n: n as u8, xs: [0.0; MAX], ys: [0.0; MAX], ms: [0.0; MAX] };
+ let mut prev = 0.0f32;
+ for (k, p) in pts.iter().enumerate() {
+ c.xs[k] = p[0];
+ // Outputs never fall: the curve is monotone.
+ prev = if k == 0 { p[1] } else { p[1].max(prev) };
+ c.ys[k] = prev;
+ }
+ // Fritsch–Carlson tangents: secant averages, zero at flat steps, limited so the cubic
+ // never overshoots (which keeps it monotone).
+ let mut d = [0.0f32; MAX];
+ for (k, dk) in d.iter_mut().enumerate().take(n - 1) {
+ *dk = (c.ys[k + 1] - c.ys[k]) / (c.xs[k + 1] - c.xs[k]);
+ }
+ c.ms[0] = d[0];
+ c.ms[n - 1] = d[n - 2];
+ for k in 1..n - 1 {
+ c.ms[k] = if d[k - 1] * d[k] <= 0.0 { 0.0 } else { (d[k - 1] + d[k]) / 2.0 };
+ }
+ for (k, &dk) in d.iter().enumerate().take(n - 1) {
+ if dk == 0.0 {
+ c.ms[k] = 0.0;
+ c.ms[k + 1] = 0.0;
+ continue;
+ }
+ let (a, b) = (c.ms[k] / dk, c.ms[k + 1] / dk);
+ let s = a * a + b * b;
+ if s > 9.0 {
+ let t = 3.0 / s.sqrt();
+ c.ms[k] = t * a * dk;
+ c.ms[k + 1] = t * b * dk;
+ }
+ }
+ c
+ }
+
+ /// The control points (sanitised).
+ pub fn points(&self) -> Vec<[f32; 2]> {
+ self.xs.iter().zip(&self.ys).take(usize::from(self.n)).map(|(&x, &y)| [x, y]).collect()
+ }
+
+ /// The curve's output for input `x` (0..1; anything else is clamped, NaN reads as 0).
+ pub fn eval(&self, x: f32) -> f32 {
+ let x = if x.is_nan() { 0.0 } else { x.clamp(0.0, 1.0) };
+ if self.is_linear() {
+ return x;
+ }
+ let n = usize::from(self.n).min(MAX);
+ let (xs, ys, ms) = (self.xs.get(..n).unwrap_or(&[]), self.ys.get(..n).unwrap_or(&[]), self.ms.get(..n).unwrap_or(&[]));
+ let (Some(&x0), Some(&xn)) = (xs.first(), xs.last()) else { return x };
+ if x <= x0 {
+ return ys.first().copied().unwrap_or(x);
+ }
+ if x >= xn {
+ return ys.last().copied().unwrap_or(x);
+ }
+ let k = xs.partition_point(|&v| v <= x).saturating_sub(1).min(n.saturating_sub(2));
+ let (Some(&xa), Some(&xb), Some(&ya), Some(&yb), Some(&ma), Some(&mb)) = (xs.get(k), xs.get(k + 1), ys.get(k), ys.get(k + 1), ms.get(k), ms.get(k + 1))
+ else {
+ return x;
+ };
+ let h = xb - xa;
+ let t = (x - xa) / h;
+ let (t2, t3) = (t * t, t * t * t);
+ let y = (2.0 * t3 - 3.0 * t2 + 1.0) * ya + (t3 - 2.0 * t2 + t) * h * ma + (-2.0 * t3 + 3.0 * t2) * yb + (t3 - t2) * h * mb;
+ y.clamp(ya.min(yb), ya.max(yb))
+ }
+
+ /// The identity (the default curve).
+ pub fn is_linear(&self) -> bool {
+ self.n == 2 && self.xs[..2] == [0.0, 1.0] && self.ys[..2] == [0.0, 1.0]
+ }
+}
+
+impl Serialize for ResponseCurve {
+ fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
+ self.points().serialize(s)
+ }
+}
+
+impl<'de> Deserialize<'de> for ResponseCurve {
+ fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
+ Ok(Self::new(&Vec::<[f32; 2]>::deserialize(d)?))
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn a_curve_is_monotone_sanitised_and_round_trips_as_points() {
+ assert!(ResponseCurve::new(&[[0.0, 0.0], [1.0, 1.0]]).is_linear());
+ assert_eq!(ResponseCurve::new(&[[0.0, 0.0], [1.0, 1.0]]), ResponseCurve::LINEAR);
+ assert!(ResponseCurve::new(&[[f32::NAN, 0.3]]).is_linear(), "fewer than two usable points is linear");
+ let c = ResponseCurve::new(&[[1.0, 1.0], [0.5, 0.2], [0.0, 0.0]]);
+ assert!((c.eval(0.5) - 0.2).abs() < 1e-6);
+ let mut prev = 0.0;
+ for i in 0..=100 {
+ let y = c.eval(i as f32 / 100.0);
+ assert!(y >= prev - 1e-6 && (0.0..=1.0).contains(&y));
+ prev = y;
+ }
+ let json = serde_json::to_string(&c).unwrap_or_default();
+ assert_eq!(json, "[[0.0,0.0],[0.5,0.2],[1.0,1.0]]");
+ let back: ResponseCurve = serde_json::from_str(&json).unwrap_or_default();
+ assert_eq!(back, c);
+ let many: Vec<[f32; 2]> = (0..40).map(|i| [i as f32 / 40.0, 0.5]).collect();
+ assert_eq!(ResponseCurve::new(&many).points().len(), ResponseCurve::MAX_POINTS);
+ }
+}
diff --git a/crates/paint/src/dynamics.rs b/crates/paint/src/dynamics.rs
index 25354dd6d..ab846f195 100644
--- a/crates/paint/src/dynamics.rs
+++ b/crates/paint/src/dynamics.rs
@@ -356,6 +356,16 @@ pub fn control_value(c: Control, fade_steps: u32, s: &StepInput) -> f32 {
}
}
+/// A dynamic's control value passed through its own response curve ([`Dynamic::curve`]). Controls
+/// with no 0..1 input (Off, the direction controls) read 1 and skip the curve.
+pub fn dynamic_value(d: &Dynamic, s: &StepInput) -> f32 {
+ let v = control_value(d.control, d.fade_steps, s);
+ match d.control {
+ Control::Off | Control::InitialDirection | Control::Direction => v,
+ Control::Fade | Control::PenPressure | Control::PenTilt | Control::StylusWheel | Control::Rotation => d.curve.eval(v),
+ }
+}
+
/// Angle contributed by a control, in degrees (counter-clockwise).
pub fn control_angle(c: Control, fade_steps: u32, s: &StepInput) -> f32 {
let p = &s.point;
@@ -384,7 +394,7 @@ fn scalar(d: &Dynamic, s: &StepInput, r: f32) -> f32 {
return 1.0;
}
let min = d.minimum.clamp(0.0, 1.0);
- let cv = control_value(d.control, d.fade_steps, s);
+ let cv = dynamic_value(d, s);
let v = (min + (1.0 - min) * cv) * (1.0 - d.jitter.clamp(0.0, 1.0) * r);
v.max(min)
}
@@ -425,7 +435,7 @@ pub fn dynamic_color(b: &BrushSettings, s: &StepInput, seed: u64, index: u64) ->
let cd = &b.color_dynamics;
let (fg, bg) = (b.color, b.background);
let r = |st: u64| rand01(seed, index, st);
- let base = if cd.fg_bg.control != Control::Off { 1.0 - control_value(cd.fg_bg.control, cd.fg_bg.fade_steps, s) } else { 0.0 };
+ let base = if cd.fg_bg.control != Control::Off { 1.0 - dynamic_value(&cd.fg_bg, s) } else { 0.0 };
let t = (base + (1.0 - base) * cd.fg_bg.jitter.clamp(0.0, 1.0) * r(stream::FG_BG)).clamp(0.0, 1.0);
let rgb = [fg[0] + (bg[0] - fg[0]) * t, fg[1] + (bg[1] - fg[1]) * t, fg[2] + (bg[2] - fg[2]) * t];
let [mut h, mut sat, mut v] = rgb_to_hsv(rgb);
@@ -444,7 +454,7 @@ pub fn base_diameter(b: &BrushSettings, s: &StepInput) -> f32 {
let mut f = 1.0;
if sd.enabled && sd.size.control != Control::Off {
let min = sd.size.minimum.clamp(0.0, 1.0);
- f = min + (1.0 - min) * control_value(sd.size.control, sd.size.fade_steps, s);
+ f = min + (1.0 - min) * dynamic_value(&sd.size, s);
} else if b.pressure_size {
f = s.point.pressure.clamp(0.0, 1.0);
}
@@ -530,7 +540,7 @@ impl DabBuilder {
// Scatter.
let mut c = Point::new(s.point.x, s.point.y);
if sc.enabled && sc.scatter.jitter > 0.0 {
- let cv = control_value(sc.scatter.control, sc.scatter.fade_steps, s);
+ let cv = dynamic_value(&sc.scatter, s);
let amt = f64::from(sc.scatter.jitter * cv * radius);
let (ox, oy) = (rand_signed(seed, i, stream::SCATTER_X) as f64 * amt, rand_signed(seed, i, stream::SCATTER_Y) as f64 * amt);
if sc.both_axes {
diff --git a/crates/paint/src/lib.rs b/crates/paint/src/lib.rs
index 4dc07b660..2f65fc1a0 100644
--- a/crates/paint/src/lib.rs
+++ b/crates/paint/src/lib.rs
@@ -20,6 +20,7 @@ use serde::{Deserialize, Serialize};
pub mod bg_erase;
pub mod brush;
+pub mod curve;
pub mod dynamics;
pub mod mixer;
pub mod outline;
@@ -36,6 +37,7 @@ pub use brush::{
BrushPreset, BrushSettings, ColorDynamics, Control, DualBrush, Dynamic, MAX_BRUSH_SIZE, MAX_SCATTER, MaskMode, Pattern, PatternStyle, Pose, PresetCaptures,
Scattering, SectionLocks, ShapeDynamics, Smoothing, Texture, TipShape, Transfer,
};
+pub use curve::ResponseCurve;
pub use mixer::MixerSettings;
pub use render::{BrushContext, StrokeRenderer, UnionLive, grid_center, grid_square, render_stroke};
pub use tile::{GrayTile, StoredTile};
diff --git a/crates/ui-egui/src/brush_panel_tests.rs b/crates/ui-egui/src/brush_panel_tests.rs
index 750a9d550..cffbb5b53 100644
--- a/crates/ui-egui/src/brush_panel_tests.rs
+++ b/crates/ui-egui/src/brush_panel_tests.rs
@@ -24,7 +24,7 @@ fn sections_with_boxes_have_flags() {
/// What each section's controls edit, set to non-default values.
fn edit_section(i: usize, b: &mut BrushSettings) {
- let dynamic = |jitter: f32, control: Control, minimum: f32| paint::Dynamic { jitter, control, fade_steps: 40, minimum };
+ let dynamic = |jitter: f32, control: Control, minimum: f32| paint::Dynamic { jitter, control, fade_steps: 40, minimum, ..Default::default() };
match i {
0 => {
b.size = 87.0;
@@ -1268,6 +1268,27 @@ fn hand_tool_offers_scale_buttons_and_requests_the_right_view() {
assert!(!h.state().ui.views[0].fit_pending);
}
+#[test]
+fn a_dynamic_gets_its_own_response_curve() {
+ use egui_kittest::kittest::Queryable;
+ let mut h = harness(0, 1);
+ h.state_mut().run("tools.setBrush", json!({"shapeDynamics": {"enabled": true, "size": {"control": "penPressure"}}})).unwrap();
+ h.run_steps(3);
+ // Only Size has a control with an input to shape; its curve button shows the editor.
+ assert_eq!(h.query_all_by_label("Response curve").count(), 1);
+ h.get_by_label("Response curve").click();
+ h.run_steps(3);
+ h.get_by_label("Soft").click();
+ h.run_steps(3);
+ let (id, p) = last_journal(h.state()).unwrap();
+ assert_eq!(id, "tools.setBrush");
+ let curve: Vec<[f32; 2]> = serde_json::from_value(p["brush"]["shapeDynamics"]["size"]["curve"].clone()).unwrap();
+ assert_eq!(curve, vec![[0.0, 0.0], [0.3, 0.6], [1.0, 1.0]]);
+ let b = &h.state().session.tools.brush;
+ assert_eq!(b.shape_dynamics.size.curve.points(), curve);
+ assert!(b.shape_dynamics.roundness.curve.is_linear() && b.transfer.opacity.curve.is_linear());
+}
+
#[test]
fn brush_settings_hamburger_menu_actions() {
use egui_kittest::kittest::Queryable;
diff --git a/crates/ui-egui/src/brush_sections.rs b/crates/ui-egui/src/brush_sections.rs
index ff7ca5d29..e7d3a16f5 100644
--- a/crates/ui-egui/src/brush_sections.rs
+++ b/crates/ui-egui/src/brush_sections.rs
@@ -67,9 +67,23 @@ fn dim(ui: &mut egui::Ui, s: &str) {
ui.label(RichText::new(s).color(t.text_dim));
}
-/// `Control: [Off ▾] [25]`: the controller pop-up plus Fade's step count. `angle` offers the
+/// Whether a dynamic's control has a 0..1 input its own response curve shapes (not Off, not the
+/// direction controls, not Angle Jitter, whose controls set an angle).
+pub(crate) fn takes_curve(control: Control, angle: bool) -> bool {
+ !angle && matches!(control, Control::Fade | Control::PenPressure | Control::PenTilt | Control::StylusWheel | Control::Rotation)
+}
+
+/// egui memory key of the open/closed state of a dynamic's curve editor.
+pub(crate) fn curve_open_id(id: &str) -> egui::Id {
+ egui::Id::new(("brush-curve-open", id))
+}
+
+/// `Control: [Off ▾] [25] [~]`: the controller pop-up, Fade's step count and the button that
+/// shows this dynamic's own response curve (lit while the curve isn't linear). `angle` offers the
/// direction controls (Photoshop only has them for Angle Jitter).
fn control_row(ui: &mut egui::Ui, id: &str, d: &mut Dynamic, angle: bool) {
+ let open_id = curve_open_id(id);
+ let mut open: bool = ui.data(|m| m.get_temp(open_id)).unwrap_or(false);
ui.horizontal(|ui| {
dim(ui, tl!("Control:"));
let n = if angle || matches!(d.control, Control::InitialDirection | Control::Direction) { 8 } else { 6 };
@@ -80,7 +94,17 @@ fn control_row(ui: &mut egui::Ui, id: &str, d: &mut Dynamic, angle: bool) {
d.fade_steps = steps.round().clamp(1.0, 9999.0) as u32;
}
}
+ if takes_curve(d.control, angle) && crate::icons::button(ui, "spline", 22.0, open || !d.curve.is_linear(), tl!("Response curve")).clicked() {
+ open = !open;
+ }
});
+ if open && takes_curve(d.control, angle) {
+ let mut points = d.curve.points();
+ if crate::pressure_curve_ui::edit_points(ui, egui::Id::new(("brush-curve-rect", id)), &mut points) {
+ d.curve = paint::ResponseCurve::new(&points);
+ }
+ }
+ ui.data_mut(|m| m.insert_temp(open_id, open));
ui.add_space(2.0);
}
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index 5dd6aa7e9..fa4be01a7 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -3480,6 +3480,7 @@ cameraRaw Vibrance Živost
cameraRaw Whites Bílé
layerLabel No Color Žádná barva
Loading fonts… Načítání písem…
+ Response curve Křivka odezvy
Simulate Pressure Simulovat přítlak
Background Eraser Guma pozadí
Healing Brush Retušovací štětec
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index 4c9402c2d..2421904e2 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -2669,6 +2669,7 @@ cameraData Lens Objektiv
Search settings… Einstellungen durchsuchen…
No matching settings Keine passenden Einstellungen
Loading fonts… Schriften werden geladen…
+ Response curve Reaktionskurve
Tool Werkzeug
Simulate Pressure Druck simulieren
Stroke Path… Pfad nachziehen…
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index 98c9d5d58..01009641e 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -3725,6 +3725,7 @@ cameraData Lens Φακός
Search settings… Αναζήτηση ρυθμίσεων…
No matching settings Δεν βρέθηκαν ρυθμίσεις
Loading fonts… Φόρτωση γραμματοσειρών…
+ Response curve Καμπύλη απόκρισης
Simulate Pressure Προσομοίωση πίεσης
Stroke Path… Περίγραμμα διαδρομής…
Background Eraser Γόμα φόντου
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index c495cef81..d37295184 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -2710,6 +2710,7 @@ cameraData Lens Objetivo
Search settings… Buscar ajustes…
No matching settings No hay ajustes que coincidan
Loading fonts… Cargando fuentes…
+ Response curve Curva de respuesta
Tool Herramienta
Simulate Pressure Simular presión
Stroke Path… Contornear trazado…
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index 130a8fbef..547411e9a 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -3044,6 +3044,7 @@ cameraData Lens Objectif
Search settings… Rechercher des réglages…
No matching settings Aucun réglage correspondant
Loading fonts… Chargement des polices…
+ Response curve Courbe de réponse
Tool Outil
Simulate Pressure Simuler la pression
Stroke Path… Contourner le tracé…
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index a265dc229..d6d33ec2d 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -4010,6 +4010,7 @@ cameraRaw Yellow Sárga
Transform On Drop Átalakítás elengedéskor
Vanishing Point is not active Az Enyészpont nem aktív
Vanishing Point: click four corners to create a plane Enyészpont: sík létrehozásához kattintson a négy sarokra
+ Response curve Válaszgörbe
Show home recent files Legutóbbi fájlok megjelenítése a kezdőképernyőn
Clear Brush Controls Ecsetvezérlők törlése
Reset All Locked Settings Összes zárolt beállítás visszaállítása
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 381a0e374..b1652dd9e 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -3031,6 +3031,7 @@ cameraData Lens Lensa
Search settings… Cari pengaturan…
No matching settings Tidak ada pengaturan yang cocok
Loading fonts… Memuat font…
+ Response curve Kurva respons
Tool Alat
Simulate Pressure Simulasikan Tekanan
Stroke Path… Stroke Path…
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index 21fc6e5a4..e410c2af3 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -2699,6 +2699,7 @@ cameraData Lens Obiettivo
Search settings… Cerca impostazioni…
No matching settings Nessuna impostazione corrispondente
Loading fonts… Caricamento font…
+ Response curve Curva di risposta
Tool Strumento
Simulate Pressure Simula pressione
Stroke Path… Traccia tracciato…
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index 2152313c5..1d0865132 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -3640,6 +3640,7 @@ cameraData Lens レンズ
Search settings… 設定を検索…
No matching settings 一致する設定はありません
Loading fonts… フォントを読み込み中…
+ Response curve 応答カーブ
Simulate Pressure 筆圧をシミュレート
Stroke Path… パスのストローク…
Background Eraser 背景消しゴム
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index 9a5db74f5..e199608b9 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -3213,6 +3213,7 @@ cameraData Lens 렌즈
Search settings… 설정 검색…
No matching settings 일치하는 설정 없음
Loading fonts… 글꼴 불러오는 중…
+ Response curve 응답 곡선
Simulate Pressure 압력 시뮬레이션
Stroke Path… 패스 획…
Background Eraser 배경 지우개
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index 04ab080f4..9ac977446 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -3784,6 +3784,7 @@ cameraData Lens Lens
No matching settings Geen overeenkomende instellingen
PhotoCraft — Screen Color Picker PhotoCraft — Schermkleurkiezer
Loading fonts… Lettertypen laden…
+ Response curve Responscurve
Simulate Pressure Druk simuleren
Stroke Path… Pad omlijnen…
Background Eraser Achtergrondgum
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index d41b3abea..016e564eb 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -3642,6 +3642,7 @@ cameraData Lens Obiektyw
Search settings… Szukaj ustawień…
No matching settings Brak pasujących ustawień
Loading fonts… Wczytywanie czcionek…
+ Response curve Krzywa odpowiedzi
Simulate Pressure Symuluj nacisk
Stroke Path… Obrysuj ścieżkę…
Background Eraser Gumka tła
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 9d28ba1da..154fd3010 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -3048,6 +3048,7 @@ cameraData Lens Lente
Search settings… Pesquisar configurações…
No matching settings Nenhuma configuração encontrada
Loading fonts… Carregando fontes…
+ Response curve Curva de resposta
Tool Ferramenta
Simulate Pressure Simular pressão
Stroke Path… Traçar demarcador…
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 7608aa5e2..6466c415c 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -2968,6 +2968,7 @@ cameraData Lens Объектив
Search settings… Поиск настроек…
No matching settings Нет подходящих настроек
Loading fonts… Загрузка шрифтов…
+ Response curve Кривая отклика
Tool Инструмент
Simulate Pressure Имитировать нажим
Stroke Path… Обвести контур…
diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv
index 2c949ebdf..aa5923532 100644
--- a/crates/ui-egui/src/i18n/sr.tsv
+++ b/crates/ui-egui/src/i18n/sr.tsv
@@ -4217,6 +4217,7 @@ shape Appearance Izgled
Ink Characteristics Karakteristike mastila
Solidity: Punoća:
Redrawing Ponovno iscrtavanje
+ Response curve Kriva odziva
# Embedded Profile Mismatch: profile names beside the choices, Remember this choice
Use the embedded profile ({profile}) Koristi ugrađeni profil ({profile})
Convert to the working space ({profile}) Pretvori u radni prostor ({profile})
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index fdc5bc2cd..08be1125a 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -3821,6 +3821,7 @@ cameraData Lens Lens
@plural {n} step|{n} steps {n} adım
@plural {warning} (+{n} more brush preset warning)|{warning} (+{n} more brush preset warnings) {warning} (+{n} fırça ön ayarı uyarısı daha)
@plural {what} with {n} warning|{what} with {n} warnings {what}, {n} uyarı ile
+ Response curve Yanıt eğrisi
Show home recent files Ana ekranda son dosyaları göster
Clear Brush Controls Fırça Denetimlerini Temizle
Reset All Locked Settings Tüm Kilitli Ayarları Sıfırla
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index c60140e01..98e0c6ff4 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -3716,6 +3716,7 @@ cameraData Lens Об'єктив
No matching settings Немає відповідних налаштувань
PhotoCraft — Screen Color Picker PhotoCraft — Піпетка кольору екрана
Loading fonts… Завантаження шрифтів…
+ Response curve Крива відгуку
Simulate Pressure Імітувати натиск
Stroke Path… Обвести контур…
Background Eraser Фонова гумка
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index bab1dd3c4..3857c4431 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -3584,6 +3584,7 @@ curves Smooth Làm mượt
Stroke Path… Đi nét đường dẫn…
Apply mask to layer before removing? Áp dụng mặt nạ vào lớp trước khi xóa?
Delete the vector mask? Xóa mặt nạ vectơ?
+ Response curve Đường cong phản hồi
Object Finder Trình tìm đối tượng
No object found there — drag a rectangle around it Không tìm thấy đối tượng ở đó — hãy kéo một hình chữ nhật quanh nó
Remove after each stroke Xóa sau mỗi nét vẽ
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index aa81d4fa9..ad3f2204d 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -2640,6 +2640,7 @@ cameraData Lens 镜头
Search settings… 搜索设置…
No matching settings 没有匹配的设置
Loading fonts… 正在加载字体…
+ Response curve 响应曲线
Tool 工具
Simulate Pressure 模拟压力
Stroke Path… 描边路径…
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index e1db19320..9330c7426 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -2610,6 +2610,7 @@ cameraData Lens 鏡頭
Search settings… 搜尋設定…
No matching settings 沒有符合的設定
Loading fonts… 正在載入字體…
+ Response curve 回應曲線
Tool 工具
Simulate Pressure 模擬壓力
Stroke Path… 筆畫路徑…
diff --git a/crates/ui-egui/src/pressure_curve_ui.rs b/crates/ui-egui/src/pressure_curve_ui.rs
index cb9880733..0c8c5b7c4 100644
--- a/crates/ui-egui/src/pressure_curve_ui.rs
+++ b/crates/ui-egui/src/pressure_curve_ui.rs
@@ -1,5 +1,6 @@
//! Preferences › Tools › Pressure Curve: the pen's pressure response, edited as points on a curve
//! (`tools.pressureCurve`, read by the stylus through `photocraft_engine::prefs::PressureCurve`).
+//! Brush Settings uses the same editor for each dynamic's own curve ([`edit_points`]).
//! Drag a point to move it, click empty space to add one, right-click a point to remove it.
use egui::{Pos2, Sense, Stroke, Vec2, pos2};
@@ -46,17 +47,25 @@ fn round2(x: f32) -> f64 {
/// The editor. Returns the new value when the curve changed.
pub(crate) fn editor(ui: &mut egui::Ui, value: &Value) -> Option<Value> {
- let t = Tokens::get(ui.ctx());
let mut points = points_of(value);
+ let changed = edit_points(ui, egui::Id::new(RECT_KEY), &mut points);
+ changed.then(|| value_of(&points))
+}
+
+/// The editor over a list of points (fewer than two reads as linear). `rect_key` is the egui
+/// memory key the editing square's rectangle is stored under, for tests and automation. Returns
+/// whether the points changed; they are rounded to two decimals then.
+pub(crate) fn edit_points(ui: &mut egui::Ui, rect_key: egui::Id, points: &mut Vec<[f32; 2]>) -> bool {
+ let t = Tokens::get(ui.ctx());
if points.len() < 2 {
- points = vec![[0.0, 0.0], [1.0, 1.0]];
+ *points = vec![[0.0, 0.0], [1.0, 1.0]];
}
let mut changed = false;
// The square with the presets beside it, so the control fits the preferences page's height.
ui.horizontal_top(|ui| {
let (rect, resp) = ui.allocate_exact_size(Vec2::splat(SIZE), Sense::click_and_drag());
// Where the square is this frame (tests and automation point at curve coordinates).
- ui.data_mut(|d| d.insert_temp(egui::Id::new(RECT_KEY), rect));
+ ui.data_mut(|d| d.insert_temp(rect_key, rect));
let to_screen = |p: [f32; 2]| pos2(rect.left() + p[0] * rect.width(), rect.bottom() - p[1] * rect.height());
let to_curve = |s: Pos2| [((s.x - rect.left()) / rect.width()).clamp(0.0, 1.0), ((rect.bottom() - s.y) / rect.height()).clamp(0.0, 1.0)];
let painter = ui.painter_at(rect.expand(4.0));
@@ -80,7 +89,7 @@ pub(crate) fn editor(ui: &mut egui::Ui, value: &Value) -> Option<Value> {
if resp.drag_started()
&& let Some(at) = ui.input(|i| i.pointer.press_origin()).or(resp.interact_pointer_pos())
{
- let grabbed = nearest(at, &points);
+ let grabbed = nearest(at, points);
ui.data_mut(|d| d.insert_temp(drag_id, grabbed));
}
let dragging: Option<usize> = ui.data(|d| d.get_temp(drag_id)).flatten();
@@ -95,7 +104,7 @@ pub(crate) fn editor(ui: &mut egui::Ui, value: &Value) -> Option<Value> {
}
if resp.clicked()
&& let Some(at) = resp.interact_pointer_pos()
- && nearest(at, &points).is_none()
+ && nearest(at, points).is_none()
&& points.len() < PressureCurve::MAX_POINTS
{
points.push(to_curve(at));
@@ -103,14 +112,14 @@ pub(crate) fn editor(ui: &mut egui::Ui, value: &Value) -> Option<Value> {
}
if resp.secondary_clicked()
&& let Some(at) = resp.interact_pointer_pos()
- && let Some(i) = nearest(at, &points)
+ && let Some(i) = nearest(at, points)
&& points.len() > 2
{
points.remove(i);
changed = true;
}
- let curve = PressureCurve::new(&points);
+ let curve = PressureCurve::new(points);
let line: Vec<Pos2> = (0..=64).map(|i| i as f32 / 64.0).map(|x| to_screen([x, curve.eval(x)])).collect();
painter.add(egui::Shape::line(line, Stroke::new(2.0, t.accent)));
for (i, p) in points.iter().enumerate() {
@@ -122,13 +131,19 @@ pub(crate) fn editor(ui: &mut egui::Ui, value: &Value) -> Option<Value> {
ui.vertical(|ui| {
for (name, preset) in PRESETS {
if ui.small_button(tl!(name)).clicked() {
- points = preset.to_vec();
+ *points = preset.to_vec();
changed = true;
}
}
});
});
- changed.then(|| value_of(&points))
+ if changed {
+ // Two decimals: the stored value stays readable and a drag doesn't write float noise.
+ for p in points.iter_mut() {
+ *p = [round2(p[0]) as f32, round2(p[1]) as f32];
+ }
+ }
+ changed
}
#[cfg(test)]
diff --git a/docs/scorecard.md b/docs/scorecard.md
index 25004ce49..d8d580267 100644
--- a/docs/scorecard.md
+++ b/docs/scorecard.md
@@ -8,7 +8,7 @@ Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.js
|---|---:|---:|---:|---|
| [Performance](#performance) | 3 | 22 | 22 | 56 scenarios: 3 within budget, 22 over budget or failing, 9 tracked only, 17 not run, 5 not measurable yet (baseline 2026-10-05) |
| [File compatibility](#file-compatibility) | 7 | 13 | 7 | io corpus: oracle ≥ 146/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 241/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 149/256, round trip ≥ 258/256 |
-| [Tools](#tools) | 30 | 13 | 0 | |
+| [Tools](#tools) | 31 | 12 | 0 | |
| [Workspace and UI](#workspace-and-ui) | 13 | 6 | 4 | settings that do nothing: 26 of 160 (target 0) |
| [Type](#type) | 4 | 3 | 2 | |
| [Automation](#automation) | 5 | 2 | 4 | 631 of 631 menu items live (100.0%) |
@@ -140,7 +140,7 @@ Corpus floors (`crates/io/tests/corpus.rs`): the enforced minimums; the corpus t
| TOOL-213-8 | Clone Source: W/H link, drawn overlay (opacity/blend/clip/auto-hide), Alt target cursor | partial | [#213](https://github.com/storytold/photocraft/issues/213) | Clone Source overlay drawn with opacity, inversion, circular clipping, auto-hide and the Normal/Darken/Lighten/Difference blend against the image under the brush (canvas.rs draw_clone_preview, clone_source::overlay_blend); a shaped tip (sampled bitmap, rotation, roundness) clips the overlay to its outline (brush_cursor::tip_mask, #4372); W/H link (cloneSource.set linked, panel chain button, #3298) |
| TOOL-213-9 | Eyedropper comparison ring (new colour above, current below) while sampling | done | [#213](https://github.com/storytold/photocraft/issues/213) | eyedropper_ring (canvas.rs): the sampled colour on the upper arc, the foreground below, drawn for the Eyedropper and Alt-sampling while the button is held; the Precise-cursor preference keeps the crosshair |
| TOOL-213-10 | Ctrl+Alt drag resizes brush size/hardness with an on-canvas readout | done | [#213](https://github.com/storytold/photocraft/issues/213) | brush_resize.rs (#297, #370): Alt+right-drag, or Control+Option-drag on macOS (Control+Alt everywhere), sets diameter horizontally and hardness vertically, circle plus Diameter/Hardness readout, one coalesced tools.setBrush, no paint or history; 9 tests there |
-| TOOL-213-11 | Editable pressure curve, global and per control | partial | [#213](https://github.com/storytold/photocraft/issues/213) | Global: Preferences › Tools › Pressure Curve (prefs tools.pressureCurve; monotone cubic, engine prefs::PressureCurve; applied to every pen sample in ui-egui stylus.rs before any brush; editor pressure_curve_ui.rs with Linear/Soft/Hard presets). Missing: per-control curves (each brush dynamic's own response to pressure, tilt, rotation) |
+| TOOL-213-11 | Editable pressure curve, global and per control | done | [#213](https://github.com/storytold/photocraft/issues/213) | Global: Preferences › Tools › Pressure Curve (prefs tools.pressureCurve; applied to every pen sample in ui-egui stylus.rs before any brush; editor pressure_curve_ui.rs with Linear/Soft/Hard presets). Per control: every brush Dynamic has its own curve (paint ResponseCurve, the same monotone cubic; Dynamic.curve, set by tools.setBrush, e.g. shapeDynamics.size.curve) applied to its Fade/Pressure/Tilt/Wheel/Rotation input in dynamics.rs dynamic_value; Brush Settings shows it behind each Control row's curve button (#3294) |
| TOOL-213-12 | Import an image file as a brush tip | done | [#213](https://github.com/storytold/photocraft/issues/213) | brush.presets.importImage (path or data); Brushes panel and preset picker Import Brushes… take .abr or an image (#3279) |
| TOOL-213-13 | Brush regression tests: no seams, hard edge, zero-scatter defaults, ABR never black | done | [#213](https://github.com/storytold/photocraft/issues/213) | Seam, hard-edge and zero-scatter tests in brush_tests.rs; ABR tip colour test in abr_map/tests.rs |
| TOOL-213-14 | Tablet: no OS arrow cursor over the canvas on macOS, Windows and Linux | partial | [#213](https://github.com/storytold/photocraft/issues/213) | Brush tools set CursorIcon::None (canvas.rs:1259-1275); not verified per OS |
diff --git a/scorecard/tools.toml b/scorecard/tools.toml
index 36deb272e..6c3f84974 100644
--- a/scorecard/tools.toml
+++ b/scorecard/tools.toml
@@ -78,9 +78,9 @@ note = "brush_resize.rs (#297, #370): Alt+right-drag, or Control+Option-drag on
[[item]]
id = "TOOL-213-11"
target = "Editable pressure curve, global and per control"
-status = "partial"
+status = "done"
issue = 213
-note = "Global: Preferences › Tools › Pressure Curve (prefs tools.pressureCurve; monotone cubic, engine prefs::PressureCurve; applied to every pen sample in ui-egui stylus.rs before any brush; editor pressure_curve_ui.rs with Linear/Soft/Hard presets). Missing: per-control curves (each brush dynamic's own response to pressure, tilt, rotation)"
+note = "Global: Preferences › Tools › Pressure Curve (prefs tools.pressureCurve; applied to every pen sample in ui-egui stylus.rs before any brush; editor pressure_curve_ui.rs with Linear/Soft/Hard presets). Per control: every brush Dynamic has its own curve (paint ResponseCurve, the same monotone cubic; Dynamic.curve, set by tools.setBrush, e.g. shapeDynamics.size.curve) applied to its Fade/Pressure/Tilt/Wheel/Rotation input in dynamics.rs dynamic_value; Brush Settings shows it behind each Control row's curve button (#3294)"
[[item]]
id = "TOOL-213-12"