LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge main into the masking branch (output space / deep finish, presets, parity)
Brandon Thomas4075b42d8521
diff --cc crates/gpu/src/render.rsindex 492cb38c7,776acc325..ff983a0b7--- a/crates/gpu/src/render.rs+++ b/crates/gpu/src/render.rs@@@ -475,13 -495,8 +510,13 @@@ pub fn renderlap("masks", &mut t, &mut cx);// 5. per-pixel stage- let fp = FinishParams::new(s, &plan.frame, info, w, h, plan.px_per_long, prep.air);+ let fp = FinishParams::new(s, &plan.frame, info, w, h, plan.px_per_long, prep.air, req.space);- let present = Present { clarity: prep.clarity.is_some(), texture: prep.texture.is_some(), dark: prep.dark.is_some() };+ let present = Present {+ clarity: prep.clarity.is_some(),+ texture: prep.texture.is_some(),+ dark: prep.dark.is_some(),+ chroma: masks.is_some() && prep.chroma.is_some(),+ };let (p, aux) = finish_block(&fp, &terms, &present);let aux = gpu.upload(&aux);let out = gpu.buffer(n);@@@ -515,17 -522,8 +550,17 @@@let histogram = Histogram::of_srgb8(&image);lap("histogram", &mut t, &mut cx);let mut image = image;- lightcraft_pipeline::visualize::apply(&mut image, req.overlay, &plan);+ let overlay_mask = overlay_mask.map(|r| match r {+ Ok(b) => cx.read_plane(&b, w, h),+ // a hidden mask: evaluate it on the CPU+ Err(m) => {+ let img = host.lin.get_or_insert_with(|| Arc::new(cx.read_rgb(&lin, w, h))).clone();+ let l = host.log_l.get_or_insert_with(|| Arc::new(cx.read_plane(&prep.log_l, w, h))).clone();+ lightcraft_pipeline::masks::evaluate_one(m, &plan.frame, w, h, &img, &l, s.light.exposure as f32)+ }+ });+ lightcraft_pipeline::visualize::apply(&mut image, req.overlay, &plan, overlay_mask.as_ref());- Some(Rendered { image, histogram })+ Some(Rendered { image, histogram, deep: None })}/// The white-balanced, retouched, denoised image.diff --cc crates/pipeline/src/lib.rsindex 20fcbb86b,fe0705dd0..7ffd65f12--- a/crates/pipeline/src/lib.rs+++ b/crates/pipeline/src/lib.rs@@@ -37,7 -38,8 +38,8 @@@ pub mod transformpub mod upright;pub mod visualize;+ pub use output::{DeepImage, DeepSamples, OutputDepth, OutputSpace, OutputTrc};-pub use visualize::Overlay;+pub use visualize::{MaskView, Overlay};use lightcraft_develop::{DevelopSettings, Treatment};use std::any::Any;@@@ -351,22 -398,10 +400,22 @@@ fn render_impl(src: Src<'_>, info: &Soulet histogram = Histogram::of_srgb8(&image);lap("histogram", &mut t);let mut image = image;- visualize::apply(&mut image, req.overlay, &plan);+ let mask = overlay_alpha(req.overlay, &plan, &prep);+ visualize::apply(&mut image, req.overlay, &plan, mask.as_ref());- Rendered { image, histogram }+ Rendered { image, histogram, deep: None }}+/// The alpha plane a mask overlay shows: the one the render evaluated, or (for a hidden mask) a+/// fresh evaluation.+fn overlay_alpha(o: Overlay, plan: &Plan<'_>, prep: &Prepared) -> Option<Plane> {+ let m = o.mask(&plan.settings)?;+ if let Some(e) = prep.masks.iter().find(|e| e.id == m.id) {+ return Some(e.alpha.clone());+ }+ let ev = plan.settings.light.exposure as f32;+ Some(masks::evaluate_one(m, &plan.frame, plan.w, plan.h, &prep.img, &prep.log_l, ev))+}+/// Convenience: render a before/after pair side by side is up to the UI; this renders "before"/// (default look, keeping the crop so framing matches).pub fn before_settings(s: &DevelopSettings) -> DevelopSettings {diff --cc docs/parity.mdindex 9d2fb8805,f3473fbb4..291cd8fd8--- a/docs/parity.md+++ b/docs/parity.md@@@ -27,12 -27,12 +27,12 @@@ and prints the summary; `cargo xtask pa| D. Search & filter (FILT) | 7 | 2 | 4 | 0 | 4/4 (100%) | 3/4 (75%) || E. Metadata (META) | 2 | 2 | 2 | 0 | 2/2 (100%) | 0/2 (0%) || F. Edit panel — global adjustments (EDIT) | 36 | 2 | 10 | 1 | 28/28 (100%) | 8/14 (57%) |- | G. Profiles (PROF) | 3 | 1 | 6 | 0 | 2/3 (67%) | 1/3 (33%) |+ | G. Profiles (PROF) | 6 | 0 | 4 | 0 | 3/3 (100%) | 2/3 (67%) || H. Crop & rotate (CROP) | 7 | 2 | 0 | 1 | 6/6 (100%) | 1/3 (33%) |-| I. Remove / healing (REM) | 3 | 3 | 4 | 2 | 2/4 (50%) | 1/3 (33%) |+| I. Remove / healing (REM) | 5 | 1 | 4 | 2 | 4/4 (100%) | 1/3 (33%) || J. Red eye (EYE) | 0 | 0 | 2 | 0 | — | 0/1 (0%) |-| K. Masking (MASK) | 6 | 10 | 7 | 0 | 4/8 (50%) | 2/5 (40%) |+| K. Masking (MASK) | 10 | 6 | 7 | 0 | 7/8 (88%) | 3/5 (60%) |- | L. Presets (PRE) | 1 | 4 | 2 | 1 | 0/2 (0%) | 1/2 (50%) |+ | L. Presets (PRE) | 3 | 2 | 2 | 1 | 2/2 (100%) | 1/2 (50%) || M. Versions & history (VER) | 3 | 1 | 1 | 0 | 1/1 (100%) | 2/3 (67%) || N. Copy / paste / sync (SYNC) | 4 | 0 | 1 | 0 | 3/3 (100%) | 1/1 (100%) || O. Merge (MERGE) | 3 | 0 | 1 | 0 | — | — |@@@ -44,36 -44,33 +44,27 @@@| U. Map & location (MAP) | 0 | 1 | 1 | 0 | — | 0/1 (0%) || V. Preferences (PREF) | 0 | 3 | 5 | 3 | 0/1 (0%) | 0/4 (0%) || W. Cloud & AI infrastructure (CLOUD / AI) | 0 | 1 | 1 | 2 | — | — |- | X. Cross-cutting behaviours (BEHAV) | 10 | 2 | 5 | 1 | 7/8 (88%) | 3/5 (60%) |+ | X. Cross-cutting behaviours (BEHAV) | 10 | 3 | 4 | 1 | 7/8 (88%) | 3/5 (60%) || Y. Menus | 46 | 18 | 21 | 8 | 37/47 (79%) | 7/23 (30%) |--| Z. Keyboard shortcuts (desktop) | 46 | 16 | 18 | 1 | 39/52 (75%) | 7/23 (30%) |++| Z. Keyboard shortcuts (desktop) | 50 | 14 | 16 | 1 | 43/52 (83%) | 7/23 (30%) || Lightroom Classic extras | 4 | 19 | 56 | 9 | — | 3/21 (14%) |- | **Total** | 214 | 97 | 189 | 37 | 157/198 (79%) | 49/144 (34%) |-| **Total** | 215 | 101 | 184 | 37 | 156/198 (79%) | 50/144 (35%) |++| **Total** | 225 | 93 | 182 | 37 | 165/198 (83%) | 51/144 (35%) |<!-- /parity:summary -->## Top gapsOrdered by tier, then user value, then (low) effort. Take the first one nobody is working on.- 1. **LR-EXP-COLORSPACE** (P0) — export is sRGB only. Add Display P3 / Adobe RGB-compatible / ProPhoto-compatible /- Rec.2020 output (our own primaries + ICC from `crates/codecs/src/icc.rs`). High value, low–medium effort.- 5. **LR-VIEW-PHOTOGRID** (P0) — group the justified grid by capture date with headers. Low–medium effort.- 6. **LR-PRE-CREATE + LR-PRE-PANEL + LR-BEHAV-PREVIEW-HOVER** (P0/P1) — per-group checkboxes in Create Preset;- live preview while hovering presets/profiles/versions. Medium effort.- 7. **LR-PROF-DROPDOWN** (P0) — favourites/recent in the profile menu (and later a browser, LR-PROF-BROWSER).- 8. **LR-LIB-KEYWORD** (P0) — rename/delete a keyword library-wide; keyword list in the left panel for browsing.- 9. **LR-PREF-GENERAL + LR-IMP-RAWDEFAULT** (P0/P1) — a Settings dialog: raw defaults (preset or camera-specific),- XMP prefs, cache, GPU. Medium effort.- 10. **LR-IMP-ADD-DIALOG + LR-IMP-LOCAL** (P0) — an import review grid with per-photo checkboxes and destination-1. **LR-MASK-OVERLAY + LR-MASK-PINS** (P0/P1) — show the evaluated mask alpha as a coloured overlay (all mask- kinds, colour/opacity choice), not just brush dabs and outlines. High value, medium effort.-2. **LR-MASK-BRUSH + LR-MASK-SLIDERS** (P0) — apply the stored Auto Mask flag (edge-aware brush) and the local- Noise / Moiré / Defringe sliders, which are stored but not rendered. High value, medium effort.-3. **LR-REM-SPOT-EDIT + LR-REM-BRUSH-PARAMS** (P0) — select a spot pin, move target/source, delete with ⌫,- feather/opacity sliders, `[`/`]` size keys. Medium effort.-4. **LR-VIEW-PHOTOGRID** (P0) — group the justified grid by capture date with headers. Low–medium effort.-5. **LR-LIB-KEYWORD** (P0) — rename/delete a keyword library-wide; keyword list in the left panel for browsing.-6. **LR-IMP-ADD-DIALOG + LR-IMP-LOCAL** (P0) — an import review grid with per-photo checkboxes and destination++1. **LR-VIEW-PHOTOGRID** (P0) — group the justified grid by capture date with headers. Low–medium effort.++2. **LR-LIB-KEYWORD** (P0) — rename/delete a keyword library-wide; keyword list in the left panel for browsing.++3. **LR-IMP-ADD-DIALOG + LR-IMP-LOCAL** (P0) — an import review grid with per-photo checkboxes and destinationalbum; browse folders before adding. Medium effort.- 11. **LR-EXP-TYPE + LR-EXP-DIM** (P0) — Original (+XMP) and DNG export (writer exists in-7. **LR-EXP-TYPE + LR-EXP-DIM** (P0) — Original (+XMP) and DNG export (writer exists in++4. **LR-EXP-TYPE + LR-EXP-DIM** (P0) — Original (+XMP) and DNG export (writer exists in`crates/raw/src/dngwrite.rs`), short edge / width / height / megapixels, "don't enlarge", ppi.- 12. **LR-IMP-FORMATS** (P0) — CR3, compressed NEF/RAF/ORF, RW2 v4 (preview only today); HEIC/AVIF decode (no-8. **LR-IMP-FORMATS** (P0) — CR3, compressed NEF/RAF/ORF, RW2 v4 (preview only today); HEIC/AVIF decode (no++5. **LR-IMP-FORMATS** (P0) — CR3, compressed NEF/RAF/ORF, RW2 v4 (preview only today); HEIC/AVIF decode (nopermissive pure-Rust decoder yet). High value, high effort (clean sources needed).- 13. **LR-VIEW-FULLSCREEN + LR-VIEW-NAVIGATOR + LR-VIEW-INFOOVERLAY** (P1) — view modes. Medium effort.- 14. **LR-LIB-RENAME + LR-LIB-CAPTURETIME + LR-LIB-LABEL UI** (P1) — batch rename, capture-time edit, label menu/names.- 15. **LR-EXP-BITDEPTH + LR-EXP-COMPRESSION** (P1) — 16-bit TIFF/PNG and TIFF compression choice.- 16. **LR-EDIT-OPTICS-PROFILE** (P1) — a lens-profile database of our own (embedded DNG/maker corrections work today).-9. **LR-LIB-RENAME + LR-LIB-CAPTURETIME + LR-LIB-LABEL UI** (P1) — batch rename, capture-time edit, label menu/names.-10. **LR-EDIT-OPTICS-PROFILE** (P1) — a lens-profile database of our own (embedded DNG/maker corrections work today).++6. **LR-LIB-RENAME + LR-LIB-CAPTURETIME + LR-LIB-LABEL UI** (P1) — batch rename, capture-time edit, label menu/names.++7. **LR-EDIT-OPTICS-PROFILE** (P1) — a lens-profile database of our own (embedded DNG/maker corrections work today).## Shortcuts: conflicts and missing bindings@@@ -102,10 -99,10 +93,9 @@@ under the UI command that wraps it (a n**Still missing / broken:**- No command yet: F full-screen preview, ⇧⌘F window full screen, ⇧⌘V paste selected,-- ⌘, settings, ⌘F focus search, ⌘G / ⇧⌘G stacks, A visualize spots, `[` `]` / ⇧`[` ⇧`]`-- brush size/feather, ⌃H / ⌃M merges, F1 help, ⇧6–9 label + advance.--- `⌫` in the Masking panel deletes the active mask; spots have no pin selection yet (⌫ does nothing in Remove).--- `H` opens Remove; Lightroom also uses it (Classic) to hide pins — no pin toggle yet.++ ⌘, settings, ⌘F focus search, ⌘G / ⇧⌘G stacks, A visualize spots, ⌃H / ⌃M merges, F1 help,++ ⇧6–9 label + advance.++- `H` opens Remove; Lightroom also uses it (Classic) to hide pins — pins toggle from View → Show Mask Pins.- ⌘M / ⌘H / ⌘Q / ⌘W rely on the platform window defaults (unverified).<!-- Sections below hold one row per id. Keep the column order: Id | Feature | Tier | Status | Evidence | Notes. -->@@@ -633,7 -630,7 +623,7 @@@ From `06-shortcuts.md` part 1. Evidenc| KEY-PREFS | Settings — ⌘, | P0 | ⬜ | | no command || KEY-SEARCH | Search — ⌘F | P0 | ⬜ | | no focus-search command || KEY-VISUALIZESPOTS | Visualize spots — A | P1 | ⬜ | | |--| KEY-CYCLEOVERLAY | Cycle overlay — O | P0 | 🟡 | `cmd:view.maskOverlay`, `cmd:view.cropOverlay` | O toggles the mask overlay; crop overlays cycle on ⇧O |++| KEY-CYCLEOVERLAY | Cycle overlay — O | P0 | ✅ | `cmd:view.maskOverlay`, `cmd:view.maskOverlayMode`, `cmd:view.cropOverlay` | O toggles the mask overlay; ⇧O cycles mask overlay modes while masking, crop overlays elsewhere || KEY-PHOTOSPANEL | Photos panel — P | P0 | 🟡 | `cmd:view.leftPanel` | bound to ⌘⇧L; P = pick || KEY-LINEAR | Linear gradient — L | P0 | ✅ | `cmd:tool.linear` | || KEY-RADIAL | Radial gradient — R | P0 | ✅ | `cmd:tool.radial` | |@@@ -658,8 -655,8 +648,8 @@@| KEY-SECTIONS | Expand/collapse edit sections — ⌘1…⌘6 | P1 | 🟡 | `cmd:section.light`, `cmd:section.color`, `cmd:section.effects`, `cmd:section.detail`, `cmd:section.optics` | bound to ⌘⌥1–5 || KEY-PRESETS | Presets panel — ⇧P | P0 | ✅ | `cmd:panel.presets` | || KEY-HISTOGRAM | Histogram — ⌘0 | P0 | 🟡 | `cmd:view.histogram` | bound to ⌘⇧H; ⌘0 = zoom to fit |--| KEY-BRUSHSIZE | Brush size — `[` / `]` | P0 | ⬜ | | brush size is UI state, no command |--| KEY-BRUSHFEATHER | Brush feather — ⇧`[` / ⇧`]` | P0 | ⬜ | | |++| KEY-BRUSHSIZE | Brush size — `[` / `]` | P0 | ✅ | `cmd:brush.smaller`, `cmd:brush.larger` | Masking brush and Remove tool (and its selected spot) |++| KEY-BRUSHFEATHER | Brush feather — ⇧`[` / ⇧`]` | P0 | ✅ | `cmd:brush.featherLess`, `cmd:brush.featherMore` | || KEY-BRUSH | Brush — B | P0 | ✅ | `cmd:tool.brush` | || KEY-HEAL | Remove / heal — H | P0 | ✅ | `cmd:panel.remove` | || KEY-MERGE | HDR / panorama merges — ⌃H ⇧⌃H ⌃M ⇧⌃M | P2 | ⬜ | | |@@@ -692,7 -689,7 +682,7 @@@| KEY-VIDEO-PLAY | Play/pause video — Space | P1 | ⬜ | | || KEY-ESC | Leave tool / view — Esc | P0 | ✅ | `cmd:view.back` | || KEY-COMMIT | Commit tool — Return | P1 | 🟡 | | edits apply live; no explicit commit step |--| KEY-DELETE-PIN | Delete selected pin — ⌫ | P0 | 🟡 | `cmd:mask.delete` | ⌫ deletes the active mask in the Masking panel and never the photo while retouching; no spot pin selection yet |++| KEY-DELETE-PIN | Delete selected pin — ⌫ | P0 | ✅ | `cmd:mask.delete`, `cmd:spot.delete` | ⌫ deletes the active mask (Masking) or the selected spot (Remove), never the photo while retouching || KEY-HIDEPINS | Hide pins — H | P2 | ⬜ | | H = Remove panel |## Lightroom Classic extras