Merge PR #5128: Camera Raw: Calibration panel, Auto, raw sidecars and live Camera Raw Defaults (FILE-215-11)

# Conflicts:
#	crates/engine/src/prefs.rs
#	docs/gaps.md
#	docs/scorecard.md
This commit is contained in:
David Mann committed 2026-10-25 13:07:14 +01:00
commit 7eec69f8f5
33 files changed
+1273 -59

No files matched your search

+201
View File
@@ -169,6 +169,13 @@ pub struct CameraRaw {
/// The document's transfer curve: 0 for sRGB's, else the gamma of a power-law space (1.8
/// for ProPhoto). Set from the document's profile; Whites and Blacks act on light.
pub encoding_gamma: f32,
// Calibration (Camera Raw's Calibration panel)
/// Shadows › Tint: −100 (green) … 100 (magenta), strongest in the darkest tones.
pub shadow_tint: f32,
/// Red, Green and Blue Primary › Hue: −100 … 100, the primary turned towards its neighbours.
pub calibration_hue: [f32; 3],
/// Red, Green and Blue Primary › Saturation: −100 (grey) … 100 (purer).
pub calibration_sat: [f32; 3],
}
impl Default for CameraRaw {
@@ -225,6 +232,9 @@ impl Default for CameraRaw {
seed: 0,
pixel_scale: 1.0,
encoding_gamma: 0.0,
shadow_tint: 0.0,
calibration_hue: [0.0; 3],
calibration_sat: [0.0; 3],
}
}
}
@@ -232,6 +242,90 @@ impl Default for CameraRaw {
/// Hue band centres of the Color Mixer (degrees).
pub const HSL_BANDS: [f32; 8] = [0.0, 30.0, 60.0, 120.0, 180.0, 240.0, 270.0, 300.0];
/// How far a primary turns at Hue ±100 (degrees), as the Color Mixer's hue sliders do.
const CALIBRATION_TURN: f32 = 30.0;
/// How much of each primary (red, green, blue) a hue is made of: triangular weights around
/// 0°, 120° and 240° that sum to one, so a colour between two primaries follows both.
pub fn calibration_weights(hue: f32) -> [f32; 3] {
let h = hue.rem_euclid(360.0);
let mut w = [0.0f32; 3];
for (i, centre) in [0.0f32, 120.0, 240.0].iter().enumerate() {
let d = (h - centre).abs().min(360.0 - (h - centre).abs());
w[i] = (1.0 - d / 120.0).max(0.0);
}
let sum: f32 = w.iter().sum();
if sum > 1e-6 { w.map(|v| v / sum) } else { [1.0, 0.0, 0.0] }
}
/// The Calibration panel's primaries on one linear-light pixel: its hue turns by the weighted
/// Hue of the primaries it is made of (±100 is ±30°, positive towards the next primary) and its
/// saturation scales by their weighted Saturation (−100 greys it); the luminance is kept, so
/// neutrals are untouched.
fn calibrate(c: [f32; 3], hue: [f32; 3], sat: [f32; 3]) -> [f32; 3] {
let [h, s, v] = rgb_to_hsv(c.map(|x| x.max(0.0)));
if s <= 1e-5 || v <= 1e-6 {
return c;
}
let w = calibration_weights(h);
let (mut dh, mut ds) = (0.0f32, 0.0f32);
for i in 0..3 {
dh += w[i] * hue[i].clamp(-100.0, 100.0);
ds += w[i] * sat[i].clamp(-100.0, 100.0);
}
let nh = h + dh / 100.0 * CALIBRATION_TURN;
let ns = (s * (1.0 + ds / 100.0)).clamp(0.0, 1.0);
let out = hsv_to_rgb(nh, ns, v);
let (l0, l1) = (luma(c), luma(out));
if l1 > 1e-6 { out.map(|x| x * l0 / l1) } else { out }
}
/// Shadows › Tint on one linear-light pixel: `tint` −1 (green) … 1 (magenta), weighted by how
/// dark the pixel is; the luminance is kept.
fn shadow_tint(c: [f32; 3], tint: f32) -> [f32; 3] {
let l = luma(c).max(0.0);
// Linear 0.18 is middle grey: full strength below it, fading out towards white.
let weight = (1.0 - (l / 0.18).sqrt().min(1.0)).powi(2) * 0.5 + (1.0 - l.min(1.0)).powi(4) * 0.5;
let k = tint * 0.12 * weight * (l + 0.02);
let o = [c[0] + k, c[1] - k, c[2] + k].map(|v| v.max(0.0));
let l2 = luma(o);
if l2 > 1e-6 { o.map(|v| v * l / l2) } else { o }
}
/// Camera Raw's Auto for the Light panel: Exposure, Contrast, Highlights, Shadows, Whites and
/// Blacks from the image's luminance histogram (`px` in the document's encoding). A well
/// exposed image gets near-zero settings; a dark one more exposure and lifted shadows; one
/// with a crushed or blown end gets Blacks or Whites back from the edge. The other panels are
/// left alone, as Camera Raw's Auto leaves them.
pub fn auto_tone(px: &[[f32; 4]], p: &mut CameraRaw) {
if px.is_empty() {
return;
}
let mut lum: Vec<f32> = px.iter().map(|q| luma([q[0], q[1], q[2]]).clamp(0.0, 1.0)).collect();
lum.sort_by(|a, b| a.total_cmp(b));
let at = |f: f32| lum[((lum.len() - 1) as f32 * f).round() as usize];
let (black, shadow, median, light, white) = (at(0.001), at(0.1), at(0.5), at(0.9), at(0.999));
// Exposure: the median towards middle grey (sRGB 0.46), damped so flat scenes aren't
// forced to it.
let median_lin = srgb_to_linear(median).max(1e-4);
p.exposure = (0.6 * (0.18f32 / median_lin).log2()).clamp(-2.0, 2.0);
// Blacks and Whites bring the ends to the edges without clipping more than Camera Raw does.
p.blacks = ((0.04 - black) * 400.0).clamp(-40.0, 40.0);
p.whites = ((0.96 - white) * 300.0).clamp(-40.0, 40.0);
// Shadows up when the darker tenth is crushed, highlights down when the brighter tenth is
// near white.
p.shadows = ((0.25 - shadow) * 200.0).clamp(0.0, 50.0);
p.highlights = ((light - 0.85) * -300.0).clamp(-50.0, 0.0);
// A little contrast for a flat histogram.
let spread = (light - shadow).max(0.0);
p.contrast = ((0.6 - spread) * 60.0).clamp(0.0, 25.0);
// Shown as Camera Raw shows them: Exposure to a hundredth of a stop, the others whole.
p.exposure = (p.exposure * 100.0).round() / 100.0;
for v in [&mut p.blacks, &mut p.whites, &mut p.shadows, &mut p.highlights, &mut p.contrast] {
*v = v.round();
}
}
fn luma(c: [f32; 3]) -> f32 {
0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2]
}
@@ -537,6 +631,10 @@ impl CameraRaw {
fn grade_neutral(&self) -> bool {
self.grade_shadows.neutral() && self.grade_midtones.neutral() && self.grade_highlights.neutral() && self.grade_global.neutral()
}
/// The Calibration panel at rest.
fn calibration_neutral(&self) -> bool {
self.shadow_tint == 0.0 && self.calibration_hue.iter().chain(&self.calibration_sat).all(|v| *v == 0.0)
}
fn curves_neutral(&self) -> bool {
[self.curve_highlights, self.curve_lights, self.curve_darks, self.curve_shadows].iter().all(|v| *v == 0.0)
&& [&self.point_curve, &self.point_curve_red, &self.point_curve_green, &self.point_curve_blue].iter().all(|c| is_linear(c))
@@ -544,6 +642,7 @@ impl CameraRaw {
/// True when every control is neutral (the filter is an identity).
pub fn is_identity(&self) -> bool {
self.wb_neutral()
&& self.calibration_neutral()
&& self.tone_neutral()
&& self.dehaze == 0.0
&& self.vibrance == 0.0
@@ -590,6 +689,24 @@ pub fn develop(px: &mut [[f32; 4]], w: usize, h: usize, p: &CameraRaw, float: bo
}
});
}
// 1b. Calibration: the primaries turned and purer or greyer, and the shadows tinted, in
// linear light (the camera's primaries are what Camera Raw's panel calibrates).
if !p.calibration_neutral() {
let primaries = p.calibration_hue.iter().chain(&p.calibration_sat).any(|v| *v != 0.0);
let tint = p.shadow_tint.clamp(-100.0, 100.0) / 100.0;
par_rows(px, w, 1, |_, row| {
for q in row.iter_mut() {
let c = [srgb_to_linear(q[0]), srgb_to_linear(q[1]), srgb_to_linear(q[2])];
let mut o = if primaries { calibrate(c, p.calibration_hue, p.calibration_sat) } else { c };
if tint != 0.0 {
o = shadow_tint(o, tint);
}
for k in 0..3 {
q[k] = linear_to_srgb(o[k].max(0.0));
}
}
});
}
// 2. Dehaze.
if p.dehaze != 0.0 {
dehaze(px, w, h, p.dehaze / 100.0);
@@ -1140,6 +1257,90 @@ mod tests {
assert!(v[0][0] < 0.35 && (v[(h / 2) * w + w / 2][0] - 0.5).abs() < 0.01, "{:?}", v[0]);
}
#[test]
fn calibration_turns_primaries_keeps_neutrals_and_tints_shadows() {
let w = calibration_weights(0.0);
assert!((w[0] - 1.0).abs() < 1e-6, "pure red is all red primary: {w:?}");
let w = calibration_weights(60.0);
assert!((w[0] - 0.5).abs() < 1e-6 && (w[1] - 0.5).abs() < 1e-6, "yellow is half red, half green: {w:?}");
let w = calibration_weights(300.0);
assert!((w[2] - 0.5).abs() < 1e-6 && (w[0] - 0.5).abs() < 1e-6, "magenta wraps round: {w:?}");
let (none, zero) = ([0.0f32; 3], [0.0f32; 3]);
let grey = calibrate([0.3, 0.3, 0.3], [100.0, -100.0, 50.0], [100.0, -100.0, 100.0]);
assert!(grey.iter().all(|v| (v - 0.3).abs() < 1e-5), "greys are untouched: {grey:?}");
// Red turned towards green: it gains green, keeps its luminance.
let red = calibrate([0.5, 0.0, 0.0], [100.0, 0.0, 0.0], zero);
assert!(red[1] > 0.05 && (red[1] / red[0] - 0.5).abs() < 0.02 && red[2] < 1e-6, "red turns 30° towards green (orange): {red:?}");
assert!((luma(red) - luma([0.5, 0.0, 0.0])).abs() < 1e-4, "luminance kept: {red:?}");
// Blue at saturation −100 is grey; green at −50 is paler.
let blue = calibrate([0.0, 0.0, 0.8], none, [0.0, 0.0, -100.0]);
assert!((blue[0] - blue[1]).abs() < 1e-5 && (blue[1] - blue[2]).abs() < 1e-5, "blue at −100 saturation is grey: {blue:?}");
let green = calibrate([0.2, 0.8, 0.2], none, [0.0, -50.0, 0.0]);
assert!(green[0] > 0.2 && green[1] < 0.8, "green at −50 is paler: {green:?}");
// A primary's sliders leave the other primaries alone.
let unchanged = calibrate([0.0, 0.0, 0.8], [100.0, 100.0, 0.0], [100.0, 100.0, 0.0]);
assert!(unchanged.iter().zip([0.0, 0.0, 0.8]).all(|(a, b)| (a - b).abs() < 1e-5), "{unchanged:?}");
// Shadows tint: magenta lifts red and blue over green in a dark pixel, keeps luminance,
// and leaves white alone.
let dark = shadow_tint([0.02, 0.02, 0.02], 1.0);
assert!(dark[0] > dark[1] && dark[2] > dark[1], "{dark:?}");
assert!((luma(dark) - 0.02).abs() < 1e-4, "luminance kept: {dark:?}");
let green = shadow_tint([0.02, 0.02, 0.02], -1.0);
assert!(green[1] > green[0], "{green:?}");
let white = shadow_tint([1.0, 1.0, 1.0], 1.0);
assert!(white.iter().all(|v| (v - 1.0).abs() < 1e-3), "white is not tinted: {white:?}");
// Through develop: neutral settings are an identity, a tint changes dark pixels only.
let mut p = CameraRaw::default();
assert!(p.is_identity());
p.shadow_tint = 100.0;
assert!(!p.is_identity());
let mut px = vec![[0.1, 0.1, 0.1, 1.0], [0.95, 0.95, 0.95, 1.0]];
develop(&mut px, 2, 1, &p, false);
assert!(px[0][0] > px[0][1], "dark grey turns magenta: {:?}", px[0]);
assert!((px[1][0] - px[1][1]).abs() < 0.01, "near-white stays neutral: {:?}", px[1]);
p = CameraRaw::default();
p.calibration_hue[2] = 100.0;
let mut px = vec![[0.0, 0.0, 0.8, 1.0]];
develop(&mut px, 1, 1, &p, false);
assert!(px[0][0] > 0.05, "blue turned towards red: {:?}", px[0]);
}
#[test]
fn auto_tone_brightens_dark_and_darkens_bright_images() {
let mut p = CameraRaw::default();
auto_tone(&[], &mut p);
assert_eq!(p, CameraRaw::default(), "no pixels: nothing changes");
let dark: Vec<[f32; 4]> = (0..4096)
.map(|i| {
let v = 0.05 + (i % 64) as f32 / 64.0 * 0.15;
[v, v, v, 1.0]
})
.collect();
auto_tone(&dark, &mut p);
assert!(p.exposure > 0.5, "a dark image gets exposure: {}", p.exposure);
assert!(p.shadows > 0.0, "and lifted shadows: {}", p.shadows);
let mut p = CameraRaw::default();
let bright: Vec<[f32; 4]> = (0..4096)
.map(|i| {
let v = 0.8 + (i % 64) as f32 / 64.0 * 0.19;
[v, v, v, 1.0]
})
.collect();
auto_tone(&bright, &mut p);
assert!(p.exposure < -0.5, "a bright image loses exposure: {}", p.exposure);
assert!(p.highlights < 0.0, "and its highlights come down: {}", p.highlights);
let mut p = CameraRaw::default();
let good: Vec<[f32; 4]> = (0..4096)
.map(|i| {
let v = 0.04 + (i % 64) as f32 / 63.0 * 0.92;
[v, v, v, 1.0]
})
.collect();
auto_tone(&good, &mut p);
assert!(p.exposure.abs() < 0.3 && p.blacks.abs() < 10.0 && p.whites.abs() < 10.0, "a full-range image is left nearly alone: {p:?}");
assert!(p.saturation == 0.0 && p.hsl_neutral(), "other panels untouched");
}
#[test]
fn float_documents_keep_overrange() {
let mut a = vec![[2.0f32, 1.5, 0.5, 1.0]; 16];
+1 -1
View File
@@ -472,7 +472,7 @@ pub fn specs() -> Vec<CommandSpec> {
label: "Camera Raw Filter…",
menu: &["Filter"],
shortcut: Some("Cmd+Shift+A"),
params: r##"{"temperature":-100..100=0,"tint":-100..100=0,"exposure":-5..5=0,"contrast":-100..100=0,"highlights":-100..100=0,"shadows":-100..100=0,"whites":-100..100=0,"blacks":-100..100=0,"texture":-100..100=0,"clarity":-100..100=0,"dehaze":-100..100=0,"vibrance":-100..100=0,"saturation":-100..100=0,"curveHighlights":-100..100=0,"curveLights":-100..100=0,"curveDarks":-100..100=0,"curveShadows":-100..100=0,"curveSplits":[25,50,75],"pointCurve":[[in,out]],"pointCurveRed":[[in,out]],"pointCurveGreen":[[in,out]],"pointCurveBlue":[[in,out]],"hslHue":[8],"hslSat":[8],"hslLum":[8],"gradeShadows":{"hue":deg,"sat":0..100,"lum":-100..100},"gradeMidtones":{},"gradeHighlights":{},"gradeGlobal":{},"gradeBlending":0..100=50,"gradeBalance":-100..100=0,"sharpenAmount":0..150=0,"sharpenRadius":0.5..3=1,"sharpenDetail":0..100=25,"sharpenMasking":0..100=0,"noiseLuminance":0..100=0,"noiseLuminanceDetail":0..100=50,"noiseColor":0..100=0,"noiseColorDetail":0..100=50,"grainAmount":0..100=0,"grainSize":0..100=25,"grainRoughness":0..100=50,"vignetteAmount":-100..100=0,"vignetteMidpoint":0..100=50,"vignetteRoundness":-100..100=0,"vignetteFeather":0..100=50,"vignetteHighlights":0..100=0,"vignetteStyle":"highlightPriority|colorPriority|paintOverlay","seed":u32=0}"##,
params: r##"{"temperature":-100..100=0,"tint":-100..100=0,"exposure":-5..5=0,"contrast":-100..100=0,"highlights":-100..100=0,"shadows":-100..100=0,"whites":-100..100=0,"blacks":-100..100=0,"texture":-100..100=0,"clarity":-100..100=0,"dehaze":-100..100=0,"vibrance":-100..100=0,"saturation":-100..100=0,"curveHighlights":-100..100=0,"curveLights":-100..100=0,"curveDarks":-100..100=0,"curveShadows":-100..100=0,"curveSplits":[25,50,75],"pointCurve":[[in,out]],"pointCurveRed":[[in,out]],"pointCurveGreen":[[in,out]],"pointCurveBlue":[[in,out]],"hslHue":[8],"hslSat":[8],"hslLum":[8],"gradeShadows":{"hue":deg,"sat":0..100,"lum":-100..100},"gradeMidtones":{},"gradeHighlights":{},"gradeGlobal":{},"gradeBlending":0..100=50,"gradeBalance":-100..100=0,"shadowTint":-100..100=0,"calibrationHue":[red,green,blue] -100..100,"calibrationSat":[red,green,blue] -100..100 (the Calibration panel: Shadows tint and the primaries' hue and saturation),"sharpenAmount":0..150=0,"sharpenRadius":0.5..3=1,"sharpenDetail":0..100=25,"sharpenMasking":0..100=0,"noiseLuminance":0..100=0,"noiseLuminanceDetail":0..100=50,"noiseColor":0..100=0,"noiseColorDetail":0..100=50,"grainAmount":0..100=0,"grainSize":0..100=25,"grainRoughness":0..100=50,"vignetteAmount":-100..100=0,"vignetteMidpoint":0..100=50,"vignetteRoundness":-100..100=0,"vignetteFeather":0..100=50,"vignetteHighlights":0..100=0,"vignetteStyle":"highlightPriority|colorPriority|paintOverlay","seed":u32=0}"##,
enabled: raw_enabled,
run: camera_raw_cmd,
journal: true,
+30 -5
View File
@@ -908,6 +908,35 @@ pub struct RawDefaults {
pub open_in_camera_raw: bool,
/// The demosaic method raws are developed with; the open-time Camera Raw dialog starts from it.
pub demosaic: RawDemosaic,
/// Keep a raw file's develop settings in a sidecar (`IMG_0001.xmp` beside `IMG_0001.CR2`),
/// as Camera Raw's "Save image settings in: Sidecar .xmp files"; the sidecar is read again
/// when the file is next opened. Off reads sidecars but never writes one.
pub write_xmp_sidecars: bool,
}
impl RawColorSpace {
/// The built-in profile `edit.convertToProfile` knows this space as.
pub fn profile_id(self) -> &'static str {
match self {
RawColorSpace::Srgb => "srgb",
RawColorSpace::AdobeRgb => "adobe-rgb-compat",
RawColorSpace::ProPhoto => "prophoto-compat",
RawColorSpace::DisplayP3 => "display-p3",
}
}
}
impl RawSharpen {
/// Camera Raw's output sharpening for this medium as the Detail panel's (amount, radius):
/// none, Screen (light, fine), Matte paper (stronger, wider: ink spreads), Glossy paper.
pub fn preset(self) -> Option<(f32, f32)> {
match self {
RawSharpen::None => None,
RawSharpen::Screen => Some((25.0, 1.0)),
RawSharpen::Matte => Some((35.0, 1.2)),
RawSharpen::Glossy => Some((40.0, 1.0)),
}
}
}
impl RawDemosaic {
@@ -932,6 +961,7 @@ impl Default for RawDefaults {
apply_auto_tone: false,
open_in_camera_raw: true,
demosaic: RawDemosaic::Ahd,
write_xmp_sidecars: true,
}
}
}
@@ -1136,11 +1166,6 @@ pub const HIDDEN_UNTIL_IMPLEMENTED: &[&str] = &[
"plugIns.allowScriptsToConnect",
"type.textEngine",
"enhancedControls.scrubbySliderAcceleration",
"rawDefaults.colorSpace",
"rawDefaults.bitDepth",
"rawDefaults.sharpenFor",
"rawDefaults.openAsSmartObject",
"rawDefaults.applyAutoTone",
];
/// Is the preference at `path` (`"section.key"`) hidden from the Preferences dialog?
+52 -3
View File
@@ -3,8 +3,9 @@
//! `x:xmpmeta/rdf:RDF/rdf:Description`, as attributes or as child elements.
//!
//! Loading applies only the settings the file holds, over the current ones, as Camera Raw's
//! Load Settings does; settings PhotoCraft has no control for (lens corrections, calibration,
//! geometry, defringe, …) are ignored and named in the report. Saving writes every supported
//! Load Settings does; settings PhotoCraft has no control for (lens corrections, geometry,
//! defringe, …) are ignored and named in the report. The same reader fills the dialog from a
//! raw file's sidecar (`IMG_0001.xmp` beside `IMG_0001.CR2`), and the writer keeps it. Saving writes every supported
//! control, so loading the file in Photoshop reproduces the dialog.
//!
//! White balance: a Camera Raw Filter on a rendered image uses the relative
@@ -100,6 +101,14 @@ const SCALARS: &[(&str, Field, f32, f32)] = &[
("PostCropVignetteRoundness", |p| &mut p.vignette_roundness, -100.0, 100.0),
("PostCropVignetteFeather", |p| &mut p.vignette_feather, 0.0, 100.0),
("PostCropVignetteHighlightContrast", |p| &mut p.vignette_highlights, 0.0, 100.0),
// Calibration
("ShadowTint", |p| &mut p.shadow_tint, -100.0, 100.0),
("RedHue", |p| &mut p.calibration_hue[0], -100.0, 100.0),
("RedSaturation", |p| &mut p.calibration_sat[0], -100.0, 100.0),
("GreenHue", |p| &mut p.calibration_hue[1], -100.0, 100.0),
("GreenSaturation", |p| &mut p.calibration_sat[1], -100.0, 100.0),
("BlueHue", |p| &mut p.calibration_hue[2], -100.0, 100.0),
("BlueSaturation", |p| &mut p.calibration_sat[2], -100.0, 100.0),
];
type Curve = fn(&mut CameraRaw) -> &mut Vec<[f32; 2]>;
@@ -265,6 +274,25 @@ fn escape(s: &str) -> String {
s.replace('&', "&amp;").replace('<', "&lt;").replace('>', "&gt;").replace('"', "&quot;")
}
/// The XMP toolkit [`save`] names on `x:xmpmeta`.
const TOOLKIT: &str = "PhotoCraft";
const META_NS: &str = "adobe:ns:meta/";
/// Did [`save`] write this file? True when its `x:xmpmeta` names PhotoCraft as the toolkit
/// (`x:xmptk`). Lightroom, Bridge and Camera Raw put their own toolkit there when they write a
/// file, so a sidecar another application touched since reads false. Never panics.
pub fn is_photocraft_xmp(bytes: &[u8]) -> bool {
if bytes.len() > MAX_XMP_BYTES {
return false;
}
let Ok(text) = std::str::from_utf8(bytes) else { return false };
let Ok(doc) = roxmltree::Document::parse(text.trim_start_matches('\u{feff}')) else { return false };
doc.descendants()
.find(|n| n.is_element() && n.tag_name().namespace() == Some(META_NS) && n.tag_name().name() == "xmpmeta")
.and_then(|n| n.attribute((META_NS, "xmptk")))
== Some(TOOLKIT)
}
/// Write `params` as a Camera Raw settings file Photoshop's Load Settings… reads.
pub fn save(params: &CameraRaw) -> String {
let mut p = params.clone();
@@ -357,7 +385,8 @@ mod tests {
assert_eq!(p.point_curve_red, vec![[0.0, 0.0], [128.0, 140.0], [255.0, 255.0]]);
assert_eq!(p.dehaze, 12.0);
// Lens vignetting, calibration and geometry have no counterpart.
assert_eq!(r.ignored, vec!["VignetteAmount".to_string(), "RedHue".to_string()]);
assert_eq!(r.ignored, vec!["VignetteAmount".to_string()], "the Calibration panel's keys load now");
assert_eq!(p.calibration_hue[0], -5.0);
}
#[test]
@@ -420,4 +449,24 @@ mod tests {
assert_eq!(p, before);
assert_eq!(r.ignored, vec!["Contrast2012".to_string(), "ToneCurvePV2012".to_string()]);
}
#[test]
fn is_photocraft_xmp_reads_the_toolkit_marker() {
let own = save(&CameraRaw { contrast: 15.0, ..CameraRaw::default() });
assert!(is_photocraft_xmp(own.as_bytes()));
let wrapped = format!("\u{feff}<?xpacket begin=\"\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n{own}<?xpacket end=\"w\"?>");
assert!(is_photocraft_xmp(wrapped.as_bytes()), "an xpacket wrapper and a byte order mark");
assert!(!is_photocraft_xmp(FIXTURE), "Camera Raw's own toolkit");
for other in [
&b""[..],
b"<x:xmpmeta",
b"<x:xmpmeta xmlns:x=\"adobe:ns:meta/\"/>",
b"<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" xmptk=\"PhotoCraft\"/>",
b"<x:xmpmeta xmlns:x=\"other:ns/\" x:xmptk=\"PhotoCraft\"/>",
b"<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"PhotoCraft 2\"/>",
b"\xff\xfe",
] {
assert!(!is_photocraft_xmp(other), "{}", String::from_utf8_lossy(other));
}
}
}
@@ -63,14 +63,14 @@ fn identity_app() -> (PhotocraftApp, RawOpen, Control) {
fn completed_redevelop(app: &mut PhotocraftApp, raw: &RawOpen) -> (CameraRaw, Value, photocraft_doc::DocId) {
app.background_jobs = true;
let params = CameraRaw { exposure: 1.0, contrast: 20.0, ..Default::default() };
let started = commit_open_raw(app, &params, raw).unwrap();
let started = commit_open_raw(app, &params, raw, None).unwrap();
let job = photocraft_engine::jobs::JobId(started["job"].as_u64().expect("the sensor re-develop runs as a real job"));
let mut result = app.session.wait_job(job).unwrap();
let replacement = app.session.documents()[result["document"].as_u64().unwrap() as usize].doc.id;
// The producer has a separate contract test. Supply the observed identity here to isolate
// the UI consumer's handling even when run against the old result schema.
result["docId"] = json!(replacement.0);
app.raw_redevelop = None;
app.raw_redevelop.clear();
app.background_jobs = false;
(params, result, replacement)
}
@@ -96,7 +96,7 @@ fn completion_identity_applies_remaining_settings_after_tab_reordering() {
let index = result["document"].as_u64().unwrap() as usize;
app.session.move_document(index, 0).unwrap();
assert_eq!(app.session.documents()[index].doc.id, control.doc.id, "another completion may move this tab before the RAW callback");
finish_redevelop(&mut app, &params, &raw, &result).unwrap();
finish_redevelop(&mut app, &params, &raw, &result, &Default::default()).unwrap();
control.assert_untouched(&app);
let state = app.session.active().unwrap();
assert_eq!(state.doc.id, replacement);
@@ -113,7 +113,7 @@ fn completion_identity_rejects_a_closed_replacement_without_filtering_the_active
let index = app.session.documents().iter().position(|state| state.doc.id == replacement).unwrap();
app.session.close(index).unwrap();
assert_eq!(app.session.active().unwrap().doc.id, control.doc.id);
assert!(finish_redevelop(&mut app, &params, &raw, &result).is_err(), "a closed replacement must not fall back to the active document");
assert!(finish_redevelop(&mut app, &params, &raw, &result, &Default::default()).is_err(), "a closed replacement must not fall back to the active document");
control.assert_untouched(&app);
assert_eq!(app.session.documents().len(), 1);
}
@@ -133,7 +133,7 @@ fn completion_identity_rejects_missing_and_invalid_ids_before_any_side_effect()
app.session.set_active(0);
let views = app.view_docs.clone();
let notices = app.ui.notices.len();
assert!(finish_redevelop(&mut app, &params, &raw, &result).is_err(), "invalid identity was accepted: {result}");
assert!(finish_redevelop(&mut app, &params, &raw, &result, &Default::default()).is_err(), "invalid identity was accepted: {result}");
control.assert_untouched(&app);
assert_eq!(app.session.active().unwrap().doc.id, control.doc.id);
assert_eq!(app.view_docs, views, "identity validation precedes view remapping");
+724 -29
View File
@@ -425,7 +425,32 @@ fn open_raw(app: &mut PhotocraftApp, ctx: &egui::Context, raw: RawOpen) -> Resul
let index = document_index(app, raw.document).ok_or("the raw document was closed")?;
app.session.set_active(index);
let (layer, surf, _) = crate::distort_ui::active_pixels(app)?;
open_pixels(app, ctx, layer, surf, CameraRaw::default(), Coverage::None, Target::OpenRaw)?;
// The file's sidecar (`IMG_0001.xmp` beside it) fills the dialog, as Camera Raw's does; the
// status bar names what it could not apply.
let mut params = CameraRaw::default();
let mut from_sidecar = false;
if let Some((loaded, report, file)) = raw.path.as_deref().and_then(read_sidecar) {
params = loaded;
from_sidecar = true;
app.ui.status = if report.ignored.is_empty() {
crate::i18n::fmt(tl!("Settings from {name}"), &[("name", &file)])
} else {
crate::i18n::fmt(
tl!("Settings from {name}; {count} not supported: {names}"),
&[("name", &file), ("count", &report.ignored.len().to_string()), ("names", &report.ignored.join(", "))],
)
};
app.ui.status_error = false;
}
open_pixels(app, ctx, layer, surf, params, Coverage::None, Target::OpenRaw)?;
// Camera Raw Defaults › Apply auto tone: a file without its own settings opens with Auto.
if !from_sidecar
&& app.session.prefs().raw_defaults.apply_auto_tone
&& let Some(d) = app.camera_raw.as_mut()
{
photocraft_algo::camera_raw::auto_tone(&d.proxy, &mut d.params);
d.dirty = true;
}
let curve = match (&raw.bytes, &raw.path) {
(Some(b), _) => Some(photocraft_io::raw::tone_curve(b)),
#[cfg(not(target_arch = "wasm32"))]
@@ -472,8 +497,10 @@ pub struct Redevelop {
params: CameraRaw,
raw: RawOpen,
/// The job is the final Camera Raw step (`filter.cameraRaw`), not the re-develop: when it
/// lands the document is marked unmodified.
/// lands the Camera Raw Defaults' conversions follow and the document is marked unmodified.
filter_step: bool,
/// The Camera Raw Defaults the open started with, for the conversions after the filter step.
defaults: photocraft_engine::prefs::RawDefaults,
}
/// The sliders a raw open applies while developing, before the tone curve (as Camera Raw does).
@@ -487,8 +514,9 @@ fn raw_stage(p: &CameraRaw) -> photocraft_io::raw::Tone {
/// on) it runs as a job like the open itself: the reply is `{"job", "pending": true}`, the
/// document is locked meanwhile, and [`on_redevelop_event`] finishes when it lands. Elsewhere
/// (tests, the web) it runs inline.
fn commit_open_raw(app: &mut PhotocraftApp, params: &CameraRaw, raw: &RawOpen) -> Result<Value, String> {
fn commit_open_raw(app: &mut PhotocraftApp, params: &CameraRaw, raw: &RawOpen, loaded: Option<&CameraRaw>) -> Result<Value, String> {
let index = document_index(app, raw.document).ok_or("the raw document was closed")?;
write_sidecar(app, raw, params, loaded);
let tuning = photocraft_io::raw::RawTuning {
temperature: params.temperature,
tint: params.tint,
@@ -510,7 +538,8 @@ fn commit_open_raw(app: &mut PhotocraftApp, params: &CameraRaw, raw: &RawOpen) -
_ => None,
};
let Some(source) = source.filter(|_| tuning != as_opened) else {
return finish_open_raw(app, index, params.clone(), None, Some(raw));
let defaults = app.session.prefs().raw_defaults.clone();
return finish_open_raw(app, index, params.clone(), None, raw, &defaults);
};
app.session.set_active(index);
let (name, doc_id) = (raw.name.clone(), raw.document);
@@ -538,9 +567,13 @@ fn commit_open_raw(app: &mut PhotocraftApp, params: &CameraRaw, raw: &RawOpen) -
photocraft_engine::jobs::Started::Done(v)
};
match started {
photocraft_engine::jobs::Started::Done(v) => finish_redevelop(app, params, raw, &v),
photocraft_engine::jobs::Started::Done(v) => {
let defaults = app.session.prefs().raw_defaults.clone();
finish_redevelop(app, params, raw, &v, &defaults)
}
photocraft_engine::jobs::Started::Job(job) => {
app.raw_redevelop = Some(Redevelop { job, params: params.clone(), raw: raw.clone(), filter_step: false });
let defaults = app.session.prefs().raw_defaults.clone();
app.raw_redevelop.push(Redevelop { job, params: params.clone(), raw: raw.clone(), filter_step: false, defaults });
app.ui.status = label;
app.ui.status_error = false;
Ok(json!({"job": job.0, "pending": true}))
@@ -577,7 +610,13 @@ fn replace_raw_document(
/// After the re-develop: keep the old document's view (zoom, scroll) on the new one, report
/// the import's notes, then apply the remaining settings.
fn finish_redevelop(app: &mut PhotocraftApp, params: &CameraRaw, raw: &RawOpen, v: &Value) -> Result<Value, String> {
fn finish_redevelop(
app: &mut PhotocraftApp,
params: &CameraRaw,
raw: &RawOpen,
v: &Value,
defaults: &photocraft_engine::prefs::RawDefaults,
) -> Result<Value, String> {
// A preceding completion (for example Save and Close) may have shifted the tab indices.
// Validate identity before remapping views, filtering or marking any document unmodified.
let replacement = v.get("docId").and_then(Value::as_u64).map(photocraft_doc::DocId).ok_or("the re-develop returned no document identity")?;
@@ -599,32 +638,254 @@ fn finish_redevelop(app: &mut PhotocraftApp, params: &CameraRaw, raw: &RawOpen,
rest.temperature = 0.0;
rest.tint = 0.0;
}
finish_open_raw(app, index, rest, Some(true), Some(raw))
finish_open_raw(app, index, rest, Some(true), raw, defaults)
}
/// The other settings as one Camera Raw step on document `index`, then the document is marked
/// unmodified (developing is part of opening). The step runs like any filter (in the
/// background in the desktop app); the document is marked unmodified when it lands.
fn finish_open_raw(app: &mut PhotocraftApp, index: usize, rest: CameraRaw, redeveloped: Option<bool>, raw: Option<&RawOpen>) -> Result<Value, String> {
/// The other settings as one Camera Raw step on document `index`, then the Camera Raw Defaults'
/// conversions, then the document is marked unmodified (developing is part of opening). The
/// step runs like any filter (in the background in the desktop app); the conversions follow and
/// the document is marked unmodified when it lands. The step works on the developed ProPhoto
/// pixels the dialog previewed, and the conversion to the workflow space comes last, as in
/// Camera Raw.
fn finish_open_raw(
app: &mut PhotocraftApp,
index: usize,
mut rest: CameraRaw,
redeveloped: Option<bool>,
raw: &RawOpen,
d: &photocraft_engine::prefs::RawDefaults,
) -> Result<Value, String> {
app.session.set_active(index);
app.sync_views();
let mut result = json!({"document": index, "redeveloped": redeveloped.unwrap_or(false)});
let mut applied = output_sharpening(d, &mut rest);
applied.extend(raw_conversions(d));
if !applied.is_empty() {
result["defaults"] = json!(applied);
}
if !rest.is_identity() {
let layer = app.session.active().and_then(|st| st.active_layer).ok_or("no layer to develop")?;
let mut p = non_defaults(&rest);
p["layer"] = json!(layer.0);
let r = app.run("filter.cameraRaw", p)?;
if r.get("pending").and_then(Value::as_bool) == Some(true)
&& let (Some(job), Some(raw)) = (r.get("job").and_then(Value::as_u64), raw)
&& let Some(job) = r.get("job").and_then(Value::as_u64)
{
app.raw_redevelop = Some(Redevelop { job: photocraft_engine::jobs::JobId(job), params: rest.clone(), raw: raw.clone(), filter_step: true });
let job = photocraft_engine::jobs::JobId(job);
app.raw_redevelop.push(Redevelop { job, params: rest.clone(), raw: raw.clone(), filter_step: true, defaults: d.clone() });
result["filter"] = r;
mark_unmodified(app, index);
return Ok(result);
}
result["filter"] = r;
}
// The Camera Raw step has landed: a failed conversion is reported, and the open still
// completes (a second Open would apply the step twice).
if let Err(e) = apply_raw_conversions(app, index, d) {
crate::notices::error(app, format!("{}: {e}", raw.name));
}
mark_unmodified(app, index);
Ok(result)
}
/// The sidecar beside a raw file: `IMG_0001.xmp` for `IMG_0001.CR2`, as Camera Raw names it.
pub fn sidecar_path(path: &str) -> String {
match path.rsplit_once('.') {
Some((stem, ext)) if !ext.contains(['/', '\\']) => format!("{stem}.xmp"),
_ => format!("{path}.xmp"),
}
}
/// A DNG carries its settings inside the file in Camera Raw; a sidecar is read for one too,
/// but never written beside it.
fn is_dng(path: &str) -> bool {
path.rsplit_once('.').is_some_and(|(_, ext)| ext.eq_ignore_ascii_case("dng"))
}
/// The settings of the sidecar beside `path`, when there is one that parses: the settings, what
/// the loader skipped, and the sidecar's file name. A sidecar that doesn't parse is ignored (the
/// raw still opens) and reported in the log.
#[cfg(not(target_arch = "wasm32"))]
fn read_sidecar(path: &str) -> Option<(CameraRaw, photocraft_io::camera_raw_xmp::LoadReport, String)> {
let sidecar = sidecar_path(path);
let Some(bytes) = read_bounded(&sidecar) else {
log::warn!("{sidecar}: not a readable sidecar of at most {} bytes, ignored", photocraft_io::camera_raw_xmp::MAX_XMP_BYTES);
return None;
};
let mut params = CameraRaw::default();
match photocraft_io::camera_raw_xmp::load(&mut params, &bytes) {
Ok(report) => Some((params, report, crate::file_open::display_name(&sidecar))),
Err(e) => {
log::warn!("{sidecar}: sidecar ignored: {e}");
None
}
}
}
#[cfg(target_arch = "wasm32")]
fn read_sidecar(_: &str) -> Option<(CameraRaw, photocraft_io::camera_raw_xmp::LoadReport, String)> {
None
}
/// Keep the develop settings beside the raw file (Camera Raw Defaults › Write xmp sidecars):
/// written when the settings aren't the defaults or PhotoCraft's own sidecar is there, so a
/// file reopens as it was developed. `loaded` are the settings the open started from: nothing
/// is written when they didn't change. Not for DNGs, never over a sidecar another application
/// wrote (Lightroom's and Bridge's hold crops, masks, ratings and keywords PhotoCraft can't keep),
/// never for a control or MCP request (it has no authority to write beside the user's files), and
/// never fatal: a folder that can't be written to is reported in a notice.
fn write_sidecar(app: &mut PhotocraftApp, raw: &RawOpen, params: &CameraRaw, loaded: Option<&CameraRaw>) {
if !app.session.prefs().raw_defaults.write_xmp_sidecars || loaded == Some(params) {
return;
}
if app.automation_input || app.session.authorize.is_some() {
log::info!("{}: sidecar not written for an automation request", raw.name);
return;
}
let Some(path) = raw.path.as_deref().filter(|p| !is_dng(p)) else { return };
let sidecar = sidecar_path(path);
let name = crate::file_open::display_name(&sidecar);
match existing_sidecar_is_ours(&sidecar) {
Some(false) => {
let kept = crate::i18n::fmt(tl!("Kept {name}: written by another application"), &[("name", &name)]);
crate::notices::post(app, kept, Vec::new(), false, None);
return;
}
None if params.is_identity() => return,
_ => {}
}
let bytes = photocraft_io::camera_raw_xmp::save(params).into_bytes();
let Some(write) = app.services.write.as_mut() else { return };
if let Err(e) = write(&sidecar, &bytes) {
crate::notices::error(app, crate::i18n::fmt(tl!("Could not write {name}: {error}"), &[("name", &name), ("error", &e)]));
}
}
/// `None` when there is no sidecar at `sidecar`, else whether PhotoCraft wrote it. One that
/// can't be read or is too large to be ours counts as another application's.
#[cfg(not(target_arch = "wasm32"))]
fn existing_sidecar_is_ours(sidecar: &str) -> Option<bool> {
std::fs::symlink_metadata(sidecar).ok()?;
Some(read_bounded(sidecar).is_some_and(|b| photocraft_io::camera_raw_xmp::is_photocraft_xmp(&b)))
}
/// The bytes of the regular file at `path` when it holds at most
/// [`photocraft_io::camera_raw_xmp::MAX_XMP_BYTES`]; `None` for anything else (missing, a folder,
/// a pipe or device that might never end, larger). Never reads more than the cap plus one byte.
#[cfg(not(target_arch = "wasm32"))]
fn read_bounded(path: &str) -> Option<Vec<u8>> {
use std::io::Read;
let cap = photocraft_io::camera_raw_xmp::MAX_XMP_BYTES;
// Checked before opening: opening a pipe for reading waits for a writer.
if !std::fs::metadata(path).ok()?.is_file() {
return None;
}
let file = std::fs::File::open(path).ok()?;
let mut bytes = Vec::new();
file.take(cap as u64 + 1).read_to_end(&mut bytes).ok()?;
(bytes.len() <= cap).then_some(bytes)
}
#[cfg(target_arch = "wasm32")]
fn existing_sidecar_is_ours(_: &str) -> Option<bool> {
None
}
/// Camera Raw Defaults › Sharpen For: output sharpening, folded into the Camera Raw step `rest`
/// as the workflow's Sharpen For is. Returns what it applied.
fn output_sharpening(d: &photocraft_engine::prefs::RawDefaults, rest: &mut CameraRaw) -> Vec<&'static str> {
match d.sharpen_for.preset() {
Some((amount, radius)) if rest.sharpen_amount == 0.0 => {
rest.sharpen_amount = amount;
rest.sharpen_radius = radius;
vec!["sharpenFor"]
}
_ => Vec::new(),
}
}
/// The Camera Raw Defaults [`apply_raw_conversions`] applies. Resolution is not among them: the
/// open itself sets it (`file_cmds::raw_defaults`), and a re-develop keeps it.
fn raw_conversions(d: &photocraft_engine::prefs::RawDefaults) -> Vec<&'static str> {
use photocraft_engine::prefs::{RawColorSpace, RawDepth};
let mut out = Vec::new();
// Raws develop into ProPhoto-compatible RGB (`photocraft_io::raw`); the other spaces are a
// conversion.
if d.color_space != RawColorSpace::ProPhoto {
out.push("colorSpace");
}
if d.bit_depth == RawDepth::Eight {
out.push("bitDepth");
}
if d.open_as_smart_object {
out.push("openAsSmartObject");
}
out
}
/// Camera Raw Defaults (Preferences) after the Camera Raw step: the colour space and bit depth
/// the developed document opens in, and Open as Smart Object.
fn apply_raw_conversions(app: &mut PhotocraftApp, index: usize, d: &photocraft_engine::prefs::RawDefaults) -> Result<(), String> {
app.session.set_active(index);
for step in raw_conversions(d) {
let (id, params) = match step {
"colorSpace" => ("edit.convertToProfile", json!({"profile": d.color_space.profile_id(), "intent": "relative"})),
"bitDepth" => ("image.mode.bits8", json!({})),
_ => ("layer.smartObjects.convertToSmartObject", json!({})),
};
app.session.execute(id, params).map_err(|e| e.to_string())?;
}
Ok(())
}
/// A raw that opened without the dialog (Camera Raw Defaults › Open in Camera Raw off): its
/// sidecar's settings develop it as the dialog's Open would, and the Camera Raw Defaults apply.
/// `warnings` are the import's; only a developed raw qualifies.
pub fn opened_without_dialog(app: &mut PhotocraftApp, index: usize, name: &str, path: Option<&str>, warnings: &[String]) {
if !warnings.iter().any(|w| w.contains(photocraft_io::raw::DEVELOPED_NOTE)) {
return;
}
let Some(document) = app.session.documents().get(index).map(|st| st.doc.id) else { return };
let method = photocraft_io::raw::developed_demosaic(warnings).unwrap_or_else(|| app.session.prefs().raw_defaults.demosaic.method());
let raw = RawOpen { document, name: name.to_string(), path: path.map(str::to_string), bytes: None, developed_with: method, demosaic: method };
let mut params = CameraRaw::default();
let sidecar = path.and_then(read_sidecar).map(|(loaded, _, _)| loaded);
if let Some(loaded) = &sidecar {
params = loaded.clone();
} else if app.session.prefs().raw_defaults.apply_auto_tone
&& let Some(px) = app.session.active().and_then(|st| st.doc.layer(st.active_layer?)).and_then(|l| l.surface()).map(|s| sample_pixels(s, 512))
{
photocraft_algo::camera_raw::auto_tone(&px, &mut params);
}
let r = if params.is_identity() {
let defaults = app.session.prefs().raw_defaults.clone();
finish_open_raw(app, index, params, None, &raw, &defaults)
} else {
commit_open_raw(app, &params, &raw, sidecar.as_ref())
};
if let Err(e) = r {
app.ui.status = e;
app.ui.status_error = true;
}
}
/// Every k-th pixel of a surface's content, k chosen so the longer side has about `max_side`
/// samples: enough for a histogram (Auto tone) without reading a whole raw.
fn sample_pixels(surf: &photocraft_raster::Surface, max_side: usize) -> Vec<[f32; 4]> {
let area = surf.content_bounds();
let (w, h) = (area.x1.saturating_sub(area.x0).max(0) as usize, area.y1.saturating_sub(area.y0).max(0) as usize);
if w == 0 || h == 0 {
return Vec::new();
}
let k = w.max(h).div_ceil(max_side.max(1)).max(1);
let mut out = Vec::with_capacity(w.div_ceil(k) * h.div_ceil(k));
let mut row = vec![[0.0f32; 4]; w];
for y in (0..h).step_by(k) {
let yy = area.y0.saturating_add(y as i32);
surf.read_rgba_into(Rect::new(area.x0, yy, area.x1, yy.saturating_add(1)), &mut row);
out.extend(row.iter().step_by(k).copied());
}
out
}
fn mark_unmodified(app: &mut PhotocraftApp, index: usize) {
let active = app.session.active_index();
app.session.set_active(index);
@@ -640,18 +901,29 @@ fn mark_unmodified(app: &mut PhotocraftApp, index: usize) {
/// A finished background re-develop ([`REDEVELOP_JOB`]) or open-time Camera Raw step. `true`
/// when the event was one of those (handled here).
pub fn on_redevelop_event(app: &mut PhotocraftApp, e: &photocraft_engine::jobs::JobEvent) -> bool {
let Some(pending) = app.raw_redevelop.take_if(|r| r.job == e.id) else { return false };
let Some(at) = app.raw_redevelop.iter().position(|r| r.job == e.id) else { return false };
let pending = app.raw_redevelop.remove(at);
if pending.filter_step {
if matches!(e.outcome, photocraft_engine::jobs::JobOutcome::Done(_))
&& let Some(index) = e.document.and_then(|id| document_index(app, id))
{
mark_unmodified(app, index);
// The Camera Raw Defaults' conversions follow the Camera Raw step, whatever its outcome:
// the document still opens in the workflow's colour space and depth.
if let Some(index) = e.document.and_then(|id| document_index(app, id)) {
let active = app.session.active_index();
if let Err(err) = apply_raw_conversions(app, index, &pending.defaults) {
crate::notices::error(app, format!("{}: {err}", pending.raw.name));
}
if let Some(i) = active {
app.session.set_active(i);
}
if matches!(e.outcome, photocraft_engine::jobs::JobOutcome::Done(_)) {
mark_unmodified(app, index);
}
app.sync_views();
}
// The usual filter reporting still applies.
return false;
}
match &e.outcome {
photocraft_engine::jobs::JobOutcome::Done(v) => match finish_redevelop(app, &pending.params, &pending.raw, v) {
photocraft_engine::jobs::JobOutcome::Done(v) => match finish_redevelop(app, &pending.params, &pending.raw, v, &pending.defaults) {
Ok(_) => {
app.ui.status = crate::i18n::fmt(tl!("Opened {name}"), &[("name", &pending.raw.name)]);
app.ui.status_error = false;
@@ -894,8 +1166,8 @@ pub fn menu(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, params: &Val
for (key, value) in fields {
match key.as_str() {
"set" | "scope" | "view" | "demosaic" => {}
"before" | "commit" | "cancel" | "saveSettings" | "loadSettings" | "undo" | "redo" if value.is_boolean() => {}
"before" | "commit" | "cancel" | "saveSettings" | "loadSettings" | "undo" | "redo" => {
"before" | "commit" | "cancel" | "saveSettings" | "loadSettings" | "undo" | "redo" | "auto" if value.is_boolean() => {}
"before" | "commit" | "cancel" | "saveSettings" | "loadSettings" | "undo" | "redo" | "auto" => {
return Some(Err(format!("Camera Raw {key} must be a boolean")));
}
_ => return Some(Err(format!("unknown Camera Raw ui property {key}"))),
@@ -932,6 +1204,10 @@ fn menu_update(app: &mut PhotocraftApp, ctx: &egui::Context, ui: &Value) -> Opti
// occurs until every part of the request has passed validation.
let d = app.camera_raw.as_ref()?;
let mut next_params = d.params.clone();
// Auto (the Light panel's button): the tone sliders from the image's histogram.
if ui.get("auto").and_then(Value::as_bool) == Some(true) {
photocraft_algo::camera_raw::auto_tone(&d.proxy, &mut next_params);
}
if let Some(set) = ui.get("set") {
if !set.is_object() {
return Some(Err("bad Camera Raw settings: expected an object".into()));
@@ -1135,8 +1411,8 @@ fn commit(app: &mut PhotocraftApp) -> Result<Value, String> {
}
Target::OpenRaw => {
let raw = d.raw_open.clone().ok_or("no raw file is being opened")?;
let params = d.params.clone();
commit_open_raw(app, &params, &raw)?
let (params, original) = (d.params.clone(), d.original.clone());
commit_open_raw(app, &params, &raw, Some(&original))?
}
};
app.camera_raw = None;
@@ -1391,9 +1667,16 @@ fn draw(app: &mut PhotocraftApp, ctx: &egui::Context, own_window: bool) {
egui::ScrollArea::vertical().id_salt("camera-raw-props").show(&mut props, |ui| {
ui.spacing_mut().item_spacing.y = 4.0;
let p = &mut d.params;
let proxy = &d.proxy;
let alt = &mut d.scope.alt_tone;
let (ts, tn) = (temp_stops(), tint_stops());
section(ui, "Light", true, |ui| {
// Auto: Camera Raw's one-click tone from the histogram; the sliders show what it
// chose, so each can be adjusted afterwards.
if ui.button(tl!("Auto")).on_hover_text(tl!("Set the tone sliders from the image")).clicked() {
photocraft_algo::camera_raw::auto_tone(proxy, p);
dirty = true;
}
tone_row(ui, &mut dirty, alt, ToneZone::Exposure, &mut p.exposure);
row(ui, &mut dirty, "Contrast", &mut p.contrast, -100.0..=100.0, None);
tone_row(ui, &mut dirty, alt, ToneZone::Highlights, &mut p.highlights);
@@ -1491,6 +1774,19 @@ fn draw(app: &mut PhotocraftApp, ctx: &egui::Context, own_window: bool) {
row(ui, &mut dirty, "Color", &mut p.noise_color, 0.0..=100.0, None);
row(ui, &mut dirty, "Color Detail", &mut p.noise_color_detail, 0.0..=100.0, None);
});
// Camera Raw's Calibration panel: a tint for the shadows and each primary's hue and
// saturation (Process Version is implied: 2012 and later).
section(ui, "Calibration", false, |ui| {
widgets::section_label(ui, tl!("Shadows"));
row(ui, &mut dirty, "Tint", &mut p.shadow_tint, -100.0..=100.0, Some(&tn));
for (i, name) in ["Red Primary", "Green Primary", "Blue Primary"].iter().enumerate() {
widgets::section_label(ui, crate::i18n::tr_ctx(crate::i18n::current(), "cameraRaw", name));
ui.push_id(name, |ui| {
row(ui, &mut dirty, "Hue", &mut p.calibration_hue[i], -100.0..=100.0, None);
row(ui, &mut dirty, "Saturation", &mut p.calibration_sat[i], -100.0..=100.0, None);
});
}
});
});
super::camera_raw_scope_ui::floating(ctx, d, scope, right);
super::camera_raw_scope_ui::shortcuts(ctx, scope);
@@ -1889,7 +2185,11 @@ mod tests {
let (w, h) = (48, 32);
let mut spec = DngSpec::cfa(w, h, mosaic(&scene(w, h), w, [0, 1, 1, 2], 0, 30000));
spec.as_shot_neutral = Some([0.5, 1.0, 0.7]);
(PhotocraftApp::new(photocraft_engine::Session::new(), services), spec.build())
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), services);
// The pixel comparisons below read the developed ProPhoto values: no conversion on open
// (Camera Raw Defaults › Color space is Adobe RGB otherwise).
app.run("prefs.set", json!({"path": "rawDefaults.colorSpace", "value": "proPhoto"})).unwrap();
(app, spec.build())
}
fn mean_red(app: &PhotocraftApp) -> f32 {
@@ -2039,12 +2339,12 @@ mod tests {
assert!(app.camera_raw.is_none());
for _ in 0..3000 {
crate::jobs_ui::tick(&mut app, &ctx);
if app.raw_redevelop.is_none() && !app.session.has_jobs() {
if app.raw_redevelop.is_empty() && !app.session.has_jobs() {
break;
}
std::thread::sleep(std::time::Duration::from_millis(5));
}
assert!(app.raw_redevelop.is_none() && !app.session.has_jobs(), "the jobs never finished");
assert!(app.raw_redevelop.is_empty() && !app.session.has_jobs(), "the jobs never finished");
let docs = app.session.documents();
assert_eq!(docs.len(), 3);
assert_eq!((docs[0].doc.size.width, docs[2].doc.size.width), (10, 12), "the other tabs keep their places");
@@ -2090,7 +2390,8 @@ mod tests {
let raw = app.pending_raw_open.take().unwrap();
open_raw(&mut app, &ctx, raw).unwrap();
let r = menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"commit": true}})).unwrap().unwrap();
assert_eq!(r, json!({"document": 0, "redeveloped": false}));
assert_eq!((r["document"].as_u64(), r["redeveloped"].as_bool(), r.get("filter")), (Some(0), Some(false), None), "{r}");
assert_eq!(r.get("defaults"), None, "ProPhoto, 16-bit: no Camera Raw Default to apply: {r}");
// Preference off: raws open straight away.
app.run("prefs.set", json!({"path": "rawDefaults.openInCameraRaw", "value": false})).unwrap();
app.open_bytes("c.dng", &dng).unwrap();
@@ -2113,6 +2414,400 @@ mod tests {
);
}
#[test]
fn calibration_changes_the_preview_and_round_trips_through_xmp() {
let (mut app, dng) = raw_app();
let ctx = egui::Context::default();
app.open_bytes("IMG_0005.dng", &dng).unwrap();
let raw = app.pending_raw_open.take().unwrap();
open_raw(&mut app, &ctx, raw).unwrap();
let before = app.camera_raw.as_ref().unwrap().processed.clone();
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"set": {"shadowTint": 100, "calibrationHue": [100, 0, 0], "calibrationSat": [0, 0, -100]}}}))
.unwrap()
.unwrap();
let d = app.camera_raw.as_mut().unwrap();
d.render(&ctx);
assert!(
d.processed.iter().zip(&before).any(|(a, b)| (a[0] - b[0]).abs() > 0.01 || (a[1] - b[1]).abs() > 0.01),
"the Calibration panel changes the preview"
);
let xmp = photocraft_io::camera_raw_xmp::save(&d.params);
assert!(xmp.contains("crs:ShadowTint=\"+100\"") && xmp.contains("crs:RedHue=\"+100\"") && xmp.contains("crs:BlueSaturation=\"-100\""), "{xmp}");
let mut back = CameraRaw::default();
photocraft_io::camera_raw_xmp::load(&mut back, xmp.as_bytes()).unwrap();
assert_eq!((back.shadow_tint, back.calibration_hue, back.calibration_sat), (100.0, [100.0, 0.0, 0.0], [0.0, 0.0, -100.0]));
assert!(menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"auto": "yes"}})).unwrap().is_err(), "auto must be a boolean");
}
#[test]
fn auto_sets_the_light_sliders_from_the_image() {
let (mut app, dng) = raw_app();
let ctx = egui::Context::default();
app.open_bytes("IMG_0006.dng", &dng).unwrap();
let raw = app.pending_raw_open.take().unwrap();
open_raw(&mut app, &ctx, raw).unwrap();
assert!(app.camera_raw.as_ref().unwrap().params.is_identity());
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"auto": true}})).unwrap().unwrap();
let p = app.camera_raw.as_ref().unwrap().params.clone();
assert!(!p.is_identity(), "Auto chose something: {p:?}");
assert!(p.saturation == 0.0 && p.hsl_hue == [0.0; 8], "only the Light panel: {p:?}");
// The preference does the same when a raw opens without a sidecar.
app.run("prefs.set", json!({"path": "rawDefaults.applyAutoTone", "value": true})).unwrap();
app.open_bytes("IMG_0007.dng", &dng).unwrap();
let raw = app.pending_raw_open.take().unwrap();
open_raw(&mut app, &ctx, raw).unwrap();
assert_eq!(app.camera_raw.as_ref().unwrap().params, p, "Apply auto tone opens the dialog with Auto's settings");
}
#[test]
fn a_sidecar_fills_the_dialog_and_open_writes_it_back() {
use std::sync::{Arc, Mutex};
let (mut app, dng) = raw_app();
let dir = std::env::temp_dir().join(format!("photocraft-sidecar-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
let raw_path = dir.join("IMG_0008.cr2").to_string_lossy().into_owned();
std::fs::write(&raw_path, &dng).unwrap();
assert_eq!(sidecar_path(&raw_path), dir.join("IMG_0008.xmp").to_string_lossy());
assert_eq!(sidecar_path("/a/b.c/noext"), "/a/b.c/noext.xmp");
std::fs::write(
sidecar_path(&raw_path),
"<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"PhotoCraft\"><rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><rdf:Description xmlns:crs=\"http://ns.adobe.com/camera-raw-settings/1.0/\" crs:Exposure2012=\"+1.50\" crs:ShadowTint=\"20\" crs:Temperature=\"5500\"/></rdf:RDF></x:xmpmeta>",
)
.unwrap();
type Written = Arc<Mutex<Vec<(String, Vec<u8>)>>>;
let written: Written = Arc::default();
let sink = written.clone();
app.services.write = Some(Box::new(move |p: &str, b: &[u8]| {
sink.lock().unwrap().push((p.to_string(), b.to_vec()));
Ok(())
}));
let ctx = egui::Context::default();
app.open_bytes("IMG_0008.cr2", &dng).unwrap();
let mut raw = app.pending_raw_open.take().unwrap();
raw.path = Some(raw_path.clone());
open_raw(&mut app, &ctx, raw).unwrap();
let d = app.camera_raw.as_ref().unwrap();
assert_eq!((d.params.exposure, d.params.shadow_tint), (1.5, 20.0), "the sidecar fills the dialog");
assert!(
app.ui.status.contains("IMG_0008.xmp") && app.ui.status.contains("Temperature"),
"the absolute white balance is reported as not supported: {}",
app.ui.status
);
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"set": {"contrast": 15}}})).unwrap().unwrap();
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"commit": true}})).unwrap().unwrap();
let w = written.lock().unwrap().clone();
assert_eq!(w.len(), 1, "Open writes the sidecar once: {:?}", w.iter().map(|(p, _)| p).collect::<Vec<_>>());
assert_eq!(w[0].0, sidecar_path(&raw_path));
let text = String::from_utf8(w[0].1.clone()).unwrap();
assert!(text.contains("crs:Exposure2012=\"+1.50\"") && text.contains("crs:Contrast2012=\"+15\"") && text.contains("crs:ShadowTint=\"+20\""), "{text}");
// A DNG keeps its settings inside: no sidecar beside it. And the preference turns writing off.
written.lock().unwrap().clear();
let dng_path = dir.join("IMG_0009.dng").to_string_lossy().into_owned();
std::fs::write(&dng_path, &dng).unwrap();
app.open_bytes("IMG_0009.dng", &dng).unwrap();
let mut raw = app.pending_raw_open.take().unwrap();
raw.path = Some(dng_path);
open_raw(&mut app, &ctx, raw).unwrap();
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"set": {"contrast": 15}, "commit": true}})).unwrap().unwrap();
assert!(written.lock().unwrap().is_empty(), "no sidecar for a DNG");
app.run("prefs.set", json!({"path": "rawDefaults.writeXmpSidecars", "value": false})).unwrap();
app.open_bytes("IMG_0008.cr2", &dng).unwrap();
let mut raw = app.pending_raw_open.take().unwrap();
raw.path = Some(raw_path.clone());
open_raw(&mut app, &ctx, raw).unwrap();
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"set": {"contrast": 30}, "commit": true}})).unwrap().unwrap();
assert!(written.lock().unwrap().is_empty(), "the preference stops the write");
// Without the dialog, the sidecar still develops the file.
app.run("prefs.set", json!({"path": "rawDefaults.openInCameraRaw", "value": false})).unwrap();
let before = app.session.documents().len();
app.open_file(&raw_path, &dng).unwrap();
assert!(app.pending_raw_open.is_none());
assert_eq!(app.session.documents().len(), before + 1);
let st = app.session.active().unwrap();
assert_eq!(st.saved_revision, st.revision, "opening with a sidecar leaves the document unmodified");
assert!(mean_red(&app) > 0.0);
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn camera_raw_defaults_apply_when_a_raw_opens() {
let (mut app, dng) = raw_app();
app.run("prefs.set", json!({"values": {"rawDefaults.openInCameraRaw": false, "rawDefaults.colorSpace": "srgb", "rawDefaults.bitDepth": "8", "rawDefaults.resolution": 240.0, "rawDefaults.sharpenFor": "screen", "rawDefaults.openAsSmartObject": true}})).unwrap();
app.open_bytes("IMG_0010.dng", &dng).unwrap();
assert!(app.pending_raw_open.is_none());
let st = app.session.active().unwrap();
assert_eq!(st.doc.depth, photocraft_color::SampleType::U8, "Bit depth 8");
assert_eq!(st.doc.resolution_dpi, 240.0, "Resolution");
let profile = st.doc.icc_profile.as_deref().and_then(|p| photocraft_cms::Profile::parse(p).ok()).map(|p| p.description).unwrap_or_default();
assert!(profile.to_lowercase().contains("srgb"), "Color space: {profile}");
let layer = st.doc.layer(st.active_layer.unwrap()).unwrap();
assert!(matches!(layer.content, photocraft_doc::LayerContent::Smart(_)), "Open as Smart Object");
assert_eq!(st.saved_revision, st.revision, "the defaults are part of opening: unmodified");
// The dialog's Open applies them too, and reports what it applied.
app.run("prefs.set", json!({"values": {"rawDefaults.openInCameraRaw": true, "rawDefaults.openAsSmartObject": false, "rawDefaults.bitDepth": "16"}}))
.unwrap();
let ctx = egui::Context::default();
app.open_bytes("IMG_0011.dng", &dng).unwrap();
let raw = app.pending_raw_open.take().unwrap();
open_raw(&mut app, &ctx, raw).unwrap();
let r = menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"commit": true}})).unwrap().unwrap();
assert_eq!(r["defaults"], json!(["sharpenFor", "colorSpace"]), "{r}");
assert!(r.get("filter").is_some(), "Sharpen For is a Camera Raw step: {r}");
let st = app.session.active().unwrap();
assert_eq!(st.doc.depth, photocraft_color::SampleType::U16);
assert_eq!(st.saved_revision, st.revision);
}
type Written = std::sync::Arc<std::sync::Mutex<Vec<(String, Vec<u8>)>>>;
/// A sidecar as Lightroom Classic leaves one beside a raw: its own toolkit, a crop, a rating
/// and a keyword next to the develop settings (values synthetic).
const LIGHTROOM_SIDECAR: &str = r#"<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 7.0-c000 1.000000, 0000/00/00-00:00:00 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/"
xmp:Rating="4"
crs:Exposure2012="+1.00"
crs:Sharpness="40"
crs:HasCrop="True"
crs:CropTop="0.1">
<dc:subject><rdf:Bag><rdf:li>harbour</rdf:li></rdf:Bag></dc:subject>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
"#;
/// `raw_app` whose `write` service records what it is asked to write, and a raw file in a fresh
/// folder with `sidecar` beside it when given. Returns the app, the raw's bytes, the folder,
/// the raw's path and the recorded writes.
fn raw_with_sidecar(tag: &str, sidecar: Option<&str>) -> (PhotocraftApp, Vec<u8>, std::path::PathBuf, String, Written) {
let (mut app, dng) = raw_app();
let dir = std::env::temp_dir().join(format!("photocraft-sidecar-{tag}-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
let raw_path = dir.join("IMG_0100.cr2").to_string_lossy().into_owned();
std::fs::write(&raw_path, &dng).unwrap();
if let Some(text) = sidecar {
std::fs::write(sidecar_path(&raw_path), text).unwrap();
}
let written: Written = Default::default();
let sink = written.clone();
app.services.write = Some(Box::new(move |p: &str, b: &[u8]| {
sink.lock().unwrap().push((p.to_string(), b.to_vec()));
Ok(())
}));
(app, dng, dir, raw_path, written)
}
/// Opens the raw at `raw_path` in the open-time dialog, as File › Open does.
fn open_dialog_at(app: &mut PhotocraftApp, ctx: &egui::Context, dng: &[u8], raw_path: &str) {
app.open_bytes("IMG_0100.cr2", dng).unwrap();
let mut raw = app.pending_raw_open.take().unwrap();
raw.path = Some(raw_path.to_string());
open_raw(app, ctx, raw).unwrap();
}
/// The notices about the sidecar (the open's own import notes aside).
fn notice_titles(app: &PhotocraftApp) -> Vec<String> {
app.ui.notices.iter().map(|n| n.title.clone()).filter(|t| t.contains(".xmp")).collect()
}
/// A Lightroom or Bridge sidecar holds settings PhotoCraft can't keep (crop, masks, rating,
/// keywords): Open uses its develop settings but never writes over it, and says so.
#[test]
fn a_foreign_sidecar_is_never_overwritten() {
let (mut app, dng, dir, raw_path, written) = raw_with_sidecar("foreign", Some(LIGHTROOM_SIDECAR));
let ctx = egui::Context::default();
open_dialog_at(&mut app, &ctx, &dng, &raw_path);
assert_eq!(app.camera_raw.as_ref().unwrap().params.exposure, 1.0, "the sidecar's settings fill the dialog");
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"set": {"contrast": 15}}})).unwrap().unwrap();
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"commit": true}})).unwrap().unwrap();
assert!(written.lock().unwrap().is_empty(), "nothing written over Lightroom's sidecar");
assert_eq!(std::fs::read_to_string(sidecar_path(&raw_path)).unwrap(), LIGHTROOM_SIDECAR);
let titles = notice_titles(&app);
assert!(titles.iter().any(|t| t.contains("IMG_0100.xmp") && t.contains("another application")), "{titles:?}");
let _ = std::fs::remove_dir_all(&dir);
}
/// Bridge writes a sidecar with only a rating (no Camera Raw settings): it is not PhotoCraft's
/// to replace, with or without a change in the dialog.
#[test]
fn a_rating_only_sidecar_is_left_alone() {
let bridge = r#"<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 7.0"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmp:Rating="5"/></rdf:RDF></x:xmpmeta>"#;
let (mut app, dng, dir, raw_path, written) = raw_with_sidecar("rating", Some(bridge));
let ctx = egui::Context::default();
open_dialog_at(&mut app, &ctx, &dng, &raw_path);
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"commit": true}})).unwrap().unwrap();
assert!(written.lock().unwrap().is_empty(), "Open with no change writes nothing");
assert!(notice_titles(&app).is_empty(), "and has nothing to report: {:?}", notice_titles(&app));
open_dialog_at(&mut app, &ctx, &dng, &raw_path);
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"set": {"contrast": 10}, "commit": true}})).unwrap().unwrap();
assert!(written.lock().unwrap().is_empty(), "nor with a change");
assert_eq!(std::fs::read_to_string(sidecar_path(&raw_path)).unwrap(), bridge);
let _ = std::fs::remove_dir_all(&dir);
}
/// With Open in Camera Raw off, opening a raw develops it with its sidecar and writes nothing
/// back: nothing changed.
#[test]
fn opening_without_the_dialog_does_not_rewrite_the_sidecar() {
let (mut app, dng, dir, raw_path, written) = raw_with_sidecar("nodialog", Some(LIGHTROOM_SIDECAR));
app.run("prefs.set", json!({"path": "rawDefaults.openInCameraRaw", "value": false})).unwrap();
app.open_file(&raw_path, &dng).unwrap();
assert!(app.pending_raw_open.is_none());
assert_eq!(app.session.documents().len(), 1);
assert!(written.lock().unwrap().is_empty(), "just opening never writes the sidecar");
assert_eq!(std::fs::read_to_string(sidecar_path(&raw_path)).unwrap(), LIGHTROOM_SIDECAR);
assert!(notice_titles(&app).is_empty(), "{:?}", notice_titles(&app));
let _ = std::fs::remove_dir_all(&dir);
}
/// A control or MCP request has no authority to write beside the user's files: its commit
/// develops the raw but writes no sidecar. The same Open from the dialog does.
#[test]
fn a_control_request_never_writes_the_sidecar() {
fn allow(_: &str, _: &Value) -> photocraft_engine::Result<()> {
Ok(())
}
let (mut app, dng, dir, raw_path, written) = raw_with_sidecar("control", None);
app.services.automation_authorize = Some(allow);
let ctx = egui::Context::default();
open_dialog_at(&mut app, &ctx, &dng, &raw_path);
let commit = json!({"id": "filter.cameraRaw", "params": {"ui": {"set": {"contrast": 15}, "commit": true}}});
let (req, _rx) = crate::control::ControlRequest::new("ui.menu.invoke", commit);
let crate::control::Outcome::Done(reply) = crate::control::handle(&mut app, &ctx, &req) else { panic!("expected a reply") };
assert_eq!(reply["ok"], true, "{reply}");
assert!(app.camera_raw.is_none(), "committed");
assert!(written.lock().unwrap().is_empty(), "no sidecar from a control request");
open_dialog_at(&mut app, &ctx, &dng, &raw_path);
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"set": {"contrast": 15}, "commit": true}})).unwrap().unwrap();
assert_eq!(written.lock().unwrap().len(), 1, "the user's own Open writes it");
let _ = std::fs::remove_dir_all(&dir);
}
/// A sidecar that can't be written is reported in a notice that outlasts the status line the
/// develop and the Camera Raw step write after it.
#[test]
fn a_sidecar_write_error_stays_reported() {
let (mut app, dng, dir, raw_path, _) = raw_with_sidecar("readonly", None);
app.services.write = Some(Box::new(|_: &str, _: &[u8]| Err("read-only volume".to_string())));
let ctx = egui::Context::default();
open_dialog_at(&mut app, &ctx, &dng, &raw_path);
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"set": {"exposure": 0.5, "contrast": 15}, "commit": true}})).unwrap().unwrap();
let errors: Vec<_> = app.ui.notices.iter().filter(|n| n.error).map(|n| n.title.clone()).collect();
assert!(errors.iter().any(|t| t.contains("IMG_0100.xmp") && t.contains("read-only volume")), "{errors:?}");
let _ = std::fs::remove_dir_all(&dir);
}
fn open_with_settings(app: &mut PhotocraftApp, ctx: &egui::Context, dng: &[u8], name: &str) {
app.open_bytes(name, dng).unwrap();
let raw = app.pending_raw_open.take().unwrap();
open_raw(app, ctx, raw).unwrap();
menu(app, ctx, "filter.cameraRaw", &json!({"ui": {"set": {"exposure": 0.5, "contrast": 60, "saturation": 40, "vibrance": 30}}})).unwrap().unwrap();
}
fn profile_name(app: &PhotocraftApp) -> String {
let st = app.session.active().unwrap();
st.doc.icc_profile.as_deref().and_then(|p| photocraft_cms::Profile::parse(p).ok()).map(|p| p.description).unwrap_or_default()
}
/// Camera Raw renders in its own space and converts to the workflow space last, so Open gives
/// what the dialog previewed on the developed ProPhoto pixels: with the default Adobe RGB the
/// result is the Camera Raw step on the ProPhoto develop, then the conversion. Inline and with
/// the re-develop as a background job.
#[test]
fn the_camera_raw_step_runs_before_the_workflow_conversion() {
let ctx = egui::Context::default();
let (mut app, dng) = raw_app();
open_with_settings(&mut app, &ctx, &dng, "a.dng");
menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"commit": true}})).unwrap().unwrap();
app.run("edit.convertToProfile", json!({"profile": "adobe-rgb-compat", "intent": "relative"})).unwrap();
let want = pixels(&app);
let close = |a: &[f32], b: &[f32]| a.len() == b.len() && a.iter().zip(b).all(|(x, y)| (x - y).abs() < 1e-5);
for background in [false, true] {
let (mut app, dng) = raw_app();
app.run("prefs.set", json!({"path": "rawDefaults.colorSpace", "value": "adobeRgb"})).unwrap();
open_with_settings(&mut app, &ctx, &dng, "b.dng");
app.background_jobs = background;
let r = menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"commit": true}})).unwrap().unwrap();
if background {
assert_eq!(r["pending"], true, "the re-develop runs as a job: {r}");
} else {
assert_eq!(r["defaults"], json!(["colorSpace"]), "{r}");
}
for _ in 0..3000 {
crate::jobs_ui::tick(&mut app, &ctx);
if app.raw_redevelop.is_empty() && !app.session.has_jobs() {
break;
}
std::thread::sleep(std::time::Duration::from_millis(5));
}
assert!(app.raw_redevelop.is_empty() && !app.session.has_jobs(), "the jobs never finished");
assert!(profile_name(&app).to_lowercase().contains("adobe"), "background {background}: {}", profile_name(&app));
assert!(close(&pixels(&app), &want), "background {background}: the step ran on other pixels than the preview");
let st = app.session.active().unwrap();
assert_eq!(st.saved_revision, st.revision, "background {background}: unmodified");
}
}
/// Two raws opened one after the other while the first one's re-develop still runs in the
/// background: each lands with its Camera Raw step and conversions and is left unmodified.
#[test]
fn two_raws_opened_back_to_back_both_finish_their_open() {
let ctx = egui::Context::default();
let (mut app, dng) = raw_app();
app.run("prefs.set", json!({"path": "rawDefaults.colorSpace", "value": "adobeRgb"})).unwrap();
open_with_settings(&mut app, &ctx, &dng, "a.dng");
app.background_jobs = true;
let a = menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"commit": true}})).unwrap().unwrap();
assert_eq!(a["pending"], true, "the re-develop runs as a job: {a}");
app.background_jobs = false;
open_with_settings(&mut app, &ctx, &dng, "b.dng");
app.background_jobs = true;
let b = menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"commit": true}})).unwrap().unwrap();
assert_eq!(b["pending"], true, "{b}");
for _ in 0..3000 {
crate::jobs_ui::tick(&mut app, &ctx);
if app.raw_redevelop.is_empty() && !app.session.has_jobs() {
break;
}
std::thread::sleep(std::time::Duration::from_millis(5));
}
assert!(app.raw_redevelop.is_empty() && !app.session.has_jobs(), "the jobs never finished");
assert_eq!(app.session.documents().len(), 2);
for i in 0..2 {
app.session.set_active(i);
assert!(profile_name(&app).to_lowercase().contains("adobe"), "document {i}: {}", profile_name(&app));
let st = app.session.active().unwrap();
assert_eq!(st.saved_revision, st.revision, "document {i} unmodified");
}
}
/// A sidecar is read only from a regular file of at most `MAX_XMP_BYTES`: a folder, or a file
/// one byte larger, is not read (a pipe or device named like one would never end).
#[test]
fn sidecars_are_read_from_small_regular_files_only() {
let dir = std::env::temp_dir().join(format!("photocraft-sidecar-bounded-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(dir.join("folder.xmp")).unwrap();
let cap = photocraft_io::camera_raw_xmp::MAX_XMP_BYTES;
let (fits, larger) = (dir.join("fits.xmp"), dir.join("larger.xmp"));
std::fs::write(&fits, vec![b' '; cap]).unwrap();
std::fs::write(&larger, vec![b' '; cap + 1]).unwrap();
let s = |p: std::path::PathBuf| p.to_string_lossy().into_owned();
assert_eq!(read_bounded(&s(fits)).map(|b| b.len()), Some(cap));
assert_eq!(read_bounded(&s(larger.clone())), None);
assert_eq!(read_bounded(&s(dir.join("folder.xmp"))), None);
assert_eq!(read_bounded(&s(dir.join("missing.xmp"))), None);
assert_eq!(existing_sidecar_is_ours(&s(dir.join("folder.xmp"))), Some(false), "something is there: never written over");
assert_eq!(existing_sidecar_is_ours(&s(larger)), Some(false));
assert_eq!(existing_sidecar_is_ours(&s(dir.join("missing.xmp"))), None);
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn save_and_load_settings_round_trip_through_xmp_files() {
use crate::file_dialog::FileDialogAnswer;
@@ -2121,7 +2816,7 @@ mod tests {
let written: Written = Arc::default();
let w = written.clone();
let foreign = br#"<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" crs:Clarity2012="+25" crs:RedHue="-5"/>
<rdf:Description xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" crs:Clarity2012="+25" crs:LensProfileEnable="1"/>
</rdf:RDF></x:xmpmeta>"#;
let answers = vec![
Some(FileDialogAnswer::SaveTo("/out/Look.xmp".into())),
+11
View File
@@ -3852,6 +3852,17 @@ navigator Zoom Zvětšení
Sent to {printer} Odesláno do {printer}
set in Print Settings… nastavuje se v nastavení tisku…
ICO is limited to 256 × 256 pixels ICO je omezen na 256 × 256 pixelů
Calibration Kalibrace
Red Primary Červená základní
Green Primary Zelená základní
Blue Primary Modrá základní
Write xmp sidecars Zapisovat přidružené soubory XMP
Set the tone sliders from the image Nastavit posuvníky tónů podle obrazu
Settings from {name} Nastavení z {name}
Settings from {name}; {count} not supported: {names} Nastavení z {name}; {count} nepodporováno: {names}
Could not write {name}: {error} Nelze zapsat {name}: {error}
Kept {name}: written by another application Soubor {name} ponechán: zapsala ho jiná aplikace
Shadow Tint Odstín stínů
# PhotoCraft release checks.
Check for Updates… Zkontrolovat aktualizace…
PhotoCraft Updates Aktualizace PhotoCraft
Can't render this file because it contains an unexpected character in line 6 and column 47.
+11
View File
@@ -3256,6 +3256,17 @@ curves Smooth Glätten
Sent to {printer} An {printer} gesendet
set in Print Settings… in den Druckeinstellungen festlegen…
ICO is limited to 256 × 256 pixels ICO ist auf 256 × 256 Pixel begrenzt
Calibration Kalibrierung
Red Primary Rot-Primärfarbe
Green Primary Grün-Primärfarbe
Blue Primary Blau-Primärfarbe
Write xmp sidecars XMP-Filialdateien schreiben
Set the tone sliders from the image Tonwert-Regler aus dem Bild setzen
Settings from {name} Einstellungen aus {name}
Settings from {name}; {count} not supported: {names} Einstellungen aus {name}; {count} nicht unterstützt: {names}
Could not write {name}: {error} {name} konnte nicht geschrieben werden: {error}
Kept {name}: written by another application {name} beibehalten: von einer anderen Anwendung geschrieben
Shadow Tint Schattentönung
# PhotoCraft release checks.
Check for Updates… Nach Updates suchen…
PhotoCraft Updates PhotoCraft-Updates
Can't render this file because it contains an unexpected character in line 6 and column 47.
+11
View File
@@ -3938,6 +3938,17 @@ curves Smooth Εξομάλυνση
Sent to {printer} Στάλθηκε στον {printer}
set in Print Settings… ορίζεται στις ρυθμίσεις εκτύπωσης…
ICO is limited to 256 × 256 pixels Το ICO περιορίζεται σε 256 × 256 εικονοστοιχεία
Calibration Βαθμονόμηση
Red Primary Κόκκινο πρωτεύον
Green Primary Πράσινο πρωτεύον
Blue Primary Μπλε πρωτεύον
Write xmp sidecars Εγγραφή συνοδευτικών αρχείων XMP
Set the tone sliders from the image Ορισμός των ρυθμιστικών τόνων από την εικόνα
Settings from {name} Ρυθμίσεις από {name}
Settings from {name}; {count} not supported: {names} Ρυθμίσεις από {name}· {count} δεν υποστηρίζονται: {names}
Could not write {name}: {error} Αδυναμία εγγραφής του {name}: {error}
Kept {name}: written by another application Το {name} διατηρήθηκε: γράφτηκε από άλλη εφαρμογή
Shadow Tint Χροιά σκιών
# PhotoCraft release checks.
Check for Updates… Έλεγχος ενημερώσεων…
PhotoCraft Updates Ενημερώσεις PhotoCraft
Can't render this file because it contains an unexpected character in line 1038 and column 18.
+11
View File
@@ -4201,6 +4201,17 @@ navigator Zoom Zoom
Sent to {printer} Enviado a {printer}
set in Print Settings… se establece en Ajustes de impresión…
ICO is limited to 256 × 256 pixels ICO está limitado a 256 × 256 píxeles
Calibration Calibración
Red Primary Primario rojo
Green Primary Primario verde
Blue Primary Primario azul
Write xmp sidecars Escribir archivos XMP auxiliares
Set the tone sliders from the image Ajustar los controles de tono a partir de la imagen
Settings from {name} Ajustes de {name}
Settings from {name}; {count} not supported: {names} Ajustes de {name}; {count} no compatibles: {names}
Could not write {name}: {error} No se pudo escribir {name}: {error}
Kept {name}: written by another application Se conservó {name}: lo escribió otra aplicación
Shadow Tint Tinte de sombras
# PhotoCraft release checks.
Check for Updates… Buscar actualizaciones…
PhotoCraft Updates Actualizaciones de PhotoCraft
Can't render this file because it contains an unexpected character in line 4 and column 47.
+11
View File
@@ -3248,6 +3248,17 @@ curves Smooth Lisser
Sent to {printer} Envoyé à {printer}
set in Print Settings… défini dans les paramètres d’impression…
ICO is limited to 256 × 256 pixels Le format ICO est limité à 256 × 256 pixels
Calibration Étalonnage
Red Primary Primaire rouge
Green Primary Primaire verte
Blue Primary Primaire bleue
Write xmp sidecars Écrire les fichiers annexes XMP
Set the tone sliders from the image Régler les curseurs de tonalité d’après l’image
Settings from {name} Réglages de {name}
Settings from {name}; {count} not supported: {names} Réglages de {name} ; {count} non pris en charge : {names}
Could not write {name}: {error} Impossible d’écrire {name} : {error}
Kept {name}: written by another application {name} conservé : écrit par une autre application
Shadow Tint Teinte des ombres
# PhotoCraft release checks.
Check for Updates… Rechercher des mises à jour…
PhotoCraft Updates Mises à jour de PhotoCraft
Can't render this file because it contains an unexpected character in line 6 and column 47.
+11
View File
@@ -4134,6 +4134,17 @@ cameraRaw Yellow Sárga
Color Indicates: A szín jelzése:
Ink Characteristics Festék jellemzői
Solidity: Fedőképesség:
Calibration Kalibrálás
Red Primary Vörös alapszín
Green Primary Zöld alapszín
Blue Primary Kék alapszín
Write xmp sidecars XMP kísérőfájlok írása
Set the tone sliders from the image Tónuscsúszkák beállítása a kép alapján
Settings from {name} Beállítások innen: {name}
Settings from {name}; {count} not supported: {names} Beállítások innen: {name}; {count} nem támogatott: {names}
Could not write {name}: {error} Nem sikerült írni: {name}: {error}
Kept {name}: written by another application {name} megtartva: egy másik alkalmazás írta
Shadow Tint Árnyék színezet
Redrawing Újrarajzolás
# Bevel & Emboss shading controls.
Highlight Mode Csúcsfény módja
Can't render this file because it contains an unexpected character in line 6 and column 47.
+11
View File
@@ -3252,6 +3252,17 @@ curves Smooth Haluskan
Sent to {printer} Dikirim ke {printer}
set in Print Settings… diatur di Pengaturan Cetak…
ICO is limited to 256 × 256 pixels ICO dibatasi hingga 256 × 256 piksel
Calibration Kalibrasi
Red Primary Primer merah
Green Primary Primer hijau
Blue Primary Primer biru
Write xmp sidecars Tulis berkas pendamping XMP
Set the tone sliders from the image Atur penggeser nada dari gambar
Settings from {name} Pengaturan dari {name}
Settings from {name}; {count} not supported: {names} Pengaturan dari {name}; {count} tidak didukung: {names}
Could not write {name}: {error} Tidak dapat menulis {name}: {error}
Kept {name}: written by another application {name} dipertahankan: ditulis oleh aplikasi lain
Shadow Tint Rona bayangan
# PhotoCraft release checks.
Check for Updates… Periksa Pembaruan…
PhotoCraft Updates Pembaruan PhotoCraft
Can't render this file because it contains an unexpected character in line 4 and column 47.
+11
View File
@@ -4204,6 +4204,17 @@ navigator Zoom Zoom
Sent to {printer} Inviato a {printer}
set in Print Settings… impostato nelle impostazioni di stampa…
ICO is limited to 256 × 256 pixels ICO è limitato a 256 × 256 pixel
Calibration Calibrazione
Red Primary Primario rosso
Green Primary Primario verde
Blue Primary Primario blu
Write xmp sidecars Scrivi file sidecar XMP
Set the tone sliders from the image Imposta i cursori dei toni dall’immagine
Settings from {name} Impostazioni da {name}
Settings from {name}; {count} not supported: {names} Impostazioni da {name}; {count} non supportate: {names}
Could not write {name}: {error} Impossibile scrivere {name}: {error}
Kept {name}: written by another application {name} mantenuto: scritto da un’altra applicazione
Shadow Tint Tinta ombre
# PhotoCraft release checks.
Check for Updates… Cerca aggiornamenti…
PhotoCraft Updates Aggiornamenti di PhotoCraft
Can't render this file because it contains an unexpected character in line 2401 and column 12.
+11
View File
@@ -3920,6 +3920,17 @@ curves Smooth スムーズ
Reset All Locked Settings ロックされた設定をすべて初期化
Copy Texture to Other Tools テクスチャを他のツールにコピー
ICO is limited to 256 × 256 pixels ICO は 256 × 256 ピクセルまでです
Calibration キャリブレーション
Red Primary レッド原色
Green Primary グリーン原色
Blue Primary ブルー原色
Write xmp sidecars XMP サイドカーファイルを書き込む
Set the tone sliders from the image 画像からトーンスライダーを設定
Settings from {name} {name} の設定
Settings from {name}; {count} not supported: {names} {name} の設定; {count} 件は未対応: {names}
Could not write {name}: {error} {name} を書き込めません: {error}
Kept {name}: written by another application {name} はそのままにしました: 別のアプリケーションが書き込んだファイルです
Shadow Tint シャドウの色かぶり補正
# PhotoCraft release checks.
Check for Updates… アップデートを確認…
PhotoCraft Updates PhotoCraft のアップデート
Can't render this file because it contains an unexpected character in line 6 and column 47.
+11
View File
@@ -3443,6 +3443,17 @@ curves Smooth 매끄럽게
Sent to {printer} {printer}(으)로 전송됨
set in Print Settings… 인쇄 설정에서 지정…
ICO is limited to 256 × 256 pixels ICO는 256 × 256픽셀로 제한됩니다
Calibration 보정
Red Primary 빨강 원색
Green Primary 녹색 원색
Blue Primary 파랑 원색
Write xmp sidecars XMP 사이드카 파일 쓰기
Set the tone sliders from the image 이미지에서 톤 슬라이더 설정
Settings from {name} {name}의 설정
Settings from {name}; {count} not supported: {names} {name}의 설정; {count}개 미지원: {names}
Could not write {name}: {error} {name}을(를) 쓸 수 없음: {error}
Kept {name}: written by another application {name}을(를) 유지함: 다른 응용 프로그램이 작성한 파일
Shadow Tint 그림자 색조
# PhotoCraft release checks.
Check for Updates… 업데이트 확인…
PhotoCraft Updates PhotoCraft 업데이트
Can't render this file because it contains an unexpected character in line 2948 and column 12.
+11
View File
@@ -4000,6 +4000,17 @@ curves Smooth Vloeiend maken
Sent to {printer} Verzonden naar {printer}
set in Print Settings… instellen in de afdrukinstellingen…
ICO is limited to 256 × 256 pixels ICO is beperkt tot 256 × 256 pixels
Calibration Kalibratie
Red Primary Primair rood
Green Primary Primair groen
Blue Primary Primair blauw
Write xmp sidecars XMP-sidecarbestanden schrijven
Set the tone sliders from the image Toonschuifregelaars instellen op basis van de afbeelding
Settings from {name} Instellingen uit {name}
Settings from {name}; {count} not supported: {names} Instellingen uit {name}; {count} niet ondersteund: {names}
Could not write {name}: {error} Kan {name} niet schrijven: {error}
Kept {name}: written by another application {name} behouden: geschreven door een andere toepassing
Shadow Tint Schaduwtint
# PhotoCraft release checks.
Check for Updates… Controleren op updates…
PhotoCraft Updates PhotoCraft-updates
Can't render this file because it contains an unexpected character in line 8 and column 34.
+11
View File
@@ -3856,6 +3856,17 @@ curves Smooth Wygładź
Sent to {printer} Wysłano do {printer}
set in Print Settings… ustawiane w ustawieniach druku…
ICO is limited to 256 × 256 pixels ICO jest ograniczony do 256 × 256 pikseli
Calibration Kalibracja
Red Primary Czerwień podstawowa
Green Primary Zieleń podstawowa
Blue Primary Niebieski podstawowy
Write xmp sidecars Zapisuj pliki poboczne XMP
Set the tone sliders from the image Ustaw suwaki tonów na podstawie obrazu
Settings from {name} Ustawienia z {name}
Settings from {name}; {count} not supported: {names} Ustawienia z {name}; nieobsługiwane: {count}: {names}
Could not write {name}: {error} Nie można zapisać {name}: {error}
Kept {name}: written by another application Zachowano {name}: zapisany przez inną aplikację
Shadow Tint Tinta cieni
# PhotoCraft release checks.
Check for Updates… Sprawdź aktualizacje…
PhotoCraft Updates Aktualizacje PhotoCraft
Can't render this file because it contains an unexpected character in line 6 and column 47.
+11
View File
@@ -4030,6 +4030,17 @@ layerLabel No Color Sem cor
Sent to {printer} Enviado para {printer}
set in Print Settings… definido nas configurações de impressão…
ICO is limited to 256 × 256 pixels ICO é limitado a 256 × 256 pixels
Calibration Calibração
Red Primary Primária vermelha
Green Primary Primária verde
Blue Primary Primária azul
Write xmp sidecars Gravar arquivos auxiliares XMP
Set the tone sliders from the image Definir os controles de tom a partir da imagem
Settings from {name} Configurações de {name}
Settings from {name}; {count} not supported: {names} Configurações de {name}; {count} sem suporte: {names}
Could not write {name}: {error} Não foi possível gravar {name}: {error}
Kept {name}: written by another application {name} mantido: gravado por outro aplicativo
Shadow Tint Matiz das sombras
# PhotoCraft release checks.
Check for Updates… Verificar atualizações…
PhotoCraft Updates Atualizações do PhotoCraft
Can't render this file because it contains an unexpected character in line 6 and column 47.
+11
View File
@@ -3194,6 +3194,17 @@ curves Smooth Сгладить
Sent to {printer} Отправлено на {printer}
set in Print Settings… задаётся в параметрах печати…
ICO is limited to 256 × 256 pixels ICO ограничен размером 256 × 256 пикселей
Calibration Калибровка
Red Primary Красный основной
Green Primary Зелёный основной
Blue Primary Синий основной
Write xmp sidecars Записывать сопутствующие файлы XMP
Set the tone sliders from the image Установить ползунки тона по изображению
Settings from {name} Настройки из {name}
Settings from {name}; {count} not supported: {names} Настройки из {name}; не поддерживается: {count}: {names}
Could not write {name}: {error} Не удалось записать {name}: {error}
Kept {name}: written by another application {name} сохранён без изменений: записан другим приложением
Shadow Tint Оттенок теней
# History panel › History Brush source (#2966)
Paints from the History panel's source state Рисует из исходного состояния панели «История»
Sets the source for the history brush Задаёт источник для кисти истории
Can't render this file because it contains an unexpected character in line 6 and column 47.
+11
View File
@@ -4268,6 +4268,17 @@ shape Appearance Izgled
Color Indicates: Boja označava:
Ink Characteristics Karakteristike mastila
Solidity: Punoća:
Calibration Kalibracija
Red Primary Crvena primarna
Green Primary Zelena primarna
Blue Primary Plava primarna
Write xmp sidecars Upisuj prateće XMP datoteke
Set the tone sliders from the image Postavi klizače tona prema slici
Settings from {name} Podešavanja iz {name}
Settings from {name}; {count} not supported: {names} Podešavanja iz {name}; {count} nije podržano: {names}
Could not write {name}: {error} Nije moguće upisati {name}: {error}
Kept {name}: written by another application {name} je zadržan: upisala ga je druga aplikacija
Shadow Tint Nijansa senki
Redrawing Ponovno iscrtavanje
# Bevel & Emboss shading controls.
Can't render this file because it contains an unexpected character in line 6 and column 47.
+11
View File
@@ -3946,6 +3946,17 @@ cameraData Lens Lens
Color Indicates: Rengin Gösterdiği:
Ink Characteristics Mürekkep Özellikleri
Solidity: Doluluk:
Calibration Kalibrasyon
Red Primary Kırmızı ana renk
Green Primary Yeşil ana renk
Blue Primary Mavi ana renk
Write xmp sidecars XMP yan dosyalarını yaz
Set the tone sliders from the image Ton kaydırıcılarını görüntüden ayarla
Settings from {name} {name} ayarları
Settings from {name}; {count} not supported: {names} {name} ayarları; {count} desteklenmiyor: {names}
Could not write {name}: {error} {name} yazılamadı: {error}
Kept {name}: written by another application {name} korundu: başka bir uygulama tarafından yazılmış
Shadow Tint Gölge tonu
Redrawing Yeniden çiziliyor
# Bevel & Emboss shading controls.
Highlight Mode Vurgu Modu
Can't render this file because it contains an unexpected character in line 8 and column 34.
+11
View File
@@ -3941,6 +3941,17 @@ curves Smooth Згладити
Sent to {printer} Надіслано на {printer}
set in Print Settings… задається в параметрах друку…
ICO is limited to 256 × 256 pixels ICO обмежено розміром 256 × 256 пікселів
Calibration Калібрування
Red Primary Червоний основний
Green Primary Зелений основний
Blue Primary Синій основний
Write xmp sidecars Записувати супутні файли XMP
Set the tone sliders from the image Встановити повзунки тону за зображенням
Settings from {name} Налаштування з {name}
Settings from {name}; {count} not supported: {names} Налаштування з {name}; не підтримується: {count}: {names}
Could not write {name}: {error} Не вдалося записати {name}: {error}
Kept {name}: written by another application {name} залишено без змін: записаний іншою програмою
Shadow Tint Відтінок тіней
# PhotoCraft release checks.
Check for Updates… Перевірити оновлення…
PhotoCraft Updates Оновлення PhotoCraft
Can't render this file because it contains an unexpected character in line 1405 and column 18.
+11
View File
@@ -3704,6 +3704,17 @@ curves Smooth Làm mượt
Sent to {printer} Đã gửi tới {printer}
set in Print Settings… đặt trong thiết lập in…
ICO is limited to 256 × 256 pixels ICO giới hạn ở 256 × 256 pixel
Calibration Hiệu chuẩn
Red Primary Màu đỏ cơ bản
Green Primary Màu lục cơ bản
Blue Primary Màu lam cơ bản
Write xmp sidecars Ghi tệp phụ XMP
Set the tone sliders from the image Đặt các thanh trượt tông từ ảnh
Settings from {name} Thiết lập từ {name}
Settings from {name}; {count} not supported: {names} Thiết lập từ {name}; {count} không được hỗ trợ: {names}
Could not write {name}: {error} Không thể ghi {name}: {error}
Kept {name}: written by another application Đã giữ {name}: do ứng dụng khác ghi
Shadow Tint Sắc độ bóng tối
Check for Updates… Kiểm tra bản cập nhật…
PhotoCraft Updates Bản cập nhật PhotoCraft
Checking for updates… Đang kiểm tra bản cập nhật…
Can't render this file because it contains an unexpected character in line 6 and column 47.
+11
View File
@@ -2890,6 +2890,17 @@ curves Smooth 平滑
Sent to {printer} 已发送到 {printer}
set in Print Settings… 在打印设置中设置…
ICO is limited to 256 × 256 pixels ICO 最大为 256 × 256 像素
Calibration 校准
Red Primary 红原色
Green Primary 绿原色
Blue Primary 蓝原色
Write xmp sidecars 写入 XMP 附属文件
Set the tone sliders from the image 根据图像设置色调滑块
Settings from {name} 来自 {name} 的设置
Settings from {name}; {count} not supported: {names} 来自 {name} 的设置;{count} 项不支持:{names}
Could not write {name}: {error} 无法写入 {name}:{error}
Kept {name}: written by another application 已保留 {name}:由其他应用程序写入
Shadow Tint 阴影色调
# PhotoCraft release checks.
Check for Updates… 检查更新…
PhotoCraft Updates PhotoCraft 更新
Can't render this file because it contains an unexpected character in line 2376 and column 12.
+11
View File
@@ -2854,6 +2854,17 @@ curves Smooth 平滑
Sent to {printer} 已傳送至 {printer}
set in Print Settings… 在列印設定中設定…
ICO is limited to 256 × 256 pixels ICO 最大為 256 × 256 像素
Calibration 校準
Red Primary 紅原色
Green Primary 綠原色
Blue Primary 藍原色
Write xmp sidecars 寫入 XMP 附屬檔案
Set the tone sliders from the image 根據影像設定色調滑桿
Settings from {name} 來自 {name} 的設定
Settings from {name}; {count} not supported: {names} 來自 {name} 的設定;{count} 項不支援:{names}
Could not write {name}: {error} 無法寫入 {name}:{error}
Kept {name}: written by another application 已保留 {name}:由其他應用程式寫入
Shadow Tint 陰影色調
# PhotoCraft release checks.
Check for Updates… 檢查更新…
PhotoCraft Updates PhotoCraft 更新
Can't render this file because it contains an unexpected character in line 6 and column 47.
+4
View File
@@ -615,6 +615,10 @@ pub(crate) fn after_open(
notices::io_warnings(app, &opened, &crate::camera_raw_ui::without_develop_note(warnings));
} else {
notices::io_warnings(app, &opened, warnings);
// A raw that opened without the dialog is developed by its sidecar / Camera Raw Defaults.
if let Some(index) = app.session.active_index() {
crate::camera_raw_ui::opened_without_dialog(app, index, name, path, warnings);
}
}
// Script events bound to "Open Document".
photocraft_engine::automate_cmds::document_opened(&mut app.session);
+4 -3
View File
@@ -908,8 +908,9 @@ pub struct PhotocraftApp {
/// A raw file just opened interactively, waiting for the open-time Camera Raw dialog (shown
/// on the next frame, which has the egui context).
pub(crate) pending_raw_open: Option<camera_raw_ui::RawOpen>,
/// The open-time re-develop (or its Camera Raw step) running in the background.
pub(crate) raw_redevelop: Option<camera_raw_ui::Redevelop>,
/// The open-time re-develops (or their Camera Raw steps) running in the background, one per
/// raw being opened.
pub(crate) raw_redevelop: Vec<camera_raw_ui::Redevelop>,
/// Filter › Adaptive Wide Angle dialog (wide_angle_ui).
pub(crate) wide_angle: Option<wide_angle_ui::WideAngleDialog>,
/// ⌘Z history of each open parameter dialog (edit_history).
@@ -1146,7 +1147,7 @@ impl PhotocraftApp {
gradient: Default::default(),
camera_raw: None,
pending_raw_open: None,
raw_redevelop: None,
raw_redevelop: Vec::new(),
wide_angle: None,
dialog_edits: Default::default(),
pending_after_prompt: None,
+5 -4
View File
@@ -4231,11 +4231,12 @@ mod tests {
assert!(!prefs::is_hidden("enhancedControls.zoomWithTrackpadPinch"));
assert!(!prefs::is_hidden("enhancedControls.touchGestures"));
assert!(prefs::is_hidden("enhancedControls.scrubbySliderAcceleration"));
// Camera Raw Defaults shows "Open in Camera Raw" and the demosaic method so far.
// Camera Raw Defaults are all live: the dialog's Open applies them (camera_raw_ui).
assert!(has_visible_fields(&values, "rawDefaults"));
assert!(!prefs::is_hidden("rawDefaults.openInCameraRaw"));
assert!(!prefs::is_hidden("rawDefaults.demosaic"));
assert!(prefs::is_hidden("rawDefaults.applyAutoTone"));
for k in ["openInCameraRaw", "demosaic", "applyAutoTone", "colorSpace", "bitDepth", "resolution", "sharpenFor", "openAsSmartObject", "writeXmpSidecars"]
{
assert!(!prefs::is_hidden(&format!("rawDefaults.{k}")), "{k}");
}
assert!(!prefs::is_hidden("general.autoShowHomeScreen"));
assert!(!prefs::is_hidden("general.animatedZoom"));
assert!(!prefs::is_hidden("general.zoomResizesWindows"));
+13 -2
View File
@@ -498,15 +498,26 @@ viewports, so the dialog is drawn over the main window and appears in the image.
RGB/Grayscale layer. `params: {"smartFilter": {"layer": id, "index": i}}` opens it on an existing
Camera Raw smart filter instead (as double-clicking the filter in the Layers panel does): the
stored settings over the pixels below that filter, previewed through the filter mask; commit
then runs `layer.smartFilter.setParams` with every setting. `params.ui` accepts `set` (filter settings), `before`, `scope`, `view`, `commit` and
then runs `layer.smartFilter.setParams` with every setting. `params.ui` accepts `set` (filter settings), `before`, `scope`, `view`, `auto` (true: the Light
sliders from the image's histogram, the panel's Auto button), `commit` and
`cancel`, and while a raw file opens also `demosaic` (below). All parts of one request are validated before any is applied; a rejected request
leaves the settings, view state, preferences and document unchanged (and closes a dialog it
opened). Unknown `ui` or settings properties, non-boolean `before` / `commit` / `cancel`, and
opened). Unknown `ui` or settings properties, non-boolean `before` / `auto` / `commit` / `cancel`, and
`commit` together with `cancel` are errors. Point curves (`pointCurve`, `pointCurveRed`,
`pointCurveGreen`, `pointCurveBlue`) are empty or 2–16 finite points in 0–255 with inputs at
least one level apart. Commit dispatches one `filter.cameraRaw` engine command; a failed commit
keeps the dialog open for correction. Nothing else writes document history.
A raw file opened from a path reads its sidecar (`IMG_0001.xmp` beside `IMG_0001.CR2`, Camera
Raw's `crs:` settings) into the open-time dialog, and Open writes changed settings back
(Preferences › Camera Raw Defaults › Write xmp sidecars). It never writes beside a DNG, over a
sidecar another application wrote (a notice says it was kept), or for a control or MCP request.
Open also applies the other Camera Raw Defaults (Sharpen For as part of the Camera Raw step, then
colour space, bit depth and Open as Smart Object, so the step works on the pixels the dialog
previewed; Apply auto tone fills the dialog), reported as `defaults` in the commit's reply; the
resolution is set when the file opens. With "Open in Camera Raw" off the sidecar and the defaults
apply without the dialog.
**Opening a raw file.** An interactive open (File › Open, Open Recent, drag and drop, the
command line) of a camera raw developed from its sensor data shows this dialog first, titled
"Camera Raw (name)", with **Open** and **Cancel**, as Photoshop opens raws in Adobe Camera Raw.
+11 -4
View File
@@ -1,6 +1,6 @@
# Where PhotoCraft falls short of Photoshop
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-22 · **Change:** minor (G8: PSD type on a path opens on its path and saves back into the file's `Txt2`, #7962; G11: a recorded Save As imports with its format and file (`file.saveAs`, `file.saveACopy` for As a Copy) instead of as a plain Save that wrote over the played file, #7102; folder destinations stop playback until #5430; adjustment clipping stays visible in compact Properties, #5231; G9: Color panel modes, ramp and copy commands, the same in every theme, UI-217-17, #6000; G17: Help › Check for Updates and an opt-out check once per launch, DIST-220-1 partial, #5485; G10: `.asl` style libraries landed, #1051; G8: area type (TYPE-218-10); G1: smart objects keep Photoshop's Cylinder warp, #4112; G8: paragraph direction buttons in the Paragraph panel and options bar, TYPE-218-2 partial; G1: 32-bit Hue/Saturation and Colorize as Photoshop does them, Photoshop-oracle floor 190/258, #5781; G11: compound layer properties export as separate Photoshop Set events, rename last, #8304; G11: Batch and droplets take the result at the action's Save step, so actions ending in Save As and Close work; G11: `.atn` steps that switch to another open document import, play and save back, #7103; G14: the Nikon D4 white level follows the sample depth, so 12-bit D4 NEFs no longer open 2.6 stops dark, #5978; G14: a Nikon NEF's Adobe RGB preview is read as Adobe RGB (maker-note ColorSpace 0x001E), #5987; Apply Layer Comp action mapping, #7101; G10: JPEG Options dialog landed, FILE-215-19 partial (no Matte, progressive Scans or size preview); G10: Cineon write; G10: DPX read and write, #1049, Cineon and Amiga IFF read; Classical Object Finder improvement; learned segmentation remains open; G4: named, stateful section locks and visible keyboard focus in Brush Settings; G4: independent Brush Pose tilt-axis overrides, #3825 partial; G4: Transfer Mixer-only controls, #3825 partial; G9: Preferences › File Handling › Save in Background takes effect, #6207, 24 of 169 preferences do nothing; G7: Content-Aware Move previews every selection the command takes, coarse then exact, TOOL-213-4 done, #6680; G4: Pattern Stamp and Background Eraser draw live, TOOL-213-7; G9: Animated Zoom pref read: holding the Zoom tool zooms continuously, #6210, prefs that do nothing 25 of 166; G2: a cancelled 24 MP Gaussian Blur job stops in at most 44 ms, P25 under its 200 ms budget in local runs, baseline not re-run, #6205; G1: generated large-file fixtures, a 4.38 GB PSB opens on Windows through io, FILE-216-2 done, #5107; G9: fill and adjustment layers copy and paste whole, #2344; G1: smart filter masks show on PSD open, Photoshop-oracle floor 188/258; G10: DPX read and write, #1049, Cineon read; G1: CMYK Hue/Saturation and Color Balance keep the black ink; G1: CMYK Posterize on the stored values, psd-tools oracle floor 242/309; G1: CMYK adjustment layers composite on the document's inks, Photoshop-oracle floor 165/258; G1: CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; G1: modern Brightness/Contrast's brightness curve matches Photoshop, Photoshop-oracle floor 151/258; G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-22 · **Change:** minor (G14: lossy DNG, raw sidecars, Camera Raw Defaults live, Calibration and Auto, CR3 assessed as not clean-room feasible; G8: PSD type on a path opens on its path and saves back into the file's `Txt2`, #7962; G11: a recorded Save As imports with its format and file (`file.saveAs`, `file.saveACopy` for As a Copy) instead of as a plain Save that wrote over the played file, #7102; folder destinations stop playback until #5430; adjustment clipping stays visible in compact Properties, #5231; G9: Color panel modes, ramp and copy commands, the same in every theme, UI-217-17, #6000; G17: Help › Check for Updates and an opt-out check once per launch, DIST-220-1 partial, #5485; G10: `.asl` style libraries landed, #1051; G8: area type (TYPE-218-10); G1: smart objects keep Photoshop's Cylinder warp, #4112; G8: paragraph direction buttons in the Paragraph panel and options bar, TYPE-218-2 partial; G1: 32-bit Hue/Saturation and Colorize as Photoshop does them, Photoshop-oracle floor 190/258, #5781; G11: compound layer properties export as separate Photoshop Set events, rename last, #8304; G11: Batch and droplets take the result at the action's Save step, so actions ending in Save As and Close work; G11: `.atn` steps that switch to another open document import, play and save back, #7103; G14: the Nikon D4 white level follows the sample depth, so 12-bit D4 NEFs no longer open 2.6 stops dark, #5978; G14: a Nikon NEF's Adobe RGB preview is read as Adobe RGB (maker-note ColorSpace 0x001E), #5987; Apply Layer Comp action mapping, #7101; G10: JPEG Options dialog landed, FILE-215-19 partial (no Matte, progressive Scans or size preview); G10: Cineon write; G10: DPX read and write, #1049, Cineon and Amiga IFF read; Classical Object Finder improvement; learned segmentation remains open; G4: named, stateful section locks and visible keyboard focus in Brush Settings; G4: independent Brush Pose tilt-axis overrides, #3825 partial; G4: Transfer Mixer-only controls, #3825 partial; G9: Preferences › File Handling › Save in Background takes effect, #6207, 24 of 169 preferences do nothing; G7: Content-Aware Move previews every selection the command takes, coarse then exact, TOOL-213-4 done, #6680; G4: Pattern Stamp and Background Eraser draw live, TOOL-213-7; G9: Animated Zoom pref read: holding the Zoom tool zooms continuously, #6210, prefs that do nothing 25 of 166; G2: a cancelled 24 MP Gaussian Blur job stops in at most 44 ms, P25 under its 200 ms budget in local runs, baseline not re-run, #6205; G1: generated large-file fixtures, a 4.38 GB PSB opens on Windows through io, FILE-216-2 done, #5107; G9: fill and adjustment layers copy and paste whole, #2344; G1: smart filter masks show on PSD open, Photoshop-oracle floor 188/258; G10: DPX read and write, #1049, Cineon read; G1: CMYK Hue/Saturation and Color Balance keep the black ink; G1: CMYK Posterize on the stored values, psd-tools oracle floor 242/309; G1: CMYK adjustment layers composite on the document's inks, Photoshop-oracle floor 165/258; G1: CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; G1: modern Brightness/Contrast's brightness curve matches Photoshop, Photoshop-oracle floor 151/258; G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026
Every known shortfall against Photoshop 2026 (27.11.0), one entry each, ranked by user impact
on the way to beta. This is the work list agents pick from: take the highest-ranked entry that
@@ -161,9 +161,15 @@ what an agent can't finish alone.
(AGENTS.md forbids JS in the app).
### G14. Camera Raw depth
- **Missing:** CR3 (detected, unsupported), compressed RAF, lossy DNG (FILE-215-11), .xmp
sidecars, masking and calibration in the Camera Raw dialog, per-camera colour for non-DNG
cameras, lens profiles.
- **Missing:** CR3 sensor data (the embedded preview opens; the CRX codec has no public
specification, only LGPL implementations, so a clean-room decoder is not possible), compressed
RAF, highlight recovery modes (FILE-215-11), masking in the Camera Raw dialog, per-camera
colour for non-DNG cameras, lens profiles.
- **Done 2026-10-13:** lossy DNG decodes (#5112); `.xmp` sidecars beside raw files fill the
open-time dialog and Open writes them back; the Camera Raw Defaults preferences (colour space,
bit depth, resolution, Sharpen For, Open as Smart Object, Apply auto tone, sidecars) all take
effect on open; the dialog has the Calibration panel (Shadows tint, primaries' hue and
saturation) and an Auto button, both in the `.xmp` settings and the `filter.cameraRaw` params.
- **Evidence:** `crates/raw/src/lib.rs:228` (CR3), scorecard FILE-215-11/12, #50.
- **Progress (2026-10-11):** on the embedded-JPEG rendering work in #2135, Camera Raw
tuning retains the fitted look and applies user gains afterwards. Three D5100 NEFs
@@ -415,6 +421,7 @@ what an agent can't finish alone.
| 2026-10-13 | minor | G6: stale "missing tool" list corrected against `main` — Color Replacement (`paint.colorReplacement`), Red Eye (`paint.redEye`) and Add/Delete Anchor Point (P flyout, #4144) are live tools, so the toolbox is 67 of 68 and Art History Brush is the only one missing; no percentage or estimate changed |
| 2026-10-13 | minor | G10: Amiga IFF/ILBM read landed (1–8 planes, CMAP, stored and ByteRun1); IFF write remains open |
| 2026-10-13 | minor | G8: a Type tool click on the work path or the active shape layer's path starts type on it at the point clicked (TYPE-218-1, partial); no readiness percentage or estimate changed |
| 2026-10-13 | minor | G14: lossy DNG (#5112), `.xmp` sidecars, Camera Raw Defaults wired, Calibration panel and Auto; CR3 sensor decode ruled out under the clean-room rule |
| 2026-10-13 | minor | G4: Hue Jitter amount-track appearance (#3825, partial); no readiness percentage or estimate changed |
| 2026-10-13 | minor | G4: minimum inputs in Shape Dynamics and Transfer follow their Control (#3825, partial); no readiness percentage or estimate changed |
| 2026-10-12 | minor | G5: Free Transform options bar H/V skew fields done |
+1 -1
View File
@@ -117,7 +117,7 @@ Corpus floors (`crates/io/tests/it/corpus.rs`): the enforced minimums; the corpu
| FILE-215-8 | Large and BigTIFF import with banded decode across all IFDs | done | [#215](https://github.com/storytold/photocraft/issues/215) | codecs tiff_ifd.rs (bounds-checked IFD chain + SubIFD walk, classic and BigTIFF, cycle-safe; tiff_info / decode_tiff_page), tiff.rs banded parallel strip/tile decode, planar 1 and 2, BigTIFF write (tiff_bigtiff or > 4 GiB); io import_tiff_page; 30 MP RGB8 Deflate 345 -> 32 ms; no page picker in the UI yet |
| FILE-215-9 | SVG opens and places as shape layers or a vector Smart Object | done | [#215](https://github.com/storytold/photocraft/issues/215) | io svg.rs: paths, groups, text outlines as shape layers (gradients approximated; clip/mask/filter/pattern/image subtrees rasterised); smart_cmds.rs renders an SVG source at its placement scale |
| FILE-215-10 | Multi-page PDF save, PDF presentation, layer comps to PDF, vector/text output, PDF import | partial | [#215](https://github.com/storytold/photocraft/issues/215) | io pdf.rs: Save As / Save a Copy / CLI write one flattened RGB/Gray/CMYK page with ICC (#3401); print PDFs in print_cmds. Multi-page save, presentation, comps, vector/text output and PDF import (#2541) remain |
| FILE-215-11 | RAW: lossy DNG, highlight modes, .xmp sidecars, RAW prefs wired, per-camera corpus | missing | [#215](https://github.com/storytold/photocraft/issues/215) | raw sensor.rs:210 lossy DNG unsupported; raw_defaults unread; no xmp |
| FILE-215-11 | RAW: lossy DNG, highlight modes, .xmp sidecars, RAW prefs wired, per-camera corpus | partial | [#215](https://github.com/storytold/photocraft/issues/215) | 2026-10-13: lossy DNG (34892) decodes stored 8-bit samples with padded edge tiles (raw sensor.rs lossy_jpeg, #5112); a raw's sidecar IMG.xmp fills the open-time dialog and Open writes it back (camera_raw_ui.rs read_sidecar/write_sidecar, pref rawDefaults.writeXmpSidecars); every Camera Raw Defaults preference is read (colour space, bit depth, resolution, Sharpen For, Open as Smart Object, Apply auto tone: apply_raw_defaults); Calibration panel (shadow tint, primaries hue/saturation) in the dialog, the filter and the crs: keys. Still missing: highlight recovery modes, the absolute (kelvin) white balance of raw sidecars, a per-camera corpus |
| FILE-215-12 | Camera Raw dialog shows a histogram; settings persist as a PSD Smart Filter | partial | [#215](https://github.com/storytold/photocraft/issues/215) | Interactive RGB/Lab scopes. PSD WB/Light/Presence, curves, HSL, grading, sharpening/noise detail, grain and numeric vignette controls mapped with descriptor preservation. Active manual Optics and unverified vignette style keep the updated ACR 18.4 fixture opaque; PSD/.pcraft saves preserve it. HDR, remaining settings and Photoshop acceptance still open |
| FILE-215-13 | Video layer frames persist in .pcraft; PSD video layers mapped | partial | [#215](https://github.com/storytold/photocraft/issues/215) | format convert.rs:89 + tests/it/roundtrip.rs:282 persist frames; no PSD video mapping |
| FILE-215-14 | User swatch model with ACO/ASE import and export | done | [#215](https://github.com/storytold/photocraft/issues/215) | engine presets/swatches.rs (RGB/HSB/CMYK/Lab/Gray + verbatim colour books, persisted in prefs) + swatch_cmds.rs (swatches.*); psd aco.rs (v1/v2) and ase.rs (groups, spot/global) read+write; ui swatches_ui.rs, Color Picker Add to Swatches |
+2 -2
View File
@@ -78,9 +78,9 @@ note = "io pdf.rs: Save As / Save a Copy / CLI write one flattened RGB/Gray/CMYK
[[item]]
id = "FILE-215-11"
target = "RAW: lossy DNG, highlight modes, .xmp sidecars, RAW prefs wired, per-camera corpus"
status = "missing"
status = "partial"
issue = 215
note = "raw sensor.rs:210 lossy DNG unsupported; raw_defaults unread; no xmp"
note = "2026-10-13: lossy DNG (34892) decodes stored 8-bit samples with padded edge tiles (raw sensor.rs lossy_jpeg, #5112); a raw's sidecar IMG.xmp fills the open-time dialog and Open writes it back (camera_raw_ui.rs read_sidecar/write_sidecar, pref rawDefaults.writeXmpSidecars); every Camera Raw Defaults preference is read (colour space, bit depth, resolution, Sharpen For, Open as Smart Object, Apply auto tone: apply_raw_defaults); Calibration panel (shadow tint, primaries hue/saturation) in the dialog, the filter and the crs: keys. Still missing: highlight recovery modes, the absolute (kelvin) white balance of raw sidecars, a per-camera corpus"
[[item]]
id = "FILE-215-12"