Isolate scalar tone parameters and normalize recorded gray aliases

This commit is contained in:
Vlad Grankovsky committed 2026-10-23 20:23:13 +02:00
1 parent 7b89bc637a
commit 36944dfbaa
7 files changed
+176 -8

No files matched your search

+1 -1
View File
@@ -79,7 +79,7 @@ The transport is `apps/photocraft/src/control_server.rs`, and the handlers are i
- Magnetic Lasso (`tool: "magneticLasso"`): a `down`/`up` pair is a click. The first sets the first fastening point (its modifiers set the selection mode); later clicks fasten a point, or close the border on the first point. `move` events trace the border with or without a button held, fastening points by themselves; with `alt: true` a click draws a straight segment and a drag a freehand one. `ui.inspect` shows the border in progress under `magnetic` (`path`, `anchors`, `live`, `mode`). `ui.key` Enter closes it along the edges, Backspace removes the last fastening point, Escape cancels. To select along edges in one call instead, use the `select.magneticLasso` command with rough points around the shape.
- Image › Adjustments › Curves on top, no eyedropper armed (#7325): a `down` with `command: true` adds a point on the curve the dialog shows (its Channel popup), at the pixel's tone (RGB: Rec. 709 luma; Gray: the mean) and at the curve's current output there, so the preview does not change; with `shift: true` as well, one point on each of Red, Green and Blue at that channel's value. It samples the merged image like the eyedroppers, never moves an existing point (a point already within 2 levels is selected instead, a 16-point curve takes no more), and the tool is not driven. Nothing is added with a pencil-drawn curve, in Lab or CMYK, or with a mask, saved channel or Quick Mask targeted.
- Levels or Curves adjustment layer, Properties eyedropper armed (`layerPicker` in `ui.inspect`: `{layer, point, tool}`, set by the panel's Set Black/Neutral Gray/White Point buttons): a `down` sets that point from the image below the layer as one `layer.setAdjustment {"layer", "eyedropper": {"point", "at": [x, y], "size"}}` (send that command directly to skip the UI) and the tool is not driven; Esc, another tool or another layer disarms it.
- Image › Adjustments › Levels/Curves on a raster mask, saved alpha/spot channel or Quick Mask uses grayscale controls in every document colour mode. Both dialogs list only the isolated target by its actual name (custom alpha/spot and mask names stay literal), with the matching channel controls and histogram; Levels Auto uses that histogram too. Black/White Point samples that plane's own values, including unstored defaults, with the Eyedropper's Sample Size clipped at the canvas edge; Neutral Gray is unavailable. Direct commands accept `{"target":"mask"|"quickMask"|{"channel":index}, "eyedropper":{"point":"black|white","at":[x,y],"size":1|3|5|11|31|51|101}}`. Sampling updates dialog parameters until OK; Cancel keeps the pixels. An Action step's explicit target takes precedence over the currently selected channel when choosing its dialog defaults, Levels/Curves channel name, histogram and preview. Reset, pencil editing and sampling retain that explicit target. Adjustment-layer Properties keep sampling the colour image below the layer. Reopening an existing whole-image Smart Filter keeps its recorded colour controls regardless of the current channel or mask target.
- Image › Adjustments › Levels/Curves on a raster mask, saved alpha/spot channel or Quick Mask uses grayscale controls in every document colour mode. Both dialogs list only the isolated target by its actual name (custom alpha/spot and mask names stay literal), with the matching channel controls and histogram; Levels Auto uses that histogram too. Black/White Point samples that plane's own values, including unstored defaults, with the Eyedropper's Sample Size clipped at the canvas edge; Neutral Gray is unavailable. Direct commands accept `{"target":"mask"|"quickMask"|{"channel":index}, "eyedropper":{"point":"black|white","at":[x,y],"size":1|3|5|11|31|51|101}}`. Sampling updates dialog parameters until OK; Cancel keeps the pixels. An Action step's explicit target takes precedence over the currently selected channel when choosing its dialog defaults, Levels/Curves channel name, histogram and preview. Reset, pencil editing and sampling retain that explicit target. Scalar targets discard RGB/CMYK/Lab component records from recorded parameters, and a recorded `gray` alias seeds the visible composite controls so subsequent edits remain effective. Adjustment-layer Properties keep sampling the colour image below the layer. Reopening an existing whole-image Smart Filter keeps its recorded colour controls regardless of the current channel or mask target.
- `ui.click {x, y, button?, count?}` / `ui.move {x, y}`: synthetic pointer input in screen points (`button`: `left` (default), `right` (or `secondary`) or `middle`). `count` (default 1, `2` for a double-click) is at most 256; a larger one is an error and queues nothing
- `ui.key {key, command?, shift?, alt?, ctrl?}` (flags may also be grouped under `modifiers`): press and release a key, e.g. `{"key": "ArrowLeft", "shift": true}`. `{"key": "AltLeft"}` is a tap on Alt, which puts the keyboard on the in-window menu bar (then `ArrowRight`, `ArrowDown`, `Enter`, `Escape` or a menu's letter drive it); `{"key": "F", "alt": true}` opens the menu with that mnemonic (#4988)
- `ui.pointer`, `ui.click`, `ui.move`, `ui.key` and `ui.screenshot` validate every parameter before acting, as `ui.set` does: an unknown field (top-level, under `modifiers` or in an event), a value of the wrong JSON type (`"x": "abc"`, `"ctrl": "yes"`), a `button`, `kind`, `tool` or `key` outside the accepted set, or a number outside its range (`pressure`, tilt, `rotation`, `count`) is an error naming the parameter, and nothing is queued or applied. A `null` field counts as omitted and takes its default
+9 -1
View File
@@ -27,7 +27,15 @@ Ctrl/Cmd-click point insertion now uses the shared context-preservation helper,
A further review found that reopening a whole-image Levels/Curves Smart Filter could inherit the current channel's isolation, or a Layers-panel mask target and grayscale defaults. Reopening now resolves the captured Smart Filter before seeding its colour controls. A new regression covers RGB/Lab/CMYK, both tone dialogs, and five current targets (alpha, Channels-panel mask, individual component, Layers-panel mask and Quick Mask): 30 reopening/preview/commit cases preserving recorded non-neutral curves, masks and saved channels. Action private-field sanitization also checks that a recorded step cannot forge the Smart Filter marker.
Final current-head validation: full engine/UI `cargo test` **6,221 passed, 0 failed, 36 normally ignored**; the ignored full-registry adversarial command test passed separately. Strict engine/UI all-target Clippy, formatting, layering and wasm passed. Offscreen Smart Filter captures are retained with the review logs. The last general quick-perf attempt (2026-10-22) stopped at an upstream `layout_bench` fixture that converts already imported Smart Objects a second time; four earlier suites passed and the layout benchmark's `--direct` path completed. This dialog-setup follow-up does not change the historical CPU benchmark workload below.
Validation of `7b89bc637`: full engine/UI `cargo test` **6,221 passed, 0 failed, 36 normally ignored**; the ignored full-registry adversarial command test passed separately. Strict engine/UI all-target Clippy, formatting, layering and wasm passed. Offscreen Smart Filter captures are retained with the review logs. The last general quick-perf attempt (2026-10-22) stopped at an upstream `layout_bench` fixture that converts already imported Smart Objects a second time; four earlier suites passed and the layout benchmark's `--direct` path completed. This dialog-setup follow-up does not change the historical CPU benchmark workload below.
## Further parameter review (2026-10-23)
CodeRabbit's next review identified retained non-neutral RGB channel records in scalar parameters. The shared gray-target filter now drops RGB as well as CMYK/Lab component records. A regression first failed on the previous implementation, then passed across 432 cases: RGB/Gray/Lab/CMYK, U8/U16/F32, masks/alpha/spot/Quick Mask, Levels/point Curves/pencil Curves, direct/sampled edits and implicit/explicit targets. Whole target surfaces match an independent clean-parameter command; colour pixels, other planes and spot metadata remain unchanged. Action tests now carry non-neutral RGB records and check neutral hidden controls for scalar targets and preserved records for pixel targets.
A further local review reproduced a recorded `gray` alias seeding bug: Levels could display Gamma 1 for recorded Gamma 2 and let the hidden alias override later edits, while default Curves points could conceal the recorded curve. Scalar dialogs now resolve valid aliases through the checked parser/serializer before merging defaults. Invalid aliases remain preview/commit errors and leave document data unchanged. Offscreen Lab alpha Action captures show the recorded Gamma 2 and inverted curve under `Saved sky` while Lightness is selected.
Validation of this follow-up: full engine/UI `cargo test` **6,224 passed, 0 failed, 36 normally ignored**; the ignored adversarial command test passed separately. Strict engine/UI all-target Clippy, formatting, layering and wasm passed. A third local review found no further actionable issues in scope. No proxy or pixel-processing algorithm changed; no fresh timing comparison is claimed for parameter filtering and dialog initialization.
## 24 MP release comparison