Point at something grey and let the pipeline work out the rest
FR-DEV-3 has asked for "white balance (temperature/tint, and picker)" since it was written, and only the first half existed. `WidgetKind::WhitePoint` was in the vocabulary and `develop::supported` answered false for it, so the node degraded to two sliders — correct behaviour that had quietly become the only behaviour. Sampling a neutral is the first move of the global tonal pass and every colour judgement afterwards is measured against where the grey was put, so guessing at two sliders until a wall stops looking green is the wrong way round. The awkward part is that a picker genuinely needs to know how far a hundred units of temperature move red against blue, and that number is declared in the node's own file. So the inversion lives in `dr_pipeline::neutral` rather than in the interface: the canvas hands over a colour, the core finds the operation that asked to be driven by a pixel and bisects its declared response until the sample comes back grey. Nothing in `ui/` names white balance, and nothing holds a second copy of a response that would be wrong the first time somebody adjusted the range. A bisection rather than a closed-form inverse because only monotonicity is part of the bargain — the expression is free to become a table tomorrow. The result is rounded to the precision the control is drawn at, which is not cosmetic: unrounded, sampling something already neutral lands a ten-thousandth off zero, and the photograph comes back modified with an undo step for a correction of nothing. On the panel side this needed one distinction the generated path was missing. `is_on_canvas` was being read as "and so the panel draws nothing for it", which is right for a crop — four edge fractions are not controls anyone drags in a list — and wrong for an eyedropper, which *writes* temperature and tint and leaves them exactly the controls a photographer reaches for next. So a sampling widget keeps its sliders and puts the affordance that arms the canvas in the group's heading, built like the reset beside it. One click, one sample, one history step: `Edit::Action` never coalesces, and there is no hover preview to fill the stack with temperatures nobody chose. Declaring the presentation also groups temperature and tint under one undo step, where they were two. That follows from what `Presentation` means and reads correctly — white balance is one decision — but it is a change, and worth saying so.
This commit is contained in:
@@ -237,6 +237,30 @@ export component AppWindow inherits Window {
|
||||
/// the two cannot get out of step and strand the view on the original.
|
||||
callback compare-original(bool);
|
||||
|
||||
// --- sampling a neutral off the photograph (FR-DEV-3) ---
|
||||
|
||||
/// TRACES: FR-DEV-3
|
||||
/// Which operation's on-canvas sampler is armed, or -1 for none.
|
||||
///
|
||||
/// Held here rather than in Rust, unlike the view mode beside it, and the
|
||||
/// difference is real: entering a mode has side effects on the session and
|
||||
/// this has none. Arming changes what the next click on the photograph
|
||||
/// means and nothing else — no parameter moves, no history step is taken,
|
||||
/// and the session has nothing to hear about until a point is picked. It
|
||||
/// is one-shot: the click that samples disarms it.
|
||||
///
|
||||
/// An index rather than a bool because arming belongs to a *group*. Two
|
||||
/// operations could offer a sampler and only one of them can be waiting.
|
||||
in-out property <int> sampling-op: -1;
|
||||
/// Shorthand for the condition the canvas tests, written once.
|
||||
property <bool> sampling: root.sampling-op >= 0;
|
||||
/// A neutral was picked, in fractions of the visible image.
|
||||
///
|
||||
/// The operation is not passed: which one a sampled colour belongs to is
|
||||
/// settled by what the chain declared, and this file has no business
|
||||
/// knowing. See `dr_pipeline::neutral`.
|
||||
callback neutral-picked(float, float);
|
||||
|
||||
/// Every step, newest first. Rust owns the order and stamps each row with
|
||||
/// its own position in the stack, so nothing here does arithmetic to turn
|
||||
/// a row back into a step.
|
||||
@@ -2050,6 +2074,43 @@ in property <bool> panel-visible: true;
|
||||
}
|
||||
}
|
||||
|
||||
// TRACES: FR-DEV-3 | FR-UI-7
|
||||
// Sampling a neutral, beside the repair placer above and
|
||||
// built exactly like it: a click on the fitted image, over
|
||||
// the pan area so the click reaches it first, and a
|
||||
// separate handler rather than a branch inside the pan —
|
||||
// panning wants press-drag-release and this wants a click,
|
||||
// and interleaving the two is how a drag ends up sampling
|
||||
// whatever it happened to travel over.
|
||||
//
|
||||
// **One click, one sample, one history step.** There is no
|
||||
// hover preview: previewing would mean a render and a
|
||||
// solve per pixel the pointer crossed, and if any of them
|
||||
// were recorded the stack would fill with a hundred
|
||||
// temperatures nobody chose. The arming state is what says
|
||||
// the next click will do something instead.
|
||||
if root.sampling && root.total > 0 && root.load-error == "": TouchArea {
|
||||
x: parent.shown-x;
|
||||
y: parent.shown-y;
|
||||
width: parent.shown-w;
|
||||
height: parent.shown-h;
|
||||
mouse-cursor: MouseCursor.crosshair;
|
||||
enabled: !root.cropping;
|
||||
|
||||
clicked => {
|
||||
root.neutral-picked(
|
||||
self.mouse-x / max(self.width, 1px),
|
||||
self.mouse-y / max(self.height, 1px),
|
||||
);
|
||||
// One shot. Leaving it armed would make the next
|
||||
// click on the photograph — to place a mask, to
|
||||
// pan — a second sample, and the photographer
|
||||
// would have to remember to put a tool away that
|
||||
// has already done its job.
|
||||
root.sampling-op = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if root.total > 0 && root.load-error == "": TouchArea {
|
||||
x: 0; y: 0;
|
||||
width: 100%;
|
||||
@@ -2831,6 +2892,17 @@ in property <bool> panel-visible: true;
|
||||
// kept in step with it.
|
||||
op-reset(op) => { root.curve-reset(op); }
|
||||
reset-all => { root.reset-all(); }
|
||||
// TRACES: FR-DEV-3
|
||||
// Arming is a toggle and it is resolved here,
|
||||
// not in Rust: it changes what a click on the
|
||||
// photograph does and nothing about the edit,
|
||||
// so there is nothing for the session to hear
|
||||
// about until a point is actually picked.
|
||||
sampling-op: root.sampling-op;
|
||||
sampler-armed(op) => {
|
||||
root.sampling-op =
|
||||
root.sampling-op == op ? -1 : op;
|
||||
}
|
||||
// TRACES: FR-DEV-3f
|
||||
film-stocks: root.film-stocks;
|
||||
film-selected: root.film-selected;
|
||||
|
||||
Reference in New Issue
Block a user