mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-23 19:04:25 +01:00
Merge pull request #7674 from dotCooCoo/feat/proof-setup-customize
View: Proof Setup › Customize… opens a dialog for the device to simulate
This commit is contained in:
52 files changed
+1471
-43
No files matched your search
+109
-6
@@ -458,6 +458,15 @@ impl Cms {
|
||||
CmykSpace::Generic(g) => g.to_srgb(cmyk, absolute, bpc),
|
||||
CmykSpace::Device => naive_cmyk_to_rgb(cmyk),
|
||||
CmykSpace::Icc(p) => {
|
||||
// With black-point compensation the profile's black maps onto sRGB black, as
|
||||
// `cmyk_to_srgb` shows the working space.
|
||||
if bpc
|
||||
&& !absolute
|
||||
&& let Some(srgb) = builtin_rgb_cache(SRGB)
|
||||
&& let Some(v) = p.to_rgb_of(&srgb, &cmyk, Intent::RelativeColorimetric, true)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
let i = if absolute { Intent::AbsoluteColorimetric } else { Intent::RelativeColorimetric };
|
||||
p.to_srgb(&cmyk, i).unwrap_or_else(|| naive_cmyk_to_rgb(cmyk))
|
||||
}
|
||||
@@ -676,32 +685,108 @@ impl Cms {
|
||||
ProofTarget::Tritanopia => TRITANOPIA.simulate(srgb),
|
||||
ProofTarget::WorkingCmyk => {
|
||||
let working = self.working_cms();
|
||||
let cmyk = working.srgb_to_cmyk(srgb, proof.intent);
|
||||
working.cmyk_to_srgb(cmyk, proof.simulate_paper)
|
||||
let cmyk = if proof.preserve_numbers { self.preserved_cmyk(srgb) } else { working.srgb_to_cmyk(srgb, proof.intent) };
|
||||
self.proof_cmyk_to_srgb(cmyk, proof)
|
||||
}
|
||||
ProofTarget::Cmyk(name) => match cmyk_space(name) {
|
||||
Ok(sp) => {
|
||||
let cmyk = Self::srgb_to_cmyk_in(&sp, srgb, proof.intent, self.settings.bpc);
|
||||
Self::cmyk_to_srgb_in(&sp, cmyk, proof.simulate_paper, self.settings.bpc)
|
||||
let cmyk = if proof.preserve_numbers {
|
||||
self.preserved_cmyk(srgb)
|
||||
} else {
|
||||
Self::srgb_to_cmyk_in(&sp, srgb, proof.intent, self.settings.bpc)
|
||||
};
|
||||
self.proof_cmyk_to_srgb(cmyk, proof)
|
||||
}
|
||||
Err(_) => srgb,
|
||||
},
|
||||
ProofTarget::Rgb(name) => match rgb_space(canonical_name(name)) {
|
||||
Ok(RgbSpace::Srgb) if !proof.preserve_numbers => srgb,
|
||||
Ok(RgbSpace::Srgb) => self.srgb_to_rgb(srgb).map(|v| v.clamp(0.0, 1.0)),
|
||||
Ok(RgbSpace::Icc(p)) => {
|
||||
// The device's own numbers for the color: the document's RGB numbers unchanged,
|
||||
// or the color converted into the device's space with the proof's intent.
|
||||
let numbers = if proof.preserve_numbers {
|
||||
self.srgb_to_rgb(srgb)
|
||||
} else {
|
||||
p.from_srgb(srgb, proof.intent).and_then(|v| Some([*v.first()?, *v.get(1)?, *v.get(2)?])).unwrap_or(srgb)
|
||||
};
|
||||
p.to_srgb(&numbers, Intent::RelativeColorimetric).unwrap_or(srgb)
|
||||
}
|
||||
Err(_) => srgb,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Display sRGB of color `c` proofed with Preserve Numbers on a CMYK or RGB device: its own
|
||||
/// numbers go to the device unchanged. A CMYK device takes a CMYK color's inks as they are, a
|
||||
/// gray as K only and another color's inks in this context's CMYK space (relative
|
||||
/// colorimetric); an RGB device takes an RGB color's numbers as they are and another color's
|
||||
/// numbers in this context's RGB space. Other targets proof the color's display sRGB
|
||||
/// ([`Self::proof_srgb`]).
|
||||
pub fn proof_color(&self, c: &Color, proof: &ProofSetup) -> [f32; 3] {
|
||||
if !proof.preserve_numbers {
|
||||
return self.proof_srgb(self.display_rgb(c), proof);
|
||||
}
|
||||
match &proof.target {
|
||||
// A device whose profile is not loaded leaves the color as it is, as for a pixel.
|
||||
ProofTarget::Cmyk(name) if cmyk_space(name).is_err() => self.display_rgb(c),
|
||||
ProofTarget::WorkingCmyk | ProofTarget::Cmyk(_) => self.proof_cmyk_to_srgb(self.to_cmyk(c, Intent::RelativeColorimetric), proof),
|
||||
ProofTarget::Rgb(name) => {
|
||||
// A CMYK color converts straight into the RGB space, so a wide space keeps it.
|
||||
let numbers = match self.convert(c, Model::Rgb, Intent::RelativeColorimetric) {
|
||||
Color::Rgb { r, g, b } => [r, g, b],
|
||||
other => self.srgb_to_rgb(self.display_rgb(&other)),
|
||||
}
|
||||
.map(|v| v.clamp(0.0, 1.0));
|
||||
match rgb_space(canonical_name(name)) {
|
||||
Ok(RgbSpace::Srgb) => numbers,
|
||||
Ok(RgbSpace::Icc(p)) => p.to_srgb(&numbers, Intent::RelativeColorimetric).unwrap_or(numbers),
|
||||
Err(_) => self.display_rgb(c),
|
||||
}
|
||||
}
|
||||
_ => self.proof_srgb(self.display_rgb(c), proof),
|
||||
}
|
||||
}
|
||||
|
||||
/// The CMYK numbers display sRGB `srgb` has in this context's CMYK space (relative
|
||||
/// colorimetric), which Preserve CMYK Numbers sends to the simulated device unchanged: for
|
||||
/// pixels whose own numbers are not known (an RGB image's pixels, art drawn over other art).
|
||||
/// A color whose numbers are known proofs through [`Self::proof_color`].
|
||||
fn preserved_cmyk(&self, srgb: [f32; 3]) -> [f32; 4] {
|
||||
self.srgb_to_cmyk(srgb, Intent::RelativeColorimetric)
|
||||
}
|
||||
|
||||
/// Display sRGB of CMYK inks in the proof's CMYK space (this context's CMYK space for RGB
|
||||
/// targets).
|
||||
/// targets). Simulate Paper Color shows the paper's color and the press black (absolute
|
||||
/// colorimetric); else Simulate Black Ink shows the press black as the dark gray it prints
|
||||
/// (media-relative, without black-point compensation).
|
||||
pub fn proof_cmyk_to_srgb(&self, cmyk: [f32; 4], proof: &ProofSetup) -> [f32; 3] {
|
||||
let black = proof.simulate_black && !proof.simulate_paper;
|
||||
match &proof.target {
|
||||
ProofTarget::Cmyk(name) => match cmyk_space(name) {
|
||||
Ok(sp) if black => Self::black_ink_srgb(&sp, cmyk),
|
||||
Ok(sp) => Self::cmyk_to_srgb_in(&sp, cmyk, proof.simulate_paper, self.settings.bpc),
|
||||
Err(_) => self.cmyk_to_srgb(cmyk, proof.simulate_paper),
|
||||
},
|
||||
ProofTarget::WorkingCmyk if black => Self::black_ink_srgb(&self.working_cms().cmyk, cmyk),
|
||||
ProofTarget::WorkingCmyk => self.working_cms().cmyk_to_srgb(cmyk, proof.simulate_paper),
|
||||
_ => self.cmyk_to_srgb(cmyk, proof.simulate_paper),
|
||||
}
|
||||
}
|
||||
|
||||
/// Display sRGB of `cmyk` in `space`, media-relative and without black-point compensation, so
|
||||
/// the darkest ink the space prints shows as the gray it is rather than as black.
|
||||
fn black_ink_srgb(space: &CmykSpace, cmyk: [f32; 4]) -> [f32; 3] {
|
||||
let cmyk = cmyk.map(|v| v.clamp(0.0, 1.0));
|
||||
if let CmykSpace::Icc(p) = space
|
||||
&& let Some(srgb) = builtin_rgb_cache(SRGB)
|
||||
&& let Some(v) = p.to_rgb_of(&srgb, &cmyk, Intent::RelativeColorimetric, false)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
Self::cmyk_to_srgb_in(space, cmyk, false, false)
|
||||
}
|
||||
|
||||
/// The context of the working settings: the one [`use_document_profiles`] put a document's
|
||||
/// profiles in place of, else this one.
|
||||
fn working_cms(&self) -> &Cms {
|
||||
@@ -711,7 +796,10 @@ impl Cms {
|
||||
/// A cached 3-D lookup table implementing [`Cms::proof_srgb`] for 8-bit pixels.
|
||||
pub fn proof_lut(&self, proof: &ProofSetup) -> Arc<ProofLut> {
|
||||
let working = self.working.as_ref().map(|w| &w.settings);
|
||||
let key = format!("{:?}|{working:?}|{:?}|{:?}|{}", self.settings, proof.target, proof.intent, proof.simulate_paper);
|
||||
let key = format!(
|
||||
"{:?}|{working:?}|{:?}|{:?}|{}|{}|{}",
|
||||
self.settings, proof.target, proof.intent, proof.simulate_paper, proof.preserve_numbers, proof.simulate_black
|
||||
);
|
||||
let mut cache = PROOF_CACHE.lock().unwrap_or_else(|e| e.into_inner());
|
||||
if let Some((_, l)) = cache.iter().find(|(k, _)| *k == key) {
|
||||
return l.clone();
|
||||
@@ -860,6 +948,8 @@ pub enum ProofTarget {
|
||||
WorkingCmyk,
|
||||
/// A specific CMYK profile (Customize…).
|
||||
Cmyk(String),
|
||||
/// A specific RGB profile (Customize…): the color as that RGB device shows it.
|
||||
Rgb(String),
|
||||
/// Legacy Macintosh RGB (Gamma 1.8).
|
||||
LegacyMacRgb,
|
||||
/// Internet Standard RGB (sRGB).
|
||||
@@ -879,6 +969,9 @@ impl ProofTarget {
|
||||
if let Some(p) = s.strip_prefix("cmyk:") {
|
||||
return Some(ProofTarget::Cmyk(p.to_string()));
|
||||
}
|
||||
if let Some(p) = s.strip_prefix("rgb:") {
|
||||
return Some(ProofTarget::Rgb(p.to_string()));
|
||||
}
|
||||
Some(match s {
|
||||
"workingCmyk" | "cmyk" => ProofTarget::WorkingCmyk,
|
||||
"legacyMacRgb" | "macRgb" => ProofTarget::LegacyMacRgb,
|
||||
@@ -894,6 +987,7 @@ impl ProofTarget {
|
||||
match self {
|
||||
ProofTarget::WorkingCmyk => "workingCmyk".into(),
|
||||
ProofTarget::Cmyk(p) => format!("cmyk:{p}"),
|
||||
ProofTarget::Rgb(p) => format!("rgb:{p}"),
|
||||
ProofTarget::LegacyMacRgb => "legacyMacRgb".into(),
|
||||
ProofTarget::Srgb => "srgb".into(),
|
||||
ProofTarget::MonitorRgb => "monitorRgb".into(),
|
||||
@@ -917,6 +1011,15 @@ pub struct ProofSetup {
|
||||
/// Simulate Paper Color (absolute colorimetric display of the press).
|
||||
#[serde(default)]
|
||||
pub simulate_paper: bool,
|
||||
/// Preserve CMYK Numbers (a CMYK device) or Preserve RGB Numbers (an RGB device): the colors'
|
||||
/// numbers go to the device unchanged instead of being converted into its space with
|
||||
/// `intent`.
|
||||
#[serde(default)]
|
||||
pub preserve_numbers: bool,
|
||||
/// Simulate Black Ink: the press black shows as the dark gray it prints (a CMYK device; implied
|
||||
/// by `simulate_paper`).
|
||||
#[serde(default)]
|
||||
pub simulate_black: bool,
|
||||
/// Separations Preview: names of the visible plates ("Cyan", "Magenta", "Yellow", "Black",
|
||||
/// spot swatch names). `None` = normal composite proof.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
|
||||
@@ -194,6 +194,100 @@ fn colour_blindness_proofs() {
|
||||
assert_eq!(ProofTarget::parse(&ProofTarget::Cmyk("X".into()).id()), Some(ProofTarget::Cmyk("X".into())));
|
||||
}
|
||||
|
||||
/// Proof Setup › Customize: Simulate Black Ink shows the press black of a CMYK device as the dark
|
||||
/// gray it prints, where the proof otherwise shows it as black; Simulate Paper Color shows it so
|
||||
/// as well, on the paper's color.
|
||||
#[test]
|
||||
fn simulate_black_ink_shows_the_press_black_as_gray() {
|
||||
let c = cms();
|
||||
let device = ProofSetup { target: ProofTarget::Cmyk(GENERIC_CMYK.into()), ..Default::default() };
|
||||
let black = ProofSetup { simulate_black: true, ..device.clone() };
|
||||
let paper = ProofSetup { simulate_paper: true, ..device.clone() };
|
||||
let plain = c.proof_srgb([0.0; 3], &device);
|
||||
let gray = c.proof_srgb([0.0; 3], &black);
|
||||
assert!(plain.iter().all(|v| *v < 0.02), "black stays black: {plain:?}");
|
||||
assert!(gray.iter().all(|v| *v > 0.05), "the press black shows as a gray: {gray:?}");
|
||||
assert_eq!(c.proof_srgb([1.0; 3], &black), [1.0; 3], "the paper stays white");
|
||||
assert!(c.proof_srgb([0.0; 3], &paper).iter().all(|v| *v > 0.05));
|
||||
// The working CMYK target, and the inks Separations Preview shows, follow it too.
|
||||
let working = ProofSetup { target: ProofTarget::WorkingCmyk, simulate_black: true, ..Default::default() };
|
||||
assert_eq!(c.proof_srgb([0.0; 3], &working), gray);
|
||||
assert!(c.proof_cmyk_to_srgb([0.0, 0.0, 0.0, 1.0], &black)[0] > c.proof_cmyk_to_srgb([0.0, 0.0, 0.0, 1.0], &device)[0] + 0.05);
|
||||
// The table the canvas draws through is made for each setting.
|
||||
assert!(de(c.proof_lut(&black).apply([0.0; 3]), gray) < 2.5);
|
||||
assert!(de(c.proof_lut(&device).apply([0.0; 3]), plain) < 2.5);
|
||||
}
|
||||
|
||||
/// Preserve CMYK Numbers sends the color's CMYK numbers in the document's space to the simulated
|
||||
/// device unchanged: with Device CMYK as the working space, K50 shows as the simulated press
|
||||
/// prints K50 (darker, with its dot gain). Without it the color is converted into the device's
|
||||
/// space with the intent, and the gray looks as it does on screen.
|
||||
#[test]
|
||||
fn preserve_cmyk_numbers_sends_the_numbers_unchanged() {
|
||||
let dev = Cms::new(&ColorSettings { cmyk: DEVICE_CMYK.into(), ..Default::default() }).unwrap();
|
||||
let press = Cms::new(&ColorSettings::default()).unwrap();
|
||||
let k50 = [0.0, 0.0, 0.0, 0.5];
|
||||
let gray = dev.cmyk_to_srgb(k50, false);
|
||||
let device = ProofSetup { target: ProofTarget::Cmyk(GENERIC_CMYK.into()), ..Default::default() };
|
||||
let preserved = dev.proof_srgb(gray, &ProofSetup { preserve_numbers: true, ..device.clone() });
|
||||
let want = press.cmyk_to_srgb(k50, false);
|
||||
assert!(de(preserved, want) < 0.5, "{preserved:?} vs {want:?}");
|
||||
let converted = dev.proof_srgb(gray, &device);
|
||||
assert!(de(converted, gray) < 1.5, "{converted:?} vs {gray:?}");
|
||||
assert!(de(converted, preserved) > 3.0, "{converted:?} vs {preserved:?}");
|
||||
// With the numbers preserved the intent is not used.
|
||||
let perceptual = ProofSetup { intent: Intent::Perceptual, preserve_numbers: true, ..device };
|
||||
assert_eq!(dev.proof_srgb(gray, &perceptual), preserved);
|
||||
}
|
||||
|
||||
/// An RGB profile as the device to simulate: with Preserve RGB Numbers the document's RGB numbers
|
||||
/// show as that device shows them (sRGB numbers on a Display P3 device look more saturated);
|
||||
/// without it a color the device can show looks the same, and one it can't show is clipped.
|
||||
#[test]
|
||||
fn rgb_device_proofs_show_the_device_numbers() {
|
||||
let c = cms();
|
||||
let p3 = ProofSetup { target: ProofTarget::Rgb(DISPLAY_P3.into()), ..Default::default() };
|
||||
assert_eq!(ProofTarget::parse(&p3.target.id()), Some(p3.target.clone()));
|
||||
assert_eq!(p3.target.id(), format!("rgb:{DISPLAY_P3}"));
|
||||
assert!(!p3.target.is_cmyk());
|
||||
let red = [0.7, 0.3, 0.25];
|
||||
let converted = c.proof_srgb(red, &p3);
|
||||
assert!(de(converted, red) < 1.0, "{converted:?}");
|
||||
let preserved = c.proof_srgb(red, &ProofSetup { preserve_numbers: true, ..p3.clone() });
|
||||
assert!(preserved[0] > red[0] + 0.02 && preserved[1] < red[1] - 0.02, "{preserved:?}");
|
||||
// An RGB color's own numbers give the same proof.
|
||||
let own = c.proof_color(&Color::rgb(red[0], red[1], red[2]), &ProofSetup { preserve_numbers: true, ..p3.clone() });
|
||||
assert!(de(own, preserved) < 0.01, "{own:?} vs {preserved:?}");
|
||||
// sRGB numbers on an sRGB device: as they are either way.
|
||||
let srgb = ProofSetup { target: ProofTarget::Rgb(SRGB.into()), preserve_numbers: true, ..Default::default() };
|
||||
assert!(de(c.proof_srgb(red, &srgb), red) < 0.01);
|
||||
// A wider working space's numbers on an sRGB device: its green clips to sRGB green.
|
||||
let wide = Cms::new(&ColorSettings { rgb: WIDE_GAMUT_RGB.into(), ..Default::default() }).unwrap();
|
||||
let green = wide.rgb_to_srgb([0.2, 0.8, 0.2]);
|
||||
let shown = wide.proof_srgb(green, &srgb);
|
||||
assert!(de(shown, green) > 3.0, "the wide space's numbers show as sRGB numbers: {shown:?}");
|
||||
// A profile that is gone leaves the colors as they are.
|
||||
let gone = ProofSetup { target: ProofTarget::Rgb("Nope".into()), ..Default::default() };
|
||||
assert_eq!(c.proof_srgb(red, &gone), red);
|
||||
}
|
||||
|
||||
/// A CMYK device whose profile is not loaded leaves a color as the screen shows it, with Preserve
|
||||
/// CMYK Numbers on as well as off, the same as for a pixel of that color.
|
||||
#[test]
|
||||
fn missing_cmyk_device_leaves_colors_as_they_are() {
|
||||
let c = cms();
|
||||
let gone = ProofSetup { target: ProofTarget::Cmyk("Nope".into()), preserve_numbers: true, ..Default::default() };
|
||||
let blue = Color::rgb(0.0, 0.0, 1.0);
|
||||
let shown = c.display_rgb(&blue);
|
||||
assert_eq!(c.proof_color(&blue, &gone), shown);
|
||||
assert_eq!(c.proof_srgb(shown, &gone), shown);
|
||||
let off = ProofSetup { preserve_numbers: false, ..gone.clone() };
|
||||
assert_eq!(c.proof_color(&blue, &off), shown);
|
||||
// A CMYK color keeps its inks' display color.
|
||||
let ink = Color::Cmyk { c: 0.2, m: 0.7, y: 0.1, k: 0.05 };
|
||||
assert!(de(c.proof_color(&ink, &gone), c.display_rgb(&ink)) < 0.01);
|
||||
}
|
||||
|
||||
/// The expected colors were computed separately with NumPy from the same published inputs (linear
|
||||
/// sRGB to XYZ from IEC 61966-2-1, Smith & Pokorny's XYZ to LMS, Judd-Vos XYZ at 485 nm and 660 nm),
|
||||
/// following Brettel, Viénot & Mollon (1997) with the display's white as the neutral axis.
|
||||
|
||||
@@ -187,6 +187,25 @@ fn black_point_compensation_maps_the_darkest_ink_to_rgb_black() {
|
||||
assert_eq!(abs(true), abs(false));
|
||||
}
|
||||
|
||||
/// A loaded ICC CMYK profile as Proof Setup's device shows its darkest ink with the settings'
|
||||
/// black-point compensation, as the working CMYK proof of the same profile does, and Simulate
|
||||
/// Black Ink shows it as the lighter gray the press prints.
|
||||
#[test]
|
||||
fn simulate_black_ink_shows_a_loaded_cmyk_profiles_black_as_gray() {
|
||||
let c = icc_cmyk(true);
|
||||
let k100 = [0.0, 0.0, 0.0, 1.0];
|
||||
let device = ProofSetup { target: ProofTarget::Cmyk(c.settings().cmyk.clone()), ..Default::default() };
|
||||
let plain = c.proof_cmyk_to_srgb(k100, &device);
|
||||
let working = c.proof_cmyk_to_srgb(k100, &ProofSetup { target: ProofTarget::WorkingCmyk, ..Default::default() });
|
||||
assert!(plain.iter().zip(working).all(|(a, b)| (a - b).abs() < 0.01), "device {plain:?}, working {working:?}");
|
||||
let black = c.proof_cmyk_to_srgb(k100, &ProofSetup { simulate_black: true, ..device.clone() });
|
||||
assert!(plain.iter().zip(black).all(|(a, b)| b > a + 0.03), "black ink {black:?}, without {plain:?}");
|
||||
// Without black-point compensation the device shows the darkest ink as the press prints it.
|
||||
let off = icc_cmyk(false);
|
||||
let plain_off = off.proof_cmyk_to_srgb(k100, &ProofSetup { target: ProofTarget::Cmyk(off.settings().cmyk.clone()), ..Default::default() });
|
||||
assert!(plain_off.iter().zip(black).all(|(a, b)| (a - b).abs() < 0.02), "without compensation {plain_off:?}, black ink {black:?}");
|
||||
}
|
||||
|
||||
/// #1584: every built-in profile (RGB, CMYK and gray) has each tag on a 4-byte boundary and a size
|
||||
/// that is a multiple of 4 (ICC.1 §7.1.2), and still reads back as the same space.
|
||||
#[test]
|
||||
|
||||
@@ -100,7 +100,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Proof Setup",
|
||||
["View", "Proof Setup"],
|
||||
None,
|
||||
"{target?: \"workingCmyk\"|\"cmyk:<profile>\"|\"legacyMacRgb\"|\"srgb\"|\"monitorRgb\"|\"protanopia\"|\"deuteranopia\"|\"tritanopia\", intent?, simulatePaper?, proof?: bool (also turn Proof Colors on)} → proof state",
|
||||
"{target?: \"workingCmyk\"|\"cmyk:<profile>\"|\"rgb:<profile>\"|\"legacyMacRgb\"|\"srgb\"|\"monitorRgb\"|\"protanopia\"|\"deuteranopia\"|\"tritanopia\" (cmyk: and rgb: name a CMYK or RGB profile of color.loadProfile or the built-in ones: the device to simulate), intent? (used while preserveNumbers is off), simulatePaper?: bool, preserveNumbers?: bool (Preserve CMYK or RGB Numbers: the colors' numbers in the document's space go to the device unchanged), simulateBlack?: bool (Simulate Black Ink: the device's black shows as the dark gray it prints; simulatePaper does this too; CMYK devices only, as simulatePaper), proof?: bool (also turn Proof Colors on)} → proof state",
|
||||
always,
|
||||
proof_setup
|
||||
),
|
||||
@@ -261,7 +261,7 @@ fn load_profile(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
use_front_profiles(s);
|
||||
touch_all(s);
|
||||
} else if proof_targets(&info.name) {
|
||||
// A new file of the CMYK profile View → Proof Setup targets: redraw.
|
||||
// A new file of the profile View → Proof Setup targets: redraw.
|
||||
touch_all(s);
|
||||
} else {
|
||||
// Documents behind the front one draw through their own profiles: those assigned it redraw.
|
||||
@@ -292,7 +292,7 @@ fn remove_profile(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if active.rgb == name || active.cmyk == name {
|
||||
use_front_profiles(s);
|
||||
}
|
||||
// The CMYK profile View → Proof Setup targets: redraw.
|
||||
// The profile View → Proof Setup targets: redraw.
|
||||
if proof_targets(&info.name) {
|
||||
touch_all(s);
|
||||
}
|
||||
@@ -311,9 +311,9 @@ fn touch_assigned(s: &mut Session, name: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether View → Proof Setup targets the CMYK profile `name`.
|
||||
/// Whether View → Proof Setup targets the CMYK or RGB profile `name`.
|
||||
fn proof_targets(name: &str) -> bool {
|
||||
matches!(proof::view().setup.target, ProofTarget::Cmyk(t) if t == name)
|
||||
matches!(proof::view().setup.target, ProofTarget::Cmyk(t) | ProofTarget::Rgb(t) if t == name)
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
@@ -1392,6 +1392,8 @@ fn view_json(v: &proof::ProofView) -> Value {
|
||||
"target": v.setup.target.id(),
|
||||
"intent": v.setup.intent.id(),
|
||||
"simulatePaper": v.setup.simulate_paper,
|
||||
"preserveNumbers": v.setup.preserve_numbers,
|
||||
"simulateBlack": v.setup.simulate_black,
|
||||
"proofColors": v.proof_colors,
|
||||
"overprintPreview": v.overprint,
|
||||
"separations": v.separations,
|
||||
@@ -1408,12 +1410,19 @@ fn proof_setup(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
{
|
||||
return Err(bad(C, format!("unknown CMYK profile `{name}`")));
|
||||
}
|
||||
if let ProofTarget::Rgb(name) = &t
|
||||
&& !cms::profile(name).is_some_and(|k| k.kind == cms::ProfileKind::Rgb)
|
||||
{
|
||||
return Err(bad(C, format!("unknown RGB profile `{name}`")));
|
||||
}
|
||||
v.setup.target = t;
|
||||
}
|
||||
if let Some(i) = intent_param(p, C)? {
|
||||
v.setup.intent = i;
|
||||
}
|
||||
v.setup.simulate_paper = switch_or(p, "simulatePaper", v.setup.simulate_paper, C)?;
|
||||
v.setup.preserve_numbers = switch_or(p, "preserveNumbers", v.setup.preserve_numbers, C)?;
|
||||
v.setup.simulate_black = switch_or(p, "simulateBlack", v.setup.simulate_black, C)?;
|
||||
if let Some(on) = on_param(p, "proof", C)? {
|
||||
v.proof_colors = on;
|
||||
}
|
||||
|
||||
@@ -682,6 +682,44 @@ fn proof_setup_simulates_tritanopia() {
|
||||
s.execute("view.proofSetup", &json!({"target": "workingCmyk", "proof": false})).unwrap();
|
||||
}
|
||||
|
||||
/// View › Proof Setup › Customize's settings: an RGB profile as the device, Preserve Numbers and
|
||||
/// Simulate Black Ink, kept in the proof view, read back and drawn; bad values are refused and
|
||||
/// leave the view as it was.
|
||||
#[test]
|
||||
fn proof_setup_takes_the_custom_proof_settings() {
|
||||
let _g = GLOBAL.lock().unwrap_or_else(|e| e.into_inner());
|
||||
let _v = DefaultView::new();
|
||||
let mut s = session();
|
||||
rect(&mut s, 0.0, 0.0, 100.0, 100.0, json!("#000000"));
|
||||
let r = s.execute("view.proofSetup", &json!({})).unwrap();
|
||||
assert_eq!((r["preserveNumbers"].as_bool(), r["simulateBlack"].as_bool()), (Some(false), Some(false)));
|
||||
let device = format!("cmyk:{}", cms::GENERIC_CMYK);
|
||||
let r = s.execute("view.proofSetup", &json!({"target": device, "simulateBlack": true, "proof": true})).unwrap();
|
||||
assert_eq!((r["target"].as_str(), r["simulateBlack"].as_bool(), r["proofColors"].as_bool()), (Some(device.as_str()), Some(true), Some(true)));
|
||||
let setup = vectorcraft_render::proof::active_proof().unwrap();
|
||||
assert!(setup.simulate_black && !setup.preserve_numbers);
|
||||
let doc = s.doc().unwrap().doc.clone();
|
||||
let gray = render(&doc, RenderOptions { proof: Some(setup.clone()), ..Default::default() }).pixel(50, 50);
|
||||
let black = render(&doc, RenderOptions { proof: Some(ProofSetup { simulate_black: false, ..setup }), ..Default::default() }).pixel(50, 50);
|
||||
assert!(gray[0] > black[0] + 10, "the press black shows as a gray: {gray:?} vs {black:?}");
|
||||
let rgb = format!("rgb:{}", cms::DISPLAY_P3);
|
||||
let r = s.execute("view.proofSetup", &json!({"target": rgb, "preserveNumbers": true})).unwrap();
|
||||
assert_eq!((r["target"].as_str(), r["preserveNumbers"].as_bool()), (Some(rgb.as_str()), Some(true)));
|
||||
assert_eq!(vectorcraft_render::proof::view().setup.target, ProofTarget::Rgb(cms::DISPLAY_P3.into()));
|
||||
// Unchanged settings leave the revision alone.
|
||||
let rev = s.doc().unwrap().revision;
|
||||
s.execute("view.proofSetup", &json!({"target": rgb, "preserveNumbers": true, "simulateBlack": true})).unwrap();
|
||||
assert_eq!(s.doc().unwrap().revision, rev);
|
||||
let view = vectorcraft_render::proof::view();
|
||||
refused(&mut s, "view.proofSetup", json!({"target": "rgb:Nope"}), "unknown RGB profile `Nope`");
|
||||
refused(&mut s, "view.proofSetup", json!({"target": format!("rgb:{}", cms::GENERIC_CMYK)}), "unknown RGB profile");
|
||||
refused(&mut s, "view.proofSetup", json!({"target": "rgb:"}), "unknown RGB profile");
|
||||
refused(&mut s, "view.proofSetup", json!({"target": "workingCmyk", "preserveNumbers": "yes"}), "`preserveNumbers` must be true or false");
|
||||
refused(&mut s, "view.proofSetup", json!({"simulateBlack": 1}), "`simulateBlack` must be true or false");
|
||||
assert_eq!(vectorcraft_render::proof::view(), view, "the proof view is unchanged");
|
||||
assert_eq!(s.doc().unwrap().revision, rev, "nothing redraws");
|
||||
}
|
||||
|
||||
/// Whether the content has a DeviceCMYK fill/stroke operator (`c m y k k` / `K`).
|
||||
fn has_cmyk_op(pdf: &str) -> bool {
|
||||
let toks: Vec<&str> = pdf.split_ascii_whitespace().collect();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
|
||||
use serde_json::json;
|
||||
use vectorcraft_color::cms;
|
||||
use vectorcraft_color::{Color, cms};
|
||||
use vectorcraft_engine::Session;
|
||||
use vectorcraft_engine::cmd::colormgmt::{PROFILES_KEY, ProfileChoice, ProfileIssue, doc_profiles};
|
||||
use vectorcraft_engine::store::MAX_PRESET_FILE;
|
||||
@@ -20,6 +20,22 @@ fn settings() -> MutexGuard<'static, ()> {
|
||||
SETTINGS.lock().unwrap_or_else(|e| e.into_inner())
|
||||
}
|
||||
|
||||
/// The working Color Settings as a test found them, put back when it ends (a failing one too)
|
||||
/// before the next test takes its turn.
|
||||
struct Restored(cms::ColorSettings, #[allow(dead_code)] MutexGuard<'static, ()>);
|
||||
|
||||
impl Drop for Restored {
|
||||
fn drop(&mut self) {
|
||||
let _ = cms::set_active(&self.0);
|
||||
}
|
||||
}
|
||||
|
||||
/// [`settings`], with the working Color Settings put back afterwards.
|
||||
fn restored_settings() -> Restored {
|
||||
let g = settings();
|
||||
Restored(cms::working_settings(), g)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn color_settings_lists_profiles_and_validates() {
|
||||
let _g = settings();
|
||||
@@ -923,6 +939,114 @@ fn saved_color_settings_that_cannot_be_used_leave_the_defaults() {
|
||||
}
|
||||
}
|
||||
|
||||
/// View › Proof Setup › Customize's Preserve CMYK Numbers proofs each color from its own inks:
|
||||
/// with Device CMYK as the working space, C50 M50 Y50 and K50 show as the same gray, and on
|
||||
/// VectorCraft Generic CMYK they print, and so proof, as different grays; a pattern's tile art
|
||||
/// proofs the same way. Without it the proof starts from the drawn pixels, which are the same.
|
||||
#[test]
|
||||
fn preserve_cmyk_numbers_proofs_each_color_from_its_inks() {
|
||||
let _g = restored_settings();
|
||||
let mut s = session();
|
||||
s.execute("edit.colorSettings", &json!({"cmyk": cms::DEVICE_CMYK})).unwrap();
|
||||
let k50 = json!({"c": 0, "m": 0, "y": 0, "k": 50});
|
||||
let cmy = rect(&mut s, 0.0, 0.0, 100.0, 100.0);
|
||||
exec(&mut s, "paint.setFill", json!({"ids": [cmy.0], "color": {"c": 50, "m": 50, "y": 50, "k": 0}}));
|
||||
let k = rect(&mut s, 100.0, 0.0, 100.0, 100.0);
|
||||
exec(&mut s, "paint.setFill", json!({"ids": [k.0], "color": k50}));
|
||||
// A pattern whose tile is all K50, filling a band below the squares.
|
||||
let tile = rect(&mut s, 300.0, 0.0, 10.0, 10.0);
|
||||
exec(&mut s, "paint.setFill", json!({"ids": [tile.0], "color": k50}));
|
||||
exec(&mut s, "object.pattern.make", json!({"ids": [tile.0], "name": "K50 Tile", "edit": false}));
|
||||
let band = rect(&mut s, 0.0, 130.0, 200.0, 40.0);
|
||||
exec(&mut s, "paint.setFill", json!({"ids": [band.0], "swatch": "K50 Tile"}));
|
||||
let proof = |preserve_numbers| vectorcraft_render::proof::ProofSetup {
|
||||
target: vectorcraft_render::proof::ProofTarget::Cmyk(cms::GENERIC_CMYK.into()),
|
||||
preserve_numbers,
|
||||
..Default::default()
|
||||
};
|
||||
let doc = s.doc().unwrap().doc.clone();
|
||||
let pixel = |px: &[u8], x: usize, y: usize| [px[(y * 200 + x) * 4], px[(y * 200 + x) * 4 + 1], px[(y * 200 + x) * 4 + 2]];
|
||||
// The pixels at the centers of the two squares and in the patterned band.
|
||||
let shown = |proof: Option<vectorcraft_render::proof::ProofSetup>| {
|
||||
let opts = RenderOptions { proof, background: Some([255, 255, 255, 255]), ..Default::default() };
|
||||
let px = Renderer::new().render(&doc, 200, 200, Affine::IDENTITY, &opts).pixels;
|
||||
(pixel(&px, 50, 50), pixel(&px, 150, 50), pixel(&px, 55, 155))
|
||||
};
|
||||
let (a, b, _) = shown(None);
|
||||
let (pa, pb, _) = shown(Some(proof(false)));
|
||||
let (ca, cb, cp) = shown(Some(proof(true)));
|
||||
let want = |c: Color| cms::active().proof_color(&c, &proof(true)).map(|v| (v * 255.0).round() as i32);
|
||||
let cmy_want = want(Color::cmyk(0.5, 0.5, 0.5, 0.0));
|
||||
let k_want = want(Color::cmyk(0.0, 0.0, 0.0, 0.5));
|
||||
// With Simulate Paper Color the art sits on the device's paper, not on white.
|
||||
let paper = vectorcraft_render::proof::ProofSetup { simulate_paper: true, ..proof(true) };
|
||||
let tint = cms::active().proof_srgb([1.0; 3], &paper).map(|v| (v * 255.0).round() as i32);
|
||||
let opts = RenderOptions { proof: Some(paper), background: Some([255, 255, 255, 255]), ..Default::default() };
|
||||
let bare = pixel(&Renderer::new().render(&doc, 200, 200, Affine::IDENTITY, &opts).pixels, 50, 115);
|
||||
assert_eq!(a, b, "the two builds show as one gray in Device CMYK");
|
||||
assert_eq!(pa, pb, "proofed from the pixels, they stay one gray");
|
||||
assert!(ca != cb, "proofed from their inks, they print differently: {ca:?} vs {cb:?}");
|
||||
let near = |got: [u8; 3], want: [i32; 3]| got.iter().zip(want).all(|(g, w)| (i32::from(*g) - w).abs() <= 2);
|
||||
assert!(near(ca, cmy_want) && near(cb, k_want), "{ca:?} {cmy_want:?}, {cb:?} {k_want:?}");
|
||||
assert!(near(cp, k_want), "the pattern's tile proofs from its inks: {cp:?} vs {k_want:?}");
|
||||
assert!(tint != [255; 3] && near(bare, tint), "the bare page shows the paper: {bare:?} vs {tint:?}");
|
||||
}
|
||||
|
||||
/// With Preserve CMYK Numbers, an image in an opacity mask keeps its pixels as they are, so the
|
||||
/// mask covers the same in a pattern's tile as outside one.
|
||||
#[test]
|
||||
fn preserve_cmyk_numbers_leaves_mask_images_in_pattern_tiles_as_they_are() {
|
||||
let _g = restored_settings();
|
||||
let mut s = session();
|
||||
// A K100 square masked by a blue image, the same at (0, 0) and as a pattern's tile.
|
||||
let masked = |s: &mut Session, x: f64| {
|
||||
let obj = rect(s, x, 0.0, 20.0, 20.0);
|
||||
exec(s, "paint.setFill", json!({"ids": [obj.0], "color": {"c": 0, "m": 0, "y": 0, "k": 100}}));
|
||||
let blue = rect(s, x, 0.0, 20.0, 20.0);
|
||||
exec(s, "paint.setFill", json!({"ids": [blue.0], "color": "#0000ff"}));
|
||||
select(s, &[blue]);
|
||||
exec(s, "object.rasterize", json!({"ppi": 72}));
|
||||
let image = s.doc().unwrap().selection.objects[0];
|
||||
select(s, &[obj, image]);
|
||||
exec(s, "transparency.makeOpacityMask", json!({"clip": true}));
|
||||
obj
|
||||
};
|
||||
masked(&mut s, 0.0);
|
||||
let tile = masked(&mut s, 300.0);
|
||||
exec(&mut s, "object.pattern.make", json!({"ids": [tile.0], "name": "Masked Tile", "edit": false}));
|
||||
let band = rect(&mut s, 0.0, 100.0, 200.0, 40.0);
|
||||
exec(&mut s, "paint.setFill", json!({"ids": [band.0], "swatch": "Masked Tile"}));
|
||||
// An unmasked K100 square, for the color the masked one covers the page with.
|
||||
let solid = rect(&mut s, 100.0, 0.0, 20.0, 20.0);
|
||||
exec(&mut s, "paint.setFill", json!({"ids": [solid.0], "color": {"c": 0, "m": 0, "y": 0, "k": 100}}));
|
||||
let proof = vectorcraft_render::proof::ProofSetup {
|
||||
target: vectorcraft_render::proof::ProofTarget::Cmyk(cms::GENERIC_CMYK.into()),
|
||||
preserve_numbers: true,
|
||||
..Default::default()
|
||||
};
|
||||
let doc = s.doc().unwrap().doc.clone();
|
||||
let pixel = |px: &[u8], x: usize, y: usize| [px[(y * 200 + x) * 4], px[(y * 200 + x) * 4 + 1], px[(y * 200 + x) * 4 + 2]];
|
||||
// The masked square, the middle of a tile (the tiles start at the art's left and top edges,
|
||||
// every 20 points), the unmasked square and the bare page.
|
||||
let shown = |proof: Option<vectorcraft_render::proof::ProofSetup>| {
|
||||
let opts = RenderOptions { proof, background: Some([255, 255, 255, 255]), ..Default::default() };
|
||||
let px = Renderer::new().render(&doc, 200, 200, Affine::IDENTITY, &opts).pixels;
|
||||
(pixel(&px, 10, 10), pixel(&px, 50, 130), pixel(&px, 110, 10), pixel(&px, 190, 60))
|
||||
};
|
||||
let (plain, plain_tile, plain_k, plain_page) = shown(None);
|
||||
let (proofed, proofed_tile, proofed_k, proofed_page) = shown(Some(proof));
|
||||
let near = |a: [u8; 3], b: [u8; 3]| a.iter().zip(b).all(|(a, b)| (i32::from(*a) - i32::from(b)).abs() <= 2);
|
||||
assert!(plain != [255; 3] && near(plain, plain_tile), "the tile shows the masked square: {plain:?} vs {plain_tile:?}");
|
||||
assert!(near(proofed, proofed_tile), "the tile's mask covers as the square's does: {proofed:?} vs {proofed_tile:?}");
|
||||
// The proof changes the ink's color but not how much of the page the mask lets it cover.
|
||||
let channel = |v: [u8; 3], i: usize| f32::from(v[i]);
|
||||
let cover = (0..3).map(|i| (channel(plain_page, i) - channel(plain, i)) / (channel(plain_page, i) - channel(plain_k, i))).sum::<f32>() / 3.0;
|
||||
assert!(cover > 0.02 && cover < 0.98, "the mask covers part of the square: {cover}");
|
||||
let want: [u8; 3] =
|
||||
std::array::from_fn(|i| (channel(proofed_page, i) + cover * (channel(proofed_k, i) - channel(proofed_page, i))).round() as u8);
|
||||
assert!(near(proofed, want), "the proofed square keeps the mask's coverage: {proofed:?} vs {want:?}");
|
||||
}
|
||||
|
||||
/// Edit › Color Settings' color management policies decide what opening a document tagged with
|
||||
/// profiles other than the working spaces does with them: Preserve Embedded Profiles keeps them,
|
||||
/// Off and Preserve Numbers take them off and keep the color numbers, and Convert to Working Space
|
||||
|
||||
@@ -1158,6 +1158,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"",
|
||||
"{} open Saturate for the selection (dialog `saturate`, fields `intensity` −100..100, `preview`): previews live, OK runs edit.colors.saturate as one undo step",
|
||||
),
|
||||
(
|
||||
"ui.proofSetupDialog",
|
||||
"Customize…",
|
||||
"",
|
||||
"{} open View › Proof Setup › Customize (dialog `proofSetup`, fields `device` (\"workingCmyk\", \"cmyk:<profile>\" or \"rgb:<profile>\": any CMYK or RGB profile), `preserveNumbers`, `intent` (used while preserveNumbers is off), `simulatePaper` and `simulateBlack` (CMYK devices only), `preview` (on): Preview shows the proof on the canvas, OK runs view.proofSetup with these and proof: true, Cancel puts the earlier proof view back)",
|
||||
),
|
||||
(
|
||||
"ui.indexedColorDialog",
|
||||
"Convert to Indexed Color…",
|
||||
|
||||
@@ -321,6 +321,64 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// A proof that preserves the colors' numbers proofs an art brush's own colors, as it proofs
|
||||
/// the document's: the brush's blue shows as the simulated device shows that color's numbers.
|
||||
#[test]
|
||||
fn a_proof_that_preserves_numbers_proofs_brush_art() {
|
||||
use vectorcraft_brush::{ArtBrush, ArtScale, Brush, BrushKind, Colorization};
|
||||
use vectorcraft_color::cms;
|
||||
|
||||
let mut d = doc_with_line(Some("Blue art"), 1.0);
|
||||
let blue = Color::rgb(0.0, 0.0, 1.0);
|
||||
let art =
|
||||
Node::path(d.alloc_id(), shapes::rectangle(Rect::new(0.0, -10.0, 10.0, 10.0)), Appearance::basic(Paint::solid(blue), Paint::None, 0.0));
|
||||
let brush = Brush {
|
||||
name: "Blue art".into(),
|
||||
kind: BrushKind::Art(ArtBrush { art, scale: ArtScale::Stretch, colorization: Colorization::None, ..Default::default() }),
|
||||
};
|
||||
vectorcraft_brush::store(&mut d, &[brush]);
|
||||
let proof = cms::ProofSetup { target: cms::ProofTarget::Cmyk(cms::DEVICE_CMYK.into()), preserve_numbers: true, ..Default::default() };
|
||||
let want = cms::active().proof_color(&blue, &proof).map(|v| (v * 255.0).round() as i32);
|
||||
let opts = RenderOptions { proof: Some(proof), background: Some([255, 255, 255, 255]), ..Default::default() };
|
||||
let mut r = Renderer::new();
|
||||
for _ in 0..2 {
|
||||
let px = r.render(&d, 200, 100, Affine::IDENTITY, &opts).pixel(100, 50);
|
||||
assert!(want != [0, 0, 255], "{want:?}");
|
||||
assert!(px.iter().zip(want).all(|(p, w)| (i32::from(*p) - w).abs() <= 2), "{px:?} vs {want:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A proof that preserves the colors' numbers keeps the channels a CMYK document's filters run
|
||||
/// on: an art brush's Color Halftone screens ink channels with the proof on, as with it off.
|
||||
#[test]
|
||||
fn a_proof_that_preserves_numbers_keeps_cmyk_filter_channels() {
|
||||
use vectorcraft_brush::{ArtBrush, ArtScale, Brush, BrushKind, Colorization};
|
||||
use vectorcraft_color::cms;
|
||||
|
||||
let mut d = doc_with_line(Some("Halftone art"), 40.0);
|
||||
d.color_mode = vectorcraft_doc::ColorMode::Cmyk;
|
||||
let grey = Color::cmyk(0.3, 0.3, 0.3, 0.2);
|
||||
let mut art =
|
||||
Node::path(d.alloc_id(), shapes::rectangle(Rect::new(0.0, -10.0, 10.0, 10.0)), Appearance::basic(Paint::solid(grey), Paint::None, 0.0));
|
||||
art.appearance.effects =
|
||||
vec![vectorcraft_doc::Effect { id: "pixelate.colorHalftone".into(), params: serde_json::json!({"maxRadius": 4}), visible: true }];
|
||||
let brush = Brush {
|
||||
name: "Halftone art".into(),
|
||||
kind: BrushKind::Art(ArtBrush { art, scale: ArtScale::Stretch, colorization: Colorization::None, ..Default::default() }),
|
||||
};
|
||||
vectorcraft_brush::store(&mut d, &[brush]);
|
||||
let shown = |proof: Option<cms::ProofSetup>| {
|
||||
let opts = RenderOptions { proof, background: Some([255, 255, 255, 255]), ..Default::default() };
|
||||
Renderer::new().render(&d, 200, 100, Affine::IDENTITY, &opts).pixels
|
||||
};
|
||||
let plain = shown(None);
|
||||
assert!(plain.chunks(4).any(|p| p[..3] != [255, 255, 255]), "the brush draws");
|
||||
// The working CMYK space proofed from its own numbers shows the colors as they are shown.
|
||||
let proofed = shown(Some(cms::ProofSetup { target: cms::ProofTarget::WorkingCmyk, preserve_numbers: true, ..Default::default() }));
|
||||
let differ = plain.chunks(4).zip(proofed.chunks(4)).filter(|(a, b)| a.iter().zip(b.iter()).any(|(x, y)| x.abs_diff(*y) > 8)).count();
|
||||
assert!(differ * 100 < plain.len() / 4, "{differ} of {} pixels differ", plain.len() / 4);
|
||||
}
|
||||
|
||||
/// Object opacity fades a brushed stroke's art as a whole, with or without a dash and a fill:
|
||||
/// the same as the object at full opacity inside a group at that opacity.
|
||||
#[test]
|
||||
|
||||
@@ -124,7 +124,7 @@ impl Renderer {
|
||||
let channels = match f.ink.base() {
|
||||
Ink::Cmy => effects::pixel::Channels::CmyPlane,
|
||||
Ink::K => effects::pixel::Channels::KPlane,
|
||||
Ink::Display | Ink::RichBlack if f.doc.color_mode == vectorcraft_doc::ColorMode::Cmyk => effects::pixel::Channels::Cmyk,
|
||||
Ink::Display | Ink::RichBlack | Ink::Proofed(_) if f.doc.color_mode == vectorcraft_doc::ColorMode::Cmyk => effects::pixel::Channels::Cmyk,
|
||||
_ => effects::pixel::Channels::Rgb,
|
||||
};
|
||||
// What the content reads (as the raster kept for it found it, else found now), with the
|
||||
|
||||
+152
-9
@@ -12,6 +12,9 @@
|
||||
//! colours; RGB colours and placed images are separated into the working CMYK space first.
|
||||
//!
|
||||
//! RGB documents, and CMYK documents without transparency, draw screen colours ([`Ink::Display`]).
|
||||
//! A proof that preserves the colors' numbers draws each screen colour as the proof shows it
|
||||
//! ([`Ink::Proofed`]); a CMYK document that blends in CMYK keeps its ink planes, and [`compose`]
|
||||
//! shows their inks through the proof.
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
@@ -44,6 +47,10 @@ pub(crate) enum Ink {
|
||||
RichBlack,
|
||||
/// Source-color adjustment before the display/ink conversion. Float bits keep cache keys exact.
|
||||
Darkened(InkSpace, u32, bool),
|
||||
/// Screen colours as a proof that preserves the colors' numbers shows them
|
||||
/// ([`crate::proof::preserves`], [`Cms::proof_color`]): the proof [`proofed_ink`] registered
|
||||
/// under this number, so the caches keep what each proof draws apart.
|
||||
Proofed(u32),
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
@@ -52,6 +59,68 @@ pub(crate) enum InkSpace {
|
||||
Cmy,
|
||||
K,
|
||||
RichBlack,
|
||||
Proofed(u32),
|
||||
}
|
||||
|
||||
/// What [`Ink::Proofed`] paints with: its number, the color settings and the proof setup.
|
||||
type Proof = (u32, Arc<Cms>, vectorcraft_color::cms::ProofSetup, u64);
|
||||
|
||||
/// The proofs [`proofed_ink`] registered last, the newest last: a few, for renderers drawing with
|
||||
/// different ones.
|
||||
static PROOFS: Mutex<Vec<Arc<Proof>>> = Mutex::new(Vec::new());
|
||||
/// The last number [`proofed_ink`] gave out.
|
||||
static PROOF_NUMBER: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
|
||||
|
||||
thread_local! {
|
||||
/// The proof [`Ink::rgb`] used last on this thread, so a frame does not look it up for each
|
||||
/// color it paints.
|
||||
static LAST_PROOF: RefCell<Option<Arc<Proof>>> = const { RefCell::new(None) };
|
||||
}
|
||||
|
||||
/// Keeps the proof [`proofed_ink`] registered for a frame while the frame is drawn: a proof that
|
||||
/// something holds stays registered.
|
||||
pub(crate) struct ProofHold(#[allow(dead_code)] Arc<Proof>);
|
||||
|
||||
/// The ink a frame drawn with a proof that preserves the colors' numbers paints screen colours
|
||||
/// with: the same [`Ink::Proofed`] number for the same proof setup, active color settings and
|
||||
/// loaded profiles ([`cms::profiles_generation`]), and a new one when any of them changes. The
|
||||
/// proof stays registered while the hold returned with it is kept.
|
||||
pub(crate) fn proofed_ink(proof: &vectorcraft_color::cms::ProofSetup) -> (Ink, ProofHold) {
|
||||
let (c, profiles) = (cms::active(), cms::profiles_generation());
|
||||
let mut proofs = PROOFS.lock().unwrap_or_else(|e| e.into_inner());
|
||||
if let Some(p) = proofs.iter().find(|p| Arc::ptr_eq(&p.1, &c) && p.2 == *proof && p.3 == profiles) {
|
||||
return (Ink::Proofed(p.0), ProofHold(p.clone()));
|
||||
}
|
||||
let number = PROOF_NUMBER.fetch_add(1, Ordering::Relaxed).wrapping_add(1);
|
||||
// Past a few, the oldest proof nothing holds (no frame, no thread's last proof) goes.
|
||||
if proofs.len() >= 8
|
||||
&& let Some(i) = proofs.iter().position(|p| Arc::strong_count(p) == 1)
|
||||
{
|
||||
proofs.remove(i);
|
||||
}
|
||||
let p = Arc::new((number, c, proof.clone(), profiles));
|
||||
proofs.push(p.clone());
|
||||
(Ink::Proofed(number), ProofHold(p))
|
||||
}
|
||||
|
||||
/// The proof setup `ink` proofs with ([`Ink::Proofed`], darkened or not), while it is registered.
|
||||
pub(crate) fn proof_of(ink: Ink) -> Option<vectorcraft_color::cms::ProofSetup> {
|
||||
let Ink::Proofed(number) = ink.base() else { return None };
|
||||
PROOFS.lock().unwrap_or_else(|e| e.into_inner()).iter().find(|p| p.0 == number).map(|p| p.2.clone())
|
||||
}
|
||||
|
||||
/// Display sRGB of `c` as the proof [`proofed_ink`] registered under `number` shows it; a proof
|
||||
/// no longer registered shows the colour as it is.
|
||||
fn proofed_rgb(number: u32, c: &Color) -> [f32; 3] {
|
||||
let proof = LAST_PROOF.with(|l| l.borrow().clone().filter(|p| p.0 == number)).or_else(|| {
|
||||
let p = PROOFS.lock().unwrap_or_else(|e| e.into_inner()).iter().find(|p| p.0 == number).cloned();
|
||||
LAST_PROOF.with(|l| l.borrow_mut().clone_from(&p));
|
||||
p
|
||||
});
|
||||
match proof {
|
||||
Some(p) => p.1.proof_color(c, &p.2),
|
||||
None => c.to_rgb(),
|
||||
}
|
||||
}
|
||||
|
||||
impl Ink {
|
||||
@@ -61,6 +130,7 @@ impl Ink {
|
||||
Self::Darkened(InkSpace::Cmy, _, _) => Self::Cmy,
|
||||
Self::Darkened(InkSpace::K, _, _) => Self::K,
|
||||
Self::Darkened(InkSpace::RichBlack, _, _) => Self::RichBlack,
|
||||
Self::Darkened(InkSpace::Proofed(n), _, _) => Self::Proofed(n),
|
||||
other => other,
|
||||
}
|
||||
}
|
||||
@@ -74,6 +144,11 @@ impl Ink {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether this ink adjusts the source colors first ([`Ink::Darkened`]).
|
||||
pub(crate) fn is_darkened(self) -> bool {
|
||||
matches!(self, Self::Darkened(..))
|
||||
}
|
||||
|
||||
fn darkness(self) -> Option<f32> {
|
||||
match self {
|
||||
Self::Darkened(_, bits, _) => Some(f32::from_bits(bits)),
|
||||
@@ -96,6 +171,7 @@ impl Ink {
|
||||
Self::Cmy => InkSpace::Cmy,
|
||||
Self::K => InkSpace::K,
|
||||
Self::RichBlack => InkSpace::RichBlack,
|
||||
Self::Proofed(n) => InkSpace::Proofed(n),
|
||||
_ => InkSpace::Display,
|
||||
};
|
||||
Self::Darkened(space, amount.to_bits(), black)
|
||||
@@ -151,6 +227,7 @@ impl Ink {
|
||||
match (self, *c) {
|
||||
(Ink::RichBlack, Color::Cmyk { c, m, y, k }) if is_pure_black([c, m, y, k]) => [0.0; 3],
|
||||
(Ink::Display | Ink::RichBlack, _) => c.to_rgb(),
|
||||
(Ink::Proofed(n), _) => proofed_rgb(n, c),
|
||||
_ => self.plane(inks(c)),
|
||||
}
|
||||
}
|
||||
@@ -178,7 +255,7 @@ impl Ink {
|
||||
|
||||
pub(crate) fn fixed8(self, [r, g, b, a]: [u8; 4]) -> [u8; 4] {
|
||||
match self.base() {
|
||||
Ink::Display | Ink::RichBlack => [r, g, b, a],
|
||||
Ink::Display | Ink::RichBlack | Ink::Proofed(_) => [r, g, b, a],
|
||||
_ => {
|
||||
let lab = lab::srgb_to_lab([r, g, b].map(|v| v as f32 / 255.0));
|
||||
let [r, g, b] = self.plane(inks(&Color::Lab { l: lab.l, a: lab.a, b: lab.b })).map(q);
|
||||
@@ -319,6 +396,32 @@ fn cached<T>(slot: &Cached<T>, build: impl FnOnce(&Cms) -> T) -> (Arc<T>, u64) {
|
||||
(t, g)
|
||||
}
|
||||
|
||||
/// A table [`proofed_lut`] made, with the color settings, proof setup and profiles generation it
|
||||
/// was made for.
|
||||
type ProofedLut = (Arc<Cms>, vectorcraft_color::cms::ProofSetup, u64, Arc<InkLut>);
|
||||
|
||||
/// The tables [`proofed_lut`] made last, the newest last.
|
||||
static PROOFED: Mutex<Vec<ProofedLut>> = Mutex::new(Vec::new());
|
||||
|
||||
/// Ink amounts → their display sRGB as `proof` shows a CMYK color of those inks
|
||||
/// ([`Cms::proof_color`]), for the active color settings and loaded profiles. Cached.
|
||||
fn proofed_lut(proof: &vectorcraft_color::cms::ProofSetup) -> Arc<InkLut> {
|
||||
let (c, profiles) = (cms::active(), cms::profiles_generation());
|
||||
let mut kept = PROOFED.lock().unwrap_or_else(|e| e.into_inner());
|
||||
if let Some((.., t)) = kept.iter().find(|(o, p, g, _)| Arc::ptr_eq(o, &c) && p == proof && *g == profiles) {
|
||||
return t.clone();
|
||||
}
|
||||
let t = Arc::new(InkLut(CmykLut::build(|[cy, m, y, k]| {
|
||||
let [px, py, pz] = lab::srgb_to_xyz(c.proof_color(&Color::Cmyk { c: cy, m, y, k }, proof));
|
||||
[px, py, pz, 0.0]
|
||||
})));
|
||||
if kept.len() >= KEPT_TABLES {
|
||||
kept.remove(0);
|
||||
}
|
||||
kept.push((c, proof.clone(), profiles, t.clone()));
|
||||
t
|
||||
}
|
||||
|
||||
/// [`compose`] puts at least this many pixels in each band but the last.
|
||||
const BAND_PIXELS: usize = 1 << 16;
|
||||
|
||||
@@ -331,12 +434,19 @@ const BAND_PIXELS: usize = 1 << 16;
|
||||
/// each other band (this thread does when that one can't start). Returns the picture and the number
|
||||
/// of threads that composed it.
|
||||
pub(crate) fn compose(cmy: &[u8], k: &[u8], opts: &RenderOptions, threads: u16) -> (Vec<u8>, usize) {
|
||||
let (lut, _) = cached(&DISPLAY, InkLut::build);
|
||||
let bg = opts.background.map(|b| (Ink::Cmy.fixed8(b), Ink::K.fixed8(b), b));
|
||||
// With a proof that preserves the numbers, the inks show as the proof's device shows them,
|
||||
// and the background as it shows white paper.
|
||||
let lut = match crate::proof::preserving(opts) {
|
||||
Some(p) => proofed_lut(p),
|
||||
None => cached(&DISPLAY, InkLut::build).0,
|
||||
};
|
||||
let bg = opts.background.map(|b| (Ink::Cmy.fixed8(b), Ink::K.fixed8(b), crate::proof::under_art(opts, b)));
|
||||
let mut out = vec![0; cmy.len().min(k.len()) / 4 * 4];
|
||||
let pixels = out.len() / 4;
|
||||
let bands = (pixels / BAND_PIXELS).clamp(1, usize::from(threads).max(1));
|
||||
let band = |o: &mut [u8], p: &[u8], q: &[u8]| compose_band(o, p, q, &lut, bg, opts.rich_black);
|
||||
// A proof shows its device's black, not Appearance of Black's rich black.
|
||||
let rich_black = opts.rich_black && crate::proof::preserving(opts).is_none();
|
||||
let band = |o: &mut [u8], p: &[u8], q: &[u8]| compose_band(o, p, q, &lut, bg, rich_black);
|
||||
if bands == 1 {
|
||||
band(&mut out, cmy, k);
|
||||
return (out, 1);
|
||||
@@ -469,9 +579,9 @@ fn plane_key(key: &ImageKey, plane: Ink, generation: u64) -> ImageKey {
|
||||
/// The key [`ink_image`] gives image pixels `key` painted with `ink`.
|
||||
pub(crate) fn ink_key(key: &ImageKey, ink: Ink) -> ImageKey {
|
||||
if ink.darkness().is_some() {
|
||||
let generation = if matches!(ink.base(), Ink::Display | Ink::RichBlack) { 0 } else { separation().1 };
|
||||
let generation = if matches!(ink.base(), Ink::Display | Ink::RichBlack | Ink::Proofed(_)) { 0 } else { separation().1 };
|
||||
plane_key(key, ink, generation)
|
||||
} else if matches!(ink, Ink::Display | Ink::RichBlack) {
|
||||
} else if matches!(ink, Ink::Display | Ink::RichBlack | Ink::Proofed(_)) {
|
||||
key.clone()
|
||||
} else {
|
||||
plane_key(key, ink, separation().1)
|
||||
@@ -489,7 +599,7 @@ fn darkened_image(key: &ImageKey, pm: &Arc<Pixmap>, ink: Ink, amount: f32, blob:
|
||||
return (want, p);
|
||||
}
|
||||
let base = ink.base();
|
||||
let display = matches!(base, Ink::Display | Ink::RichBlack);
|
||||
let display = matches!(base, Ink::Display | Ink::RichBlack | Ink::Proofed(_));
|
||||
let raw_cmyk = key_inks(key, blob).filter(|i| (i.width, i.height) == (u32::from(pm.width()), u32::from(pm.height())));
|
||||
let sep = (!display).then(separation);
|
||||
let shown = (display && raw_cmyk.is_some()).then(display_lut);
|
||||
@@ -499,7 +609,8 @@ fn darkened_image(key: &ImageKey, pm: &Arc<Pixmap>, ink: Ink, amount: f32, blob:
|
||||
continue;
|
||||
}
|
||||
let rgb = if ink.black_endpoint() {
|
||||
base.rgb(&Color::gray(1.0))
|
||||
// Like the other pixels, a proofed black stays in display space; the plates proof it.
|
||||
if display { Ink::Display } else { base }.rgb(&Color::gray(1.0))
|
||||
} else if let Some(raw) = raw_cmyk.as_ref().and_then(|v| v.data.as_chunks::<4>().0.get(i)) {
|
||||
let mut inks = raw.map(|v| f32::from(v) / 255.0);
|
||||
inks[3] = (inks[3] + amount).min(1.0);
|
||||
@@ -527,7 +638,7 @@ pub(crate) fn ink_image(key: &ImageKey, pm: &Arc<Pixmap>, ink: Ink, blob: Option
|
||||
if let Some(amount) = ink.darkness() {
|
||||
return darkened_image(key, pm, ink, amount, blob, touch);
|
||||
}
|
||||
if matches!(ink, Ink::Display | Ink::RichBlack) {
|
||||
if matches!(ink, Ink::Display | Ink::RichBlack | Ink::Proofed(_)) {
|
||||
return (key.clone(), pm.clone());
|
||||
}
|
||||
let (luts, generation) = separation();
|
||||
@@ -601,6 +712,38 @@ mod tests {
|
||||
assert_eq!(pm.data()[0].r, 204, "source pixels remain unchanged");
|
||||
}
|
||||
|
||||
/// A fully darkened image drawn with a proof that preserves the colors' numbers shows black as
|
||||
/// that proof shows it: proofed once, as its other darkened pixels are.
|
||||
#[test]
|
||||
fn a_proofed_black_endpoint_image_is_proofed_once() {
|
||||
// Simulate Black Ink shows black as a gray, so a second proof would lighten it again.
|
||||
let proof = cms::ProofSetup { target: cms::ProofTarget::WorkingCmyk, preserve_numbers: true, simulate_black: true, ..Default::default() };
|
||||
let (ink, _hold) = proofed_ink(&proof);
|
||||
let dark = ink.darkened(1.0);
|
||||
assert!(dark.black_endpoint());
|
||||
let key = ImageKey {
|
||||
content: Arc::from("proofed-black-endpoint-regression"),
|
||||
adjust: None,
|
||||
grey: false,
|
||||
tint: None,
|
||||
ink: Ink::Display,
|
||||
luts: (0, 0),
|
||||
plates: 0,
|
||||
mip: 0,
|
||||
tile: None,
|
||||
};
|
||||
let pm = Arc::new(Pixmap::from_parts(vec![PremulRgba8 { r: 204, g: 102, b: 51, a: 255 }], 1, 1));
|
||||
let (k, p) = ink_image(&key, &pm, dark, None, false);
|
||||
let doc = Document::new(10.0, 10.0);
|
||||
let Some(lut) = crate::proof::ink_plate_lut(dark, &doc) else { panic!("a preserving proof has plate tables") };
|
||||
let (_, shown) = crate::proof::plate_image(&lut, &k, &p, None, false);
|
||||
// A pixel darkened to black in display space, proofed once.
|
||||
let want = cms::active().proof_srgb([0.0; 3], &proof).map(|v| (v * 255.0).round() as i32);
|
||||
let px = shown.data()[0];
|
||||
let got = [px.r, px.g, px.b].map(i32::from);
|
||||
assert!(got.iter().zip(want).all(|(g, w)| (g - w).abs() <= 2), "{got:?} vs {want:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tables_of_two_color_settings_are_kept_side_by_side() {
|
||||
// Two documents drawn in turn through their own settings each keep their tables.
|
||||
|
||||
@@ -191,6 +191,9 @@ fn rasterize(
|
||||
let symbols = doc.symbol_boxes().quick();
|
||||
r.stamp += 1;
|
||||
let px_rect = Rect::new(0.0, 0.0, w as f64, h as f64);
|
||||
// A tile drawn for a proof that preserves the colors' numbers shows its images through that
|
||||
// proof too.
|
||||
let plates = crate::proof::ink_plate_lut(ink, doc);
|
||||
for o in def.offsets_covering(region) {
|
||||
let v = view * def.instance_xf(o);
|
||||
let frame = Frame {
|
||||
@@ -203,7 +206,7 @@ fn rasterize(
|
||||
opts: &opts,
|
||||
ink,
|
||||
output: v,
|
||||
plates: None,
|
||||
plates: plates.as_deref(),
|
||||
};
|
||||
for a in &def.art {
|
||||
r.draw_arc(&mut ctx, &frame, a);
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
//!
|
||||
//! * **Proof Colors** post-processes the rendered frame: every pixel goes display sRGB → proof
|
||||
//! space (CMYK press or RGB/colour-blindness simulation) → display, through a cached 17³ LUT.
|
||||
//! With Preserve CMYK or RGB Numbers ([`preserves`]) each color is proofed from its own numbers
|
||||
//! as it is painted instead ([`crate::ink::Ink::Proofed`]), and placed images from their own
|
||||
//! inks or pixels ([`plate_image`]).
|
||||
//! * **Separations Preview** recolours the *document* before rendering: each paint colour is split
|
||||
//! into process inks (colour-managed), or a spot ink at the colour's tint when it's linked to a
|
||||
//! spot swatch (solid colours and gradient stops alike), with the process plates a gradient stop
|
||||
@@ -45,6 +48,21 @@ pub(crate) fn overprints(opts: &RenderOptions) -> bool {
|
||||
opts.overprint_preview || opts.proof.as_ref().is_some_and(|p| p.separations.is_some())
|
||||
}
|
||||
|
||||
/// Whether Proof Colors sends the colors' own numbers to the device it simulates (Preserve CMYK
|
||||
/// or RGB Numbers on a CMYK or RGB device, outside Separations Preview): each color is proofed as
|
||||
/// it is painted ([`crate::ink::Ink::Proofed`]) and placed images from their own inks or pixels
|
||||
/// ([`plate_image`]), and the drawn frame is not proofed again ([`post`]).
|
||||
pub(crate) fn preserves(proof: &ProofSetup) -> bool {
|
||||
proof.preserve_numbers
|
||||
&& proof.separations.is_none()
|
||||
&& matches!(proof.target, ProofTarget::WorkingCmyk | ProofTarget::Cmyk(_) | ProofTarget::Rgb(_))
|
||||
}
|
||||
|
||||
/// The proof of [`RenderOptions::proof`] when it [`preserves`] the colors' numbers.
|
||||
pub(crate) fn preserving(opts: &RenderOptions) -> Option<&ProofSetup> {
|
||||
opts.proof.as_ref().filter(|p| preserves(p))
|
||||
}
|
||||
|
||||
/// What the `visible` plates print of `ink`, as display sRGB, without the spot inks over several
|
||||
/// plates: with one plate visible its ink as a grey (black = 100%), else the visible process inks
|
||||
/// through the proof profile.
|
||||
@@ -141,10 +159,26 @@ pub(crate) struct PlateLut {
|
||||
}
|
||||
|
||||
impl PlateLut {
|
||||
/// What the visible plates show of process inks `cmyk`, as display sRGB.
|
||||
/// What the visible plates show of process inks `cmyk`, as display sRGB; with Preserve
|
||||
/// Numbers outside Separations Preview, the inks as the proof's device shows them.
|
||||
fn shown(&self, cmyk: [f32; 4]) -> [f32; 3] {
|
||||
let visible = self.proof.separations.as_deref().unwrap_or_default();
|
||||
plate_rgb(&self.cms, &self.proof, visible, &Inks { cmyk, spot: None, registration: false })
|
||||
match self.proof.separations.as_deref() {
|
||||
Some(visible) => plate_rgb(&self.cms, &self.proof, visible, &Inks { cmyk, spot: None, registration: false }),
|
||||
None => {
|
||||
let [c, m, y, k] = cmyk;
|
||||
self.cms.proof_color(&Color::Cmyk { c, m, y, k }, &self.proof)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// What display pixel `rgb` shows as: its inks separated with the proof's intent through the
|
||||
/// visible plates, or with Preserve Numbers outside Separations Preview, its numbers as the
|
||||
/// proof's device shows them.
|
||||
fn shown_rgb(&self, rgb: [f32; 3]) -> [f32; 3] {
|
||||
match self.proof.separations {
|
||||
Some(_) => self.shown(self.cms.srgb_to_cmyk(rgb, self.proof.intent)),
|
||||
None => self.cms.proof_srgb(rgb, &self.proof),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,10 +188,19 @@ static PLATE_LUTS: Mutex<Vec<Arc<PlateLut>>> = Mutex::new(Vec::new());
|
||||
/// The last [`PlateLut::generation`] handed out.
|
||||
static PLATE_GENERATION: AtomicU64 = AtomicU64::new(0);
|
||||
|
||||
/// The tables the placed images of `doc` show through in art drawn with `ink` apart from a frame's
|
||||
/// options (a pattern's tiles): with a proof that preserves the colors' numbers
|
||||
/// ([`crate::ink::Ink::Proofed`]), that proof's ([`plate_lut`]); else `None`.
|
||||
pub(crate) fn ink_plate_lut(ink: crate::ink::Ink, doc: &Document) -> Option<Arc<PlateLut>> {
|
||||
let proof = crate::ink::proof_of(ink)?;
|
||||
plate_lut(&RenderOptions { proof: Some(proof), ..Default::default() }, doc)
|
||||
}
|
||||
|
||||
/// The tables the placed images of `doc` show Separations Preview's visible plates through with
|
||||
/// `opts`, or `None` when it is off.
|
||||
/// `opts`, or their colors as a proof that [`preserves`] the numbers shows them; `None` when
|
||||
/// neither is on.
|
||||
pub(crate) fn plate_lut(opts: &RenderOptions, doc: &Document) -> Option<Arc<PlateLut>> {
|
||||
let proof = opts.proof.as_ref().filter(|p| p.separations.is_some())?;
|
||||
let proof = opts.proof.as_ref().filter(|p| p.separations.is_some() || preserves(p))?;
|
||||
let (c, profiles) = (cms::active(), cms::profiles_generation());
|
||||
// The spot ones are the spot plates of `vectorcraft_doc::inks::plates`; their colors are part
|
||||
// of the tables' identity, so a swatch edit shows.
|
||||
@@ -191,12 +234,17 @@ pub(crate) fn plate_image(lut: &PlateLut, key: &ImageKey, pm: &Pixmap, blob: Opt
|
||||
return (want, p);
|
||||
}
|
||||
// An image placed from a DCS file shows its own plates, spot plates included.
|
||||
if let Some(s) = blob.filter(|b| crate::ink::shows_own_inks(key) && b.is_separated()).and_then(ImageBlob::separated) {
|
||||
if let Some(s) =
|
||||
blob.filter(|b| lut.proof.separations.is_some() && crate::ink::shows_own_inks(key) && b.is_separated()).and_then(ImageBlob::separated)
|
||||
{
|
||||
let out = images::store().insert(want.clone(), Arc::new(plates_shown(lut, &s, pm)));
|
||||
return (want, out);
|
||||
}
|
||||
let size = (u32::from(pm.width()), u32::from(pm.height()));
|
||||
let raw = crate::ink::key_inks(key, blob).filter(|i| (i.width, i.height) == size);
|
||||
// A proof that preserves the numbers shows darkened pixels (a shadow's) as they are drawn,
|
||||
// not the image's own inks.
|
||||
let darkened = lut.proof.separations.is_none() && key.ink.is_darkened();
|
||||
let raw = crate::ink::key_inks(key, blob).filter(|i| !darkened && (i.width, i.height) == size);
|
||||
let mut out = pm.clone();
|
||||
match raw {
|
||||
Some(inks) => {
|
||||
@@ -213,7 +261,7 @@ pub(crate) fn plate_image(lut: &PlateLut, key: &ImageKey, pm: &Pixmap, blob: Opt
|
||||
}
|
||||
}
|
||||
None => {
|
||||
let t = lut.rgb.get_or_init(|| ProofLut::build(|rgb| lut.shown(lut.cms.srgb_to_cmyk(rgb, lut.proof.intent))));
|
||||
let t = lut.rgb.get_or_init(|| ProofLut::build(|rgb| lut.shown_rgb(rgb)));
|
||||
for px in out.data_mut().iter_mut().filter(|p| p.a > 0) {
|
||||
let a = f32::from(px.a);
|
||||
let un = |v: u8| (f32::from(v) / a).min(1.0);
|
||||
@@ -500,7 +548,7 @@ fn prepare_node(n: &Arc<Node>, earlier: Option<(&Arc<Node>, &Arc<Node>)>, how: &
|
||||
/// Soft-proof the rendered (premultiplied RGBA8) pixels in place.
|
||||
pub(crate) fn post(pixels: &mut [u8], opts: &RenderOptions) {
|
||||
let Some(proof) = opts.proof.as_ref() else { return };
|
||||
if proof.separations.is_some() || matches!(proof.target, ProofTarget::MonitorRgb | ProofTarget::Srgb) {
|
||||
if proof.separations.is_some() || preserves(proof) || matches!(proof.target, ProofTarget::MonitorRgb | ProofTarget::Srgb) {
|
||||
return;
|
||||
}
|
||||
let lut = cms::active().proof_lut(proof);
|
||||
@@ -525,6 +573,16 @@ pub(crate) fn post(pixels: &mut [u8], opts: &RenderOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Solid color `[r, g, b, a]` (straight alpha) under the art of a frame drawn with `opts`: with a
|
||||
/// proof that [`preserves`] the numbers, whose art [`prepare`] proofs before drawing, as the
|
||||
/// proof's device shows it (white paper takes Simulate Paper Color's tint), so the art's
|
||||
/// transparency and edges mix with it as they print; else as it is.
|
||||
pub(crate) fn under_art(opts: &RenderOptions, [r, g, b, a]: [u8; 4]) -> [u8; 4] {
|
||||
let Some(proof) = preserving(opts) else { return [r, g, b, a] };
|
||||
let [r, g, b] = cms::active().proof_srgb([r, g, b].map(|v| f32::from(v) / 255.0), proof).map(|v| (v.clamp(0.0, 1.0) * 255.0).round() as u8);
|
||||
[r, g, b, a]
|
||||
}
|
||||
|
||||
/// View-level proof state (View → Proof Setup / Proof Colors / Overprint Preview, Separations
|
||||
/// Preview panel). Process-wide: the app has one proof state for all windows.
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
|
||||
@@ -149,7 +149,16 @@ impl Renderer {
|
||||
let inv = view.inverse();
|
||||
let visible = inv.transform_rect_bbox(Rect::new(0.0, 0.0, w as f64, h as f64));
|
||||
let px = 1.0 / view.determinant().abs().sqrt().max(1e-12);
|
||||
let screen = if opts.rich_black { Ink::RichBlack } else { Ink::Display };
|
||||
// A proof that preserves the colors' numbers proofs each colour as it is painted; the hold
|
||||
// keeps that proof registered until the frame is drawn.
|
||||
let (screen, _proof) = match proof::preserving(opts) {
|
||||
Some(p) => {
|
||||
let (ink, hold) = ink::proofed_ink(p);
|
||||
(ink, Some(hold))
|
||||
}
|
||||
None if opts.rich_black => (Ink::RichBlack, None),
|
||||
None => (Ink::Display, None),
|
||||
};
|
||||
let symbols = doc.symbol_boxes().quick();
|
||||
let output = Affine::scale(1.0 / f64::from(cell.max(1))) * view;
|
||||
let plates = proof::plate_lut(opts, doc);
|
||||
@@ -169,10 +178,13 @@ impl Renderer {
|
||||
return Rendered { width: w as u32, height: h as u32, pixels };
|
||||
}
|
||||
let mut pixels = if inks || self.blends_in_cmyk(doc, opts) {
|
||||
// Blending in CMYK: one frame per ink plane, then their inks shown on screen.
|
||||
let cmy = self.draw_frame(&Frame { ink: Ink::Cmy, ..frame }, w, h);
|
||||
// Blending in CMYK: one frame per ink plane, then their inks shown on screen (through a
|
||||
// proof that preserves the numbers, when one is on: the planes hold the inks as they
|
||||
// are, images included).
|
||||
let planes = if proof::preserving(opts).is_some() { None } else { frame.plates };
|
||||
let cmy = self.draw_frame(&Frame { ink: Ink::Cmy, plates: planes, ..frame }, w, h);
|
||||
let stats = self.stats;
|
||||
let k = self.draw_frame(&Frame { ink: Ink::K, ..frame }, w, h);
|
||||
let k = self.draw_frame(&Frame { ink: Ink::K, plates: planes, ..frame }, w, h);
|
||||
self.stats = stats;
|
||||
if inks {
|
||||
ink::amounts(&cmy, &k)
|
||||
@@ -268,9 +280,16 @@ impl Renderer {
|
||||
ctx.set_aliasing_threshold(opts.anti_alias.threshold());
|
||||
self.raster = raster_settings(opts);
|
||||
if opts.artboards && !opts.outline {
|
||||
// Paper: white on screen, no ink on the ink planes.
|
||||
// Paper: white on screen, no ink on the ink planes; with a proof that preserves the
|
||||
// colors' numbers, the device's paper.
|
||||
ctx.set_transform(f.view);
|
||||
ctx.set_paint(peniko::Color::WHITE);
|
||||
match screen_under_art(f, [255; 4]) {
|
||||
[255, 255, 255, _] => ctx.set_paint(peniko::Color::WHITE),
|
||||
paper => {
|
||||
let [r, g, b, a] = f.ink.fixed8(paper);
|
||||
ctx.set_paint(peniko::Color::from_rgba8(r, g, b, a));
|
||||
}
|
||||
}
|
||||
for ab in &f.doc.artboards {
|
||||
ctx.fill_rect(&ab.rect);
|
||||
}
|
||||
@@ -295,7 +314,7 @@ impl Renderer {
|
||||
}
|
||||
let mut pixels = pm.data_as_u8_slice().to_vec();
|
||||
if let Some(bg) = opts.background {
|
||||
over_background(&mut pixels, f.ink.fixed8(bg));
|
||||
over_background(&mut pixels, f.ink.fixed8(screen_under_art(f, bg)));
|
||||
}
|
||||
pixels
|
||||
}
|
||||
@@ -465,6 +484,13 @@ fn raster_settings(opts: &RenderOptions) -> vello_cpu::RasterizerSettings {
|
||||
vello_cpu::RasterizerSettings { render_mode, ..Default::default() }
|
||||
}
|
||||
|
||||
/// Solid color `rgba` (straight alpha) under the art of frame `f`: on screen as
|
||||
/// [`proof::under_art`] gives it; the ink planes paint it as it is, and [`ink::compose`] shows it
|
||||
/// through the proof.
|
||||
fn screen_under_art(f: &Frame, rgba: [u8; 4]) -> [u8; 4] {
|
||||
if matches!(f.ink.base(), Ink::Cmy | Ink::K) { rgba } else { proof::under_art(f.opts, rgba) }
|
||||
}
|
||||
|
||||
/// Premultiplied RGBA `pixels` drawn over the solid color `background` (`[r, g, b, a]`, straight).
|
||||
pub(crate) fn over_background(pixels: &mut [u8], [r, g, b, a]: [u8; 4]) {
|
||||
let alpha = u32::from(a);
|
||||
|
||||
@@ -308,7 +308,11 @@ impl Renderer {
|
||||
let image_left_out = self.image_left_out.replace(false);
|
||||
let failures = crate::paint::decode_failures();
|
||||
let pattern_images_left_out = crate::pattern::images_left_out();
|
||||
self.draw_kept_node(&mut mctx, &Frame { mt: false, ink: Ink::Display, ..*f }, &m.art);
|
||||
// A proof that preserves the colors' numbers leaves the mask's images as they are, as it
|
||||
// leaves its colors: the frame's, or the ink's in a pattern's tile drawn for that proof.
|
||||
let preserving = crate::proof::preserving(f.opts).is_some() || crate::ink::proof_of(f.ink).is_some_and(|p| crate::proof::preserves(&p));
|
||||
let plates = if preserving { None } else { f.plates };
|
||||
self.draw_kept_node(&mut mctx, &Frame { mt: false, ink: Ink::Display, plates, ..*f }, &m.art);
|
||||
let incomplete = self.image_left_out.unwrap_or(false)
|
||||
|| crate::pattern::images_left_out() > pattern_images_left_out
|
||||
|| (!f.opts.mark_undecoded_images && crate::paint::decode_failures() > failures);
|
||||
|
||||
@@ -106,6 +106,7 @@ mod png_options;
|
||||
pub mod print;
|
||||
pub mod print_presets;
|
||||
pub mod profile_mismatch;
|
||||
pub mod proof_setup;
|
||||
pub mod psd_import;
|
||||
mod psd_options;
|
||||
pub mod raster_effects;
|
||||
@@ -371,6 +372,7 @@ registry! {
|
||||
ColorGuideOptions: [color_guide_options::KIND] => color_guide_options::SPEC,
|
||||
ColorBalance: [color_balance::KIND] => color_balance::SPEC,
|
||||
Saturate: [saturate::KIND] => saturate::SPEC,
|
||||
ProofSetup: [proof_setup::KIND] => proof_setup::SPEC,
|
||||
IndexedColor: [indexed_color::KIND] => indexed_color::SPEC,
|
||||
SaveSwatchLibrary: [save_swatch_library::KIND] => save_swatch_library::SPEC,
|
||||
TileEdgeColor: [tile_edge_color::KIND] => tile_edge_color::SPEC,
|
||||
@@ -788,6 +790,9 @@ pub fn cancel(app: &mut VectorcraftApp) {
|
||||
if d.kind == script_run::NOTICE_KIND {
|
||||
script_run::notice_cancel(app, &d);
|
||||
}
|
||||
if d.kind == proof_setup::KIND {
|
||||
proof_setup::cancel(app, &d);
|
||||
}
|
||||
if d.kind == script_run::PICKER_KIND {
|
||||
script_run::picker_cancel(app, &d);
|
||||
}
|
||||
@@ -843,13 +848,15 @@ pub fn confirm(app: &mut VectorcraftApp) -> DialogResult {
|
||||
}
|
||||
|
||||
/// After a dialog closes, and each frame: a Missing Fonts dialog that another dialog replaced waits
|
||||
/// for its turn again, the search a Missing Fonts or Find Linked Files dialog started stops once
|
||||
/// that dialog is gone, and with no dialog open the choice about a stopped plug-in that another
|
||||
/// for its turn again, a Proof Setup preview that another dialog replaced is undone, the search a
|
||||
/// Missing Fonts or Find Linked Files dialog started stops once that dialog is gone, and with no
|
||||
/// dialog open the choice about a stopped plug-in that another
|
||||
/// dialog replaced opens again, else the questions about the next restored document's linked files
|
||||
/// ([`crate::recovery::ask_next`]), else the next document's Missing Fonts dialog (one dialog at a
|
||||
/// time).
|
||||
pub(crate) fn settle(app: &mut VectorcraftApp) {
|
||||
crate::placing::settle_swatch_paste(app);
|
||||
proof_setup::restore_replaced(app);
|
||||
profile_mismatch::settle(app);
|
||||
missing_fonts::requeue_replaced(app);
|
||||
missing_fonts::stop_when_closed(app);
|
||||
|
||||
@@ -0,0 +1,572 @@
|
||||
//! View → Proof Setup → Customize…: the device to simulate (the working CMYK space, or any CMYK or
|
||||
//! RGB profile), Preserve CMYK Numbers or Preserve RGB Numbers, the rendering intent (used while
|
||||
//! the numbers are not preserved), Simulate Paper Color and Simulate Black Ink (CMYK devices only).
|
||||
//! Preview shows the proof on the canvas while the dialog is open; OK sets the proof setup and
|
||||
//! turns Proof Colors on (`view.proofSetup`), and Cancel puts the earlier proof view back.
|
||||
//!
|
||||
//! Fields: `device` (`workingCmyk`, `cmyk:<profile>` or `rgb:<profile>`), `preserveNumbers`,
|
||||
//! `intent`, `simulatePaper`, `simulateBlack` and `preview`.
|
||||
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_color::cms::{self, Intent, ProfileKind, ProofTarget};
|
||||
use vectorcraft_render::proof;
|
||||
|
||||
use super::{DialogSpec, form};
|
||||
use crate::VectorcraftApp;
|
||||
use crate::state::Dialog;
|
||||
use crate::widgets;
|
||||
|
||||
/// The dialog kind of Proof Setup › Customize.
|
||||
pub const KIND: &str = "proofSetup";
|
||||
|
||||
const CMD: &str = "view.proofSetup";
|
||||
|
||||
/// The proof view as the dialog found it, which Cancel puts back after a preview.
|
||||
const BEFORE: &str = "__before";
|
||||
/// The settings the canvas shows while Preview is on, as last sent.
|
||||
const PREVIEWED: &str = "__previewed";
|
||||
|
||||
/// The device a proof target that is not a device (an RGB display or a color blindness type)
|
||||
/// starts the dialog on.
|
||||
const WORKING: &str = "workingCmyk";
|
||||
|
||||
const LABEL_W: f32 = 140.0;
|
||||
|
||||
pub(super) const SPEC: DialogSpec = DialogSpec { heading: |_| tl!("Proof Setup").into(), body, confirm, min_width: 420.0, ..DialogSpec::FORM };
|
||||
|
||||
/// Open the dialog on the current proof setup. While it is open, it stays as it is, so Cancel
|
||||
/// still puts back the view it found first.
|
||||
pub fn open(app: &mut VectorcraftApp) {
|
||||
if app.ui.dialog.as_ref().is_some_and(|d| d.kind == KIND) {
|
||||
return;
|
||||
}
|
||||
// A preview whose dialog another one replaced is undone before this dialog takes the view.
|
||||
restore_replaced(app);
|
||||
let v = proof::view();
|
||||
let s = &v.setup;
|
||||
let device = match &s.target {
|
||||
ProofTarget::WorkingCmyk | ProofTarget::Cmyk(_) | ProofTarget::Rgb(_) => s.target.id(),
|
||||
_ => WORKING.to_string(),
|
||||
};
|
||||
let before = snapshot(&v);
|
||||
app.ui.dialog = Some(Dialog::new(
|
||||
KIND,
|
||||
json!({
|
||||
"device": device,
|
||||
"preserveNumbers": s.preserve_numbers,
|
||||
"intent": s.intent.id(),
|
||||
"simulatePaper": s.simulate_paper,
|
||||
"simulateBlack": s.simulate_black,
|
||||
"preview": true,
|
||||
BEFORE: before,
|
||||
}),
|
||||
));
|
||||
}
|
||||
|
||||
/// The parts of the proof view `v` that Cancel puts back, as the dialog keeps them in `BEFORE`.
|
||||
fn snapshot(v: &proof::ProofView) -> Value {
|
||||
let s = &v.setup;
|
||||
json!({
|
||||
"target": s.target.id(),
|
||||
"intent": s.intent.id(),
|
||||
"simulatePaper": s.simulate_paper,
|
||||
"preserveNumbers": s.preserve_numbers,
|
||||
"simulateBlack": s.simulate_black,
|
||||
"proof": v.proof_colors,
|
||||
})
|
||||
}
|
||||
|
||||
/// The devices to simulate, as (`device` value, name shown): the working CMYK space, then every
|
||||
/// CMYK profile and every RGB profile.
|
||||
fn devices() -> Vec<(String, String)> {
|
||||
let profiles = cms::profiles();
|
||||
let of = |kind: ProfileKind, prefix: &str| {
|
||||
profiles.iter().filter(move |p| p.kind == kind).map(move |p| (format!("{prefix}{}", p.name), p.name.clone())).collect::<Vec<_>>()
|
||||
};
|
||||
std::iter::once((WORKING.to_string(), tl!("Working CMYK").to_string()))
|
||||
.chain(of(ProfileKind::Cmyk, "cmyk:"))
|
||||
.chain(of(ProfileKind::Rgb, "rgb:"))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Whether `device` is an RGB profile.
|
||||
fn rgb_device(device: &str) -> bool {
|
||||
device.starts_with("rgb:")
|
||||
}
|
||||
|
||||
/// What OK sends to `view.proofSetup`.
|
||||
fn params(d: &Dialog) -> Value {
|
||||
json!({
|
||||
"target": d.str("device"),
|
||||
"preserveNumbers": d.bool("preserveNumbers"),
|
||||
"intent": d.str("intent"),
|
||||
"simulatePaper": d.bool("simulatePaper"),
|
||||
"simulateBlack": d.bool("simulateBlack"),
|
||||
"proof": true,
|
||||
})
|
||||
}
|
||||
|
||||
fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
|
||||
let devices = devices();
|
||||
let device = d.str("device");
|
||||
// A profile that is no longer loaded shows its name as it is.
|
||||
let shown =
|
||||
devices.iter().find(|(id, _)| *id == device).map_or_else(|| device.split_once(':').map_or(device.as_str(), |(_, n)| n), |(_, n)| n.as_str());
|
||||
let names: Vec<&str> = devices.iter().map(|(_, n)| n.as_str()).collect();
|
||||
widgets::label_row(ui, tl!("Device to Simulate:"), LABEL_W, |ui| {
|
||||
if let Some((id, _)) = widgets::dropdown_names(ui, "proof-setup-device", shown, &names, 260.0).and_then(|i| devices.get(i)) {
|
||||
d.fields.insert("device".into(), json!(id));
|
||||
}
|
||||
});
|
||||
ui.add_space(4.0);
|
||||
let rgb = rgb_device(&d.str("device"));
|
||||
let preserve = if rgb { tl!("Preserve RGB Numbers") } else { tl!("Preserve CMYK Numbers") };
|
||||
form::check(ui, d, "preserveNumbers", preserve);
|
||||
let intents: Vec<(&str, &str)> = Intent::ALL.iter().map(|i| (i.id(), i.label())).collect();
|
||||
ui.add_enabled_ui(!d.bool("preserveNumbers"), |ui| form::choice(ui, d, "intent", tl!("Rendering intent:"), (LABEL_W, 200.0), &intents));
|
||||
ui.add_space(4.0);
|
||||
// Paper and black ink are a printing press's: an RGB device has neither.
|
||||
let paper = d.bool("simulatePaper");
|
||||
if widgets::check(ui, tl!("Simulate Paper Color"), paper && !rgb, !rgb) {
|
||||
d.fields.insert("simulatePaper".into(), json!(!paper));
|
||||
}
|
||||
// Simulate Paper Color shows the press black too, so the box shows checked while it is on.
|
||||
let black = d.bool("simulateBlack");
|
||||
if widgets::check(ui, tl!("Simulate Black Ink"), (black || paper) && !rgb, !rgb && !paper) {
|
||||
d.fields.insert("simulateBlack".into(), json!(!black));
|
||||
}
|
||||
ui.add_space(8.0);
|
||||
form::preview_check(ui, d);
|
||||
preview(app, d);
|
||||
false
|
||||
}
|
||||
|
||||
/// While Preview is on, the canvas shows the dialog's settings, sent again whenever they change;
|
||||
/// turned off, the earlier proof view comes back.
|
||||
fn preview(app: &mut VectorcraftApp, d: &mut Dialog) {
|
||||
// Back from under another dialog that undid its preview, the dialog starts from the view the
|
||||
// canvas shows now and previews again.
|
||||
if d.fields.contains_key(PREVIEWED) && app.ui.proof_preview.is_none() {
|
||||
d.fields.remove(PREVIEWED);
|
||||
}
|
||||
if d.bool("preview") {
|
||||
let p = params(d);
|
||||
if d.fields.get(PREVIEWED) != Some(&p) {
|
||||
// A preview that starts while the canvas shows no preview of this dialog (none yet, or a
|
||||
// proof setup a command set since) takes the view the canvas shows now as the one to
|
||||
// put back.
|
||||
let v = proof::view();
|
||||
let start = match &app.ui.proof_preview {
|
||||
Some((_, previewed)) if dialog_part(&v) == dialog_part(previewed) => None,
|
||||
_ => Some(snapshot(&v)),
|
||||
};
|
||||
match app.run(CMD, p.clone()) {
|
||||
Ok(_) => {
|
||||
if let Some(before) = start {
|
||||
d.fields.insert(BEFORE.into(), before);
|
||||
}
|
||||
d.fields.insert(PREVIEWED.into(), p);
|
||||
app.ui.proof_preview = d.fields.get(BEFORE).map(|b| (b.clone(), proof::view()));
|
||||
}
|
||||
Err(e) => app.ui.status = e,
|
||||
}
|
||||
}
|
||||
} else if d.fields.remove(PREVIEWED).is_some() {
|
||||
restore(app);
|
||||
}
|
||||
}
|
||||
|
||||
/// Put back the proof view the dialog found before its preview. A proof setup set since the
|
||||
/// preview (by `view.proofSetup`, for example) stays.
|
||||
fn restore(app: &mut VectorcraftApp) {
|
||||
if let Some((before, previewed)) = app.ui.proof_preview.take()
|
||||
&& dialog_part(&proof::view()) == dialog_part(&previewed)
|
||||
{
|
||||
set_view(app, &before);
|
||||
}
|
||||
}
|
||||
|
||||
/// When another dialog has taken the place of a previewing Proof Setup dialog, put back the proof
|
||||
/// view that dialog found.
|
||||
pub(super) fn restore_replaced(app: &mut VectorcraftApp) {
|
||||
if !app.ui.dialog.as_ref().is_some_and(|d| d.kind == KIND) {
|
||||
restore(app);
|
||||
}
|
||||
}
|
||||
|
||||
/// The parts of a proof view the dialog sets: the device, the intent, the three options and Proof
|
||||
/// Colors.
|
||||
fn dialog_part(v: &proof::ProofView) -> (&ProofTarget, Intent, bool, bool, bool, bool) {
|
||||
let s = &v.setup;
|
||||
(&s.target, s.intent, s.simulate_paper, s.preserve_numbers, s.simulate_black, v.proof_colors)
|
||||
}
|
||||
|
||||
/// Set the proof view `before` holds and redraw the documents. The view is set directly, not
|
||||
/// through `view.proofSetup`, which refuses a device profile removed since it was set.
|
||||
fn set_view(app: &mut VectorcraftApp, before: &Value) {
|
||||
let text = |k: &str| before.get(k).and_then(Value::as_str).unwrap_or_default();
|
||||
let on = |k: &str| before.get(k).and_then(Value::as_bool).unwrap_or_default();
|
||||
let (Some(target), Some(intent)) = (ProofTarget::parse(text("target")), Intent::parse(text("intent"))) else { return };
|
||||
let mut v = proof::view();
|
||||
let was = v.clone();
|
||||
v.setup.target = target;
|
||||
v.setup.intent = intent;
|
||||
v.setup.simulate_paper = on("simulatePaper");
|
||||
v.setup.preserve_numbers = on("preserveNumbers");
|
||||
v.setup.simulate_black = on("simulateBlack");
|
||||
v.proof_colors = on("proof");
|
||||
if v == was {
|
||||
return;
|
||||
}
|
||||
proof::set_view(v);
|
||||
let uids: Vec<u64> = app.session.documents().iter().map(|d| d.uid).collect();
|
||||
for uid in uids {
|
||||
if let Some(d) = app.session.document_mut(uid) {
|
||||
d.revision += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
|
||||
let r = app.run(CMD, params(d))?;
|
||||
app.ui.proof_preview = None;
|
||||
app.ui.dialog = None;
|
||||
Ok(r)
|
||||
}
|
||||
|
||||
/// Cancel: after a preview, the earlier proof view comes back.
|
||||
pub(super) fn cancel(app: &mut VectorcraftApp, d: &Dialog) {
|
||||
if d.fields.contains_key(PREVIEWED) {
|
||||
restore(app);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use vectorcraft_engine::Session;
|
||||
|
||||
/// Proof views are process-wide: these tests take turns, and each leaves the default view.
|
||||
static VIEW: std::sync::Mutex<()> = std::sync::Mutex::new(());
|
||||
|
||||
struct DefaultView<'a>(#[allow(dead_code)] std::sync::MutexGuard<'a, ()>);
|
||||
|
||||
impl DefaultView<'_> {
|
||||
fn new() -> Self {
|
||||
let g = VIEW.lock().unwrap_or_else(|e| e.into_inner());
|
||||
proof::set_view(Default::default());
|
||||
DefaultView(g)
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for DefaultView<'_> {
|
||||
fn drop(&mut self) {
|
||||
proof::set_view(Default::default());
|
||||
}
|
||||
}
|
||||
|
||||
fn frame(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| super::super::show(app, ui.ctx()));
|
||||
out.textures_delta.clear();
|
||||
}
|
||||
|
||||
fn app() -> (VectorcraftApp, egui::Context) {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({})).unwrap();
|
||||
let ctx = egui::Context::default();
|
||||
crate::theme::install_fonts(&ctx);
|
||||
(app, ctx)
|
||||
}
|
||||
|
||||
/// View › Proof Setup › Customize… opens the dialog on the current proof setup; OK sets the
|
||||
/// device, Preserve Numbers, the intent and Simulate Black Ink, and turns Proof Colors on.
|
||||
#[test]
|
||||
fn customize_sets_the_proof_setup_and_turns_proof_colors_on() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, ctx) = app();
|
||||
let item = crate::menus::menu_entries(&app).into_iter().find(|e| e.path == ["View", "Proof Setup"] && e.label == "Customize…").unwrap();
|
||||
app.run(item.command.as_deref().unwrap(), item.params.clone()).unwrap();
|
||||
let d = app.ui.dialog.as_ref().unwrap();
|
||||
assert_eq!(d.kind, KIND);
|
||||
assert_eq!((d.str("device"), d.str("intent"), d.bool("preserveNumbers")), (WORKING.to_string(), "relative".to_string(), false));
|
||||
frame(&mut app, &ctx);
|
||||
let device = format!("cmyk:{}", cms::DEVICE_CMYK);
|
||||
let d = app.ui.dialog.as_mut().unwrap();
|
||||
for (k, v) in [("device", json!(device)), ("intent", json!("perceptual")), ("simulateBlack", json!(true)), ("preview", json!(false))] {
|
||||
d.fields.insert(k.into(), v);
|
||||
}
|
||||
super::super::confirm(&mut app).unwrap();
|
||||
assert!(app.ui.dialog.is_none());
|
||||
let v = proof::view();
|
||||
assert!(v.proof_colors);
|
||||
assert_eq!(v.setup.target, ProofTarget::Cmyk(cms::DEVICE_CMYK.into()));
|
||||
assert_eq!(v.setup.intent, Intent::Perceptual);
|
||||
assert!(v.setup.simulate_black && !v.setup.preserve_numbers && !v.setup.simulate_paper);
|
||||
// Opened again, it shows those settings, and the menu checks Customize….
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
let d = app.ui.dialog.as_ref().unwrap();
|
||||
assert_eq!((d.str("device"), d.str("intent"), d.bool("simulateBlack")), (device, "perceptual".to_string(), true));
|
||||
assert_eq!(crate::menus::checked(&app, "ui.proofSetupDialog", &json!({})), Some(true));
|
||||
super::super::cancel(&mut app);
|
||||
}
|
||||
|
||||
/// Preview shows the dialog's settings on the canvas at once, follows their changes, and
|
||||
/// Cancel (or turning Preview off) puts the earlier proof view back.
|
||||
#[test]
|
||||
fn preview_shows_the_settings_and_cancel_puts_the_view_back() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, ctx) = app();
|
||||
app.run("view.proofSetup", json!({"target": "protanopia"})).unwrap();
|
||||
let before = proof::view();
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
assert_eq!(app.ui.dialog.as_ref().unwrap().str("device"), WORKING, "a color blindness proof starts on the working CMYK");
|
||||
let rgb = format!("rgb:{}", cms::DISPLAY_P3);
|
||||
let d = app.ui.dialog.as_mut().unwrap();
|
||||
d.fields.insert("device".into(), json!(rgb));
|
||||
d.fields.insert("preserveNumbers".into(), json!(true));
|
||||
frame(&mut app, &ctx);
|
||||
let v = proof::view();
|
||||
assert!(v.proof_colors, "the preview turns Proof Colors on");
|
||||
assert_eq!(v.setup.target, ProofTarget::Rgb(cms::DISPLAY_P3.into()));
|
||||
assert!(v.setup.preserve_numbers);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("preview".into(), json!(false));
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view(), before, "Preview off puts the view back");
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("preview".into(), json!(true));
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view().setup.target, ProofTarget::Rgb(cms::DISPLAY_P3.into()));
|
||||
super::super::cancel(&mut app);
|
||||
assert!(app.ui.dialog.is_none());
|
||||
assert_eq!(proof::view(), before, "Cancel puts the view back");
|
||||
}
|
||||
|
||||
/// Cancel and Preview off put back a proof view whose device profile was removed after it was
|
||||
/// set, and redraw the documents.
|
||||
#[test]
|
||||
fn cancel_puts_back_a_view_whose_profile_was_removed() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, ctx) = app();
|
||||
let name = "Proof Setup Removed RGB";
|
||||
cms::register_icc(&cms::icc_bytes(cms::DISPLAY_P3).unwrap(), Some(name.into())).unwrap();
|
||||
app.run("view.proofSetup", json!({"target": format!("rgb:{name}"), "proof": true})).unwrap();
|
||||
app.run("color.removeProfile", json!({"name": name})).unwrap();
|
||||
let before = proof::view();
|
||||
assert_eq!(before.setup.target, ProofTarget::Rgb(name.into()), "removing the profile leaves it the device");
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("device".into(), json!(WORKING));
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view().setup.target, ProofTarget::WorkingCmyk, "the preview shows the working CMYK");
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("preview".into(), json!(false));
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view(), before, "Preview off puts the view back");
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("preview".into(), json!(true));
|
||||
frame(&mut app, &ctx);
|
||||
let revision = app.session.doc().unwrap().revision;
|
||||
super::super::cancel(&mut app);
|
||||
assert!(app.ui.dialog.is_none());
|
||||
assert_eq!(proof::view(), before, "Cancel puts the view back");
|
||||
assert!(app.session.doc().unwrap().revision > revision, "the document redraws");
|
||||
}
|
||||
|
||||
/// Run again while the dialog is open, Proof Setup keeps the dialog as it is, so Cancel still
|
||||
/// puts back the view it found the first time.
|
||||
#[test]
|
||||
fn running_proof_setup_again_keeps_the_open_dialog() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, ctx) = app();
|
||||
let before = proof::view();
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
let rgb = format!("rgb:{}", cms::DISPLAY_P3);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("device".into(), json!(rgb));
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view().setup.target, ProofTarget::Rgb(cms::DISPLAY_P3.into()));
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
assert_eq!(app.ui.dialog.as_ref().unwrap().str("device"), rgb, "the open dialog stays as it is");
|
||||
super::super::cancel(&mut app);
|
||||
assert_eq!(proof::view(), before, "Cancel puts back the view the first run found");
|
||||
}
|
||||
|
||||
/// When another dialog (Saturate) takes the place of a previewing Proof Setup dialog, the proof
|
||||
/// view the dialog found comes back, and a later Proof Setup starts from that view.
|
||||
#[test]
|
||||
fn another_dialog_in_its_place_puts_the_view_back() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, ctx) = app();
|
||||
let before = proof::view();
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
let rgb = format!("rgb:{}", cms::DISPLAY_P3);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("device".into(), json!(rgb));
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view().setup.target, ProofTarget::Rgb(cms::DISPLAY_P3.into()), "the preview shows");
|
||||
app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50})).unwrap();
|
||||
app.run("ui.saturateDialog", json!({})).unwrap();
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(app.ui.dialog.as_ref().unwrap().kind, super::super::saturate::KIND);
|
||||
assert_eq!(proof::view(), before, "the preview is undone");
|
||||
super::super::cancel(&mut app);
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
assert_eq!(app.ui.dialog.as_ref().unwrap().str("device"), WORKING, "the next Proof Setup starts from the view it found");
|
||||
super::super::cancel(&mut app);
|
||||
assert_eq!(proof::view(), before);
|
||||
}
|
||||
|
||||
/// Opened again before a frame has drawn the dialog that replaced a previewing Proof Setup
|
||||
/// dialog, Proof Setup starts from the view the first dialog found, and Cancel keeps it.
|
||||
#[test]
|
||||
fn reopened_before_a_frame_starts_from_the_view_it_found() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, ctx) = app();
|
||||
let before = proof::view();
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
let rgb = format!("rgb:{}", cms::DISPLAY_P3);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("device".into(), json!(rgb));
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view().setup.target, ProofTarget::Rgb(cms::DISPLAY_P3.into()), "the preview shows");
|
||||
app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50})).unwrap();
|
||||
app.run("ui.saturateDialog", json!({})).unwrap();
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
assert_eq!(proof::view(), before, "the preview is undone");
|
||||
assert_eq!(app.ui.dialog.as_ref().unwrap().str("device"), WORKING);
|
||||
super::super::cancel(&mut app);
|
||||
assert_eq!(proof::view(), before, "Cancel keeps the view the first dialog found");
|
||||
}
|
||||
|
||||
/// A proof view set after another dialog replaced a previewing Proof Setup dialog, before a
|
||||
/// frame, stays: the preview is not put back over it.
|
||||
#[test]
|
||||
fn a_view_set_after_the_replacement_stays() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, ctx) = app();
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
let rgb = format!("rgb:{}", cms::DISPLAY_P3);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("device".into(), json!(rgb));
|
||||
frame(&mut app, &ctx);
|
||||
app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50})).unwrap();
|
||||
app.run("ui.saturateDialog", json!({})).unwrap();
|
||||
app.run("view.proofSetup", json!({"target": "protanopia", "proof": true})).unwrap();
|
||||
let set = proof::view();
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view(), set, "the view set after the replacement stays");
|
||||
super::super::cancel(&mut app);
|
||||
assert_eq!(proof::view(), set);
|
||||
}
|
||||
|
||||
/// Overprint Preview turned on during the preview stays on when another dialog replaces the
|
||||
/// dialog, and the proof setup the dialog found comes back.
|
||||
#[test]
|
||||
fn overprint_set_during_the_preview_stays_after_the_replacement() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, ctx) = app();
|
||||
let before = proof::view();
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
let rgb = format!("rgb:{}", cms::DISPLAY_P3);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("device".into(), json!(rgb));
|
||||
frame(&mut app, &ctx);
|
||||
app.run("view.overprintPreview", json!({"on": true})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50})).unwrap();
|
||||
app.run("ui.saturateDialog", json!({})).unwrap();
|
||||
frame(&mut app, &ctx);
|
||||
let v = proof::view();
|
||||
assert!(v.overprint, "Overprint Preview stays on");
|
||||
assert_eq!((v.setup, v.proof_colors), (before.setup, before.proof_colors), "the proof setup comes back");
|
||||
super::super::cancel(&mut app);
|
||||
}
|
||||
|
||||
/// Back from under a dialog opened over it (here Saturate, as a file-replacement question is),
|
||||
/// which undid the preview, the dialog previews its settings again, and Cancel puts back the
|
||||
/// view it found.
|
||||
#[test]
|
||||
fn back_from_under_another_dialog_it_previews_again() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, ctx) = app();
|
||||
let before = proof::view();
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
let rgb = format!("rgb:{}", cms::DISPLAY_P3);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("device".into(), json!(rgb));
|
||||
frame(&mut app, &ctx);
|
||||
let under = app.ui.dialog.clone().unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50})).unwrap();
|
||||
app.run("ui.saturateDialog", json!({})).unwrap();
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert(super::super::PARENT.into(), serde_json::to_value(under).unwrap());
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view(), before, "the preview is undone while the other dialog shows");
|
||||
super::super::cancel(&mut app);
|
||||
assert_eq!(app.ui.dialog.as_ref().unwrap().kind, KIND, "Proof Setup comes back");
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view().setup.target, ProofTarget::Rgb(cms::DISPLAY_P3.into()), "the preview shows again");
|
||||
super::super::cancel(&mut app);
|
||||
assert_eq!(proof::view(), before, "Cancel puts back the view it found");
|
||||
}
|
||||
|
||||
/// A proof setup set by a command while the dialog previews stays when Preview is turned off
|
||||
/// and when the dialog is canceled.
|
||||
#[test]
|
||||
fn a_view_set_while_the_dialog_previews_stays() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, ctx) = app();
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
let rgb = format!("rgb:{}", cms::DISPLAY_P3);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("device".into(), json!(rgb));
|
||||
frame(&mut app, &ctx);
|
||||
app.run("view.proofSetup", json!({"target": "protanopia", "proof": true})).unwrap();
|
||||
let set = proof::view();
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("preview".into(), json!(false));
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view(), set, "Preview off keeps the view the command set");
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("preview".into(), json!(true));
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view().setup.target, ProofTarget::Rgb(cms::DISPLAY_P3.into()), "the preview shows again");
|
||||
super::super::cancel(&mut app);
|
||||
assert_eq!(proof::view(), set, "Cancel puts back the view the command set");
|
||||
}
|
||||
|
||||
/// After a command sets a proof setup while the dialog previews, a changed setting previews
|
||||
/// again, and Cancel puts back the proof setup the command set.
|
||||
#[test]
|
||||
fn a_changed_setting_after_a_command_keeps_the_commands_view_for_cancel() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, ctx) = app();
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
let rgb = format!("rgb:{}", cms::DISPLAY_P3);
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("device".into(), json!(rgb));
|
||||
frame(&mut app, &ctx);
|
||||
app.run("view.proofSetup", json!({"target": "protanopia", "proof": true})).unwrap();
|
||||
let set = proof::view();
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("intent".into(), json!("perceptual"));
|
||||
frame(&mut app, &ctx);
|
||||
assert_eq!(proof::view().setup.intent, Intent::Perceptual, "the changed setting previews");
|
||||
super::super::cancel(&mut app);
|
||||
assert_eq!(proof::view(), set, "Cancel puts back the view the command set");
|
||||
}
|
||||
|
||||
/// A device the dialog can't use (a profile that is not loaded) is refused, and the dialog
|
||||
/// stays open with the proof view as it was.
|
||||
#[test]
|
||||
fn ok_with_an_unknown_device_keeps_the_dialog_open() {
|
||||
let _v = DefaultView::new();
|
||||
let (mut app, _) = app();
|
||||
app.run("ui.proofSetupDialog", json!({})).unwrap();
|
||||
let d = app.ui.dialog.as_mut().unwrap();
|
||||
d.fields.insert("device".into(), json!("cmyk:Nope"));
|
||||
d.fields.insert("preview".into(), json!(false));
|
||||
assert!(super::super::confirm(&mut app).unwrap_err().contains("unknown CMYK profile"));
|
||||
assert!(app.ui.dialog.is_some());
|
||||
assert_eq!(proof::view(), Default::default());
|
||||
}
|
||||
|
||||
/// The device list holds the working CMYK space and every CMYK and RGB profile, each a target
|
||||
/// `view.proofSetup` accepts.
|
||||
#[test]
|
||||
fn devices_list_every_cmyk_and_rgb_profile() {
|
||||
let list = devices();
|
||||
assert_eq!(list[0].0, WORKING);
|
||||
for p in cms::profiles().iter().filter(|p| p.kind != ProfileKind::Gray) {
|
||||
assert!(list.iter().any(|(_, n)| *n == p.name), "{} is listed", p.name);
|
||||
}
|
||||
for (id, _) in &list {
|
||||
let t = ProofTarget::parse(id).unwrap();
|
||||
assert_eq!(&t.id(), id);
|
||||
assert!(rgb_device(id) == matches!(t, ProofTarget::Rgb(_)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2767,6 +2767,10 @@ font-technology Variable Променливи
|
||||
Preserve Alpha Transparency Запазване на алфа прозрачността
|
||||
Preserve Appearance and Overprints Запазване на визията и надпечатите
|
||||
Preserve CMYK Numbers Запазване на CMYK стойностите
|
||||
Preserve RGB Numbers Запазване на RGB стойностите
|
||||
Device to Simulate: Устройство за симулиране:
|
||||
Simulate Paper Color Симулиране на цвета на хартията
|
||||
Simulate Black Ink Симулиране на черното мастило
|
||||
Preserve Editing Capabilities Запазване на възможностите за редактиране
|
||||
Preserve editing capabilities Запазване на възможностите за редактиране
|
||||
Preserve Lightness Запазване на светлината
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3026,6 +3026,10 @@ digits Malayalam Malajalam
|
||||
Place the pages with the placement again Ponovo postavi stranice s postavljanjem
|
||||
Placement: Postavljanje:
|
||||
Preserve CMYK Numbers Očuvaj CMYK brojeve
|
||||
Preserve RGB Numbers Očuvaj RGB brojeve
|
||||
Device to Simulate: Uređaj za simulaciju:
|
||||
Simulate Paper Color Simuliraj boju papira
|
||||
Simulate Black Ink Simuliraj crnu tintu
|
||||
Previous page Prethodna stranica
|
||||
Print Layers: Štampaj slojeve:
|
||||
Print Preset: Predložak štampanja:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -3572,6 +3572,10 @@ digits Malayalam Malaiàlam
|
||||
Preserve Appearance Conserva l’aparença
|
||||
Preserve Appearance and Overprints Conserva l’aparença i les sobrempressions
|
||||
Preserve CMYK Numbers Conserva els valors CMYK
|
||||
Preserve RGB Numbers Conserva els valors RGB
|
||||
Device to Simulate: Dispositiu que se simula:
|
||||
Simulate Paper Color Simula el color del paper
|
||||
Simulate Black Ink Simula la tinta negra
|
||||
Preserve Editing Capabilities Conserva les capacitats d’edició
|
||||
Preserve editing capabilities Conserva les capacitats d’edició
|
||||
Preserve Lightness Conserva la lluminositat
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3108,6 +3108,10 @@ digits Malayalam Malajálamské
|
||||
Place the pages with the placement again Znovu rozmístit stránky podle umístění
|
||||
Placement: Umístění:
|
||||
Preserve CMYK Numbers Zachovat hodnoty CMYK
|
||||
Preserve RGB Numbers Zachovat hodnoty RGB
|
||||
Device to Simulate: Simulované zařízení:
|
||||
Simulate Paper Color Simulovat barvu papíru
|
||||
Simulate Black Ink Simulovat černou barvu
|
||||
Previous page Předchozí stránka
|
||||
Print Layers: Tisknout vrstvy:
|
||||
Print Preset: Přednastavení tisku:
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5632,6 +5632,10 @@ digits Malayalam Malayalam
|
||||
Place the pages with the placement again Placér siderne igen med placeringen
|
||||
Placement: Placering:
|
||||
Preserve CMYK Numbers Bevar CMYK-tal
|
||||
Preserve RGB Numbers Bevar RGB-tal
|
||||
Device to Simulate: Enhed, der simuleres:
|
||||
Simulate Paper Color Simulér papirfarve
|
||||
Simulate Black Ink Simulér sort blæk
|
||||
Previous page Forrige side
|
||||
Print Layers: Udskriv lag:
|
||||
Print Preset: Udskriftsforudindstilling:
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2830,6 +2830,10 @@ diagnostics ui Oberfläche
|
||||
Preserve Alpha Transparency Alphatransparenz beibehalten
|
||||
Preserve Appearance and Overprints Aussehen und Überdrucken beibehalten
|
||||
Preserve CMYK Numbers CMYK-Werte beibehalten
|
||||
Preserve RGB Numbers RGB-Werte beibehalten
|
||||
Device to Simulate: Zu simulierendes Gerät:
|
||||
Simulate Paper Color Papierfarbe simulieren
|
||||
Simulate Black Ink Schwarze Druckfarbe simulieren
|
||||
Preserve Editing Capabilities Bearbeitungsfunktionen beibehalten
|
||||
Preserve editing capabilities Bearbeitungsfunktionen beibehalten
|
||||
Preserve Lightness Helligkeit beibehalten
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3767,6 +3767,10 @@ theme Appearance Εμφάνιση
|
||||
Preserve Alpha Transparency Διατήρηση διαφάνειας άλφα
|
||||
Preserve Appearance and Overprints Διατήρηση εμφάνισης και υπερεκτυπώσεων
|
||||
Preserve CMYK Numbers Διατήρηση τιμών CMYK
|
||||
Preserve RGB Numbers Διατήρηση τιμών RGB
|
||||
Device to Simulate: Συσκευή προς προσομοίωση:
|
||||
Simulate Paper Color Προσομοίωση χρώματος χαρτιού
|
||||
Simulate Black Ink Προσομοίωση μαύρης μελάνης
|
||||
Preserve Editing Capabilities Διατήρηση δυνατοτήτων επεξεργασίας
|
||||
Preserve editing capabilities Διατήρηση δυνατοτήτων επεξεργασίας
|
||||
Preserve Lightness Διατήρηση φωτεινότητας
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2870,6 +2870,10 @@ font-technology Variable Variables
|
||||
Preserve Alpha Transparency Conservar transparencia alfa
|
||||
Preserve Appearance and Overprints Conservar apariencia y sobreimpresiones
|
||||
Preserve CMYK Numbers Conservar valores CMYK
|
||||
Preserve RGB Numbers Conservar valores RGB
|
||||
Device to Simulate: Dispositivo que simular:
|
||||
Simulate Paper Color Simular color del papel
|
||||
Simulate Black Ink Simular tinta negra
|
||||
Preserve Editing Capabilities Conservar capacidades de edición
|
||||
Preserve editing capabilities Conservar capacidades de edición
|
||||
Preserve Lightness Conservar luminosidad
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3050,6 +3050,10 @@ digits Malayalam Malajalam
|
||||
Place the pages with the placement again Sijoita sivut uudelleen sijoittelun mukaan
|
||||
Placement: Sijoittelu:
|
||||
Preserve CMYK Numbers Säilytä CMYK-arvot
|
||||
Preserve RGB Numbers Säilytä RGB-arvot
|
||||
Device to Simulate: Simuloitava laite:
|
||||
Simulate Paper Color Simuloi paperin väriä
|
||||
Simulate Black Ink Simuloi mustaa mustetta
|
||||
Previous page Edellinen sivu
|
||||
Print Layers: Tulosta tasot:
|
||||
Print Preset: Tulostuksen esiasetus:
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2858,6 +2858,10 @@ font-technology Variable Variables
|
||||
Preserve Alpha Transparency Conserver la transparence alpha
|
||||
Preserve Appearance and Overprints Conserver l’aspect et les surimpressions
|
||||
Preserve CMYK Numbers Conserver les valeurs CMJN
|
||||
Preserve RGB Numbers Conserver les valeurs RVB
|
||||
Device to Simulate: Périphérique à simuler :
|
||||
Simulate Paper Color Simuler la couleur du papier
|
||||
Simulate Black Ink Simuler l’encre noire
|
||||
Preserve Editing Capabilities Conserver les fonctions d’édition
|
||||
Preserve editing capabilities Conserver les fonctions d’édition
|
||||
Preserve Lightness Conserver la luminosité
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2902,6 +2902,10 @@
|
||||
Preserve Alpha Transparency આલ્ફા પારદર્શિતા જાળવો
|
||||
Preserve Appearance and Overprints દેખાવ અને ઓવરપ્રિન્ટ જાળવો
|
||||
Preserve CMYK Numbers CMYK નંબર જાળવો
|
||||
Preserve RGB Numbers RGB નંબર જાળવો
|
||||
Device to Simulate: અનુકરણ કરવાનું ઉપકરણ:
|
||||
Simulate Paper Color કાગળના રંગનું અનુકરણ કરો
|
||||
Simulate Black Ink કાળી શાહીનું અનુકરણ કરો
|
||||
Preserve Editing Capabilities સંપાદન ક્ષમતાઓ જાળવો
|
||||
Preserve Lightness તેજ જાળવો
|
||||
Preserve Overprints and Spot Colors ઓવરપ્રિન્ટ અને સ્પોટ રંગ જાળવો
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 72 and column 5.
|
@@ -4167,6 +4167,10 @@ arrowhead Feather पंख
|
||||
Preserve Appearance उपस्थिति संरक्षित करें
|
||||
Preserve Appearance and Overprints उपस्थिति और ओवरप्रिंट को संरक्षित करें
|
||||
Preserve CMYK Numbers CMYK नंबर संरक्षित करें
|
||||
Preserve RGB Numbers RGB नंबर संरक्षित करें
|
||||
Device to Simulate: सिम्युलेट करने के लिए डिवाइस:
|
||||
Simulate Paper Color पेपर का रंग सिम्युलेट करें
|
||||
Simulate Black Ink काली स्याही सिम्युलेट करें
|
||||
Preserve editing capabilities संपादन क्षमताओं को संरक्षित करना
|
||||
Preserve Editing Capabilities संपादन क्षमताओं को संरक्षित करना
|
||||
Preserve Lightness प्रकाश संरक्षण
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3437,6 +3437,10 @@ diagnostics ui felület
|
||||
Preserve Appearance Megjelenés megőrzése
|
||||
Preserve Appearance and Overprints Megjelenés és felülnyomások megtartása
|
||||
Preserve CMYK Numbers CMYK-értékek megtartása
|
||||
Preserve RGB Numbers RGB-értékek megtartása
|
||||
Device to Simulate: Szimulálandó eszköz:
|
||||
Simulate Paper Color Papírszín szimulálása
|
||||
Simulate Black Ink Fekete festék szimulálása
|
||||
Preserve editing capabilities Szerkeszthetőség megtartása
|
||||
Preserve Editing Capabilities Szerkeszthetőség megtartása
|
||||
Preserve Lightness Világosság megtartása
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3504,6 +3504,10 @@ digits Malayalam Malayalam
|
||||
Place the pages with the placement again Tempatkan halaman lagi dengan penempatan tersebut
|
||||
Placement: Penempatan:
|
||||
Preserve CMYK Numbers Pertahankan angka CMYK
|
||||
Preserve RGB Numbers Pertahankan angka RGB
|
||||
Device to Simulate: Perangkat yang disimulasikan:
|
||||
Simulate Paper Color Simulasikan warna kertas
|
||||
Simulate Black Ink Simulasikan tinta hitam
|
||||
Previous page Halaman sebelumnya
|
||||
Print Layers: Lapisan cetak:
|
||||
Print Preset: Preset cetak:
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2915,6 +2915,10 @@ diagnostics ui interfaccia
|
||||
Preserve Alpha Transparency Mantieni trasparenza alfa
|
||||
Preserve Appearance and Overprints Mantieni aspetto e sovrastampe
|
||||
Preserve CMYK Numbers Mantieni valori CMYK
|
||||
Preserve RGB Numbers Mantieni valori RGB
|
||||
Device to Simulate: Dispositivo da simulare:
|
||||
Simulate Paper Color Simula colore carta
|
||||
Simulate Black Ink Simula inchiostro nero
|
||||
Preserve Editing Capabilities Mantieni possibilità di modifica
|
||||
Preserve editing capabilities Mantieni possibilità di modifica
|
||||
Preserve Lightness Mantieni luminosità
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2990,6 +2990,10 @@ diagnostics ui UI
|
||||
Preserve Alpha Transparency アルファ透明を保持
|
||||
Preserve Appearance and Overprints アピアランスとオーバープリントを保持
|
||||
Preserve CMYK Numbers CMYK 値を保持
|
||||
Preserve RGB Numbers RGB 値を保持
|
||||
Device to Simulate: シミュレートするデバイス:
|
||||
Simulate Paper Color 用紙の色をシミュレート
|
||||
Simulate Black Ink インキの黒をシミュレート
|
||||
Preserve Editing Capabilities 編集機能を保持
|
||||
Preserve Lightness 明度を保持
|
||||
Preserve Overprints and Spot Colors オーバープリントと特色を保持
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4995,6 +4995,10 @@ digits Malayalam მალაიალამური
|
||||
Place the pages with the placement again გვერდების ხელახლა განთავსება განთავსების მიხედვით
|
||||
Placement: განთავსება:
|
||||
Preserve CMYK Numbers CMYK მნიშვნელობების შენარჩუნება
|
||||
Preserve RGB Numbers RGB მნიშვნელობების შენარჩუნება
|
||||
Device to Simulate: სიმულირებადი მოწყობილობა:
|
||||
Simulate Paper Color ქაღალდის ფერის იმიტაცია
|
||||
Simulate Black Ink შავი მელნის იმიტაცია
|
||||
Previous page წინა გვერდი
|
||||
Print Layers: შრეების ბეჭდვა:
|
||||
Print Preset: ბეჭდვის პრესეტი:
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2980,6 +2980,10 @@ diagnostics ui UI
|
||||
Preserve Alpha Transparency 알파 투명도 보존
|
||||
Preserve Appearance and Overprints 모양 및 오버프린트 보존
|
||||
Preserve CMYK Numbers CMYK 수치 보존
|
||||
Preserve RGB Numbers RGB 수치 보존
|
||||
Device to Simulate: 시뮬레이션할 장치:
|
||||
Simulate Paper Color 용지 색상 시뮬레이션
|
||||
Simulate Black Ink 검정 잉크 시뮬레이션
|
||||
Preserve Editing Capabilities 편집 기능 보존
|
||||
Preserve Lightness 명도 보존
|
||||
Preserve Overprints and Spot Colors 오버프린트 및 별색 보존
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3503,6 +3503,10 @@ digits Malayalam Malayalam
|
||||
Place the pages with the placement again Plaats de pagina's opnieuw met de plaatsing
|
||||
Placement: Plaatsing:
|
||||
Preserve CMYK Numbers CMYK-waarden behouden
|
||||
Preserve RGB Numbers RGB-waarden behouden
|
||||
Device to Simulate: Te simuleren apparaat:
|
||||
Simulate Paper Color Papierkleur simuleren
|
||||
Simulate Black Ink Zwarte inkt simuleren
|
||||
Previous page Vorige pagina
|
||||
Print Layers: Lagen afdrukken:
|
||||
Print Preset: Afdrukvoorinstelling:
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3021,6 +3021,10 @@ digits Malayalam Malajalam
|
||||
Place the pages with the placement again Ponownie rozmieść strony według położenia
|
||||
Placement: Położenie:
|
||||
Preserve CMYK Numbers Zachowaj wartości CMYK
|
||||
Preserve RGB Numbers Zachowaj wartości RGB
|
||||
Device to Simulate: Symulowane urządzenie:
|
||||
Simulate Paper Color Symuluj kolor papieru
|
||||
Simulate Black Ink Symuluj czarną farbę
|
||||
Previous page Poprzednia strona
|
||||
Print Layers: Drukuj warstwy:
|
||||
Print Preset: Ustawienie drukowania:
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2373,6 +2373,10 @@ antiAlias Sharp Nítido
|
||||
Preserve Alpha Transparency Preservar Transparência Alfa
|
||||
Preserve Appearance and Overprints Preservar Aparência e Sobreimpressões
|
||||
Preserve CMYK Numbers Preservar Números CMYK
|
||||
Preserve RGB Numbers Preservar Números RGB
|
||||
Device to Simulate: Dispositivo a Simular:
|
||||
Simulate Paper Color Simular Cor do Papel
|
||||
Simulate Black Ink Simular Tinta Preta
|
||||
Preserve Editing Capabilities Preservar Capacidades de Edição
|
||||
Preserve Lightness Preservar Luminosidade
|
||||
Preserve Overprints and Spot Colors Preservar Sobreimpressões e Cores Spot
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2898,6 +2898,10 @@ diagnostics ui интерфейс
|
||||
Preserve Alpha Transparency Сохранять альфа-прозрачность
|
||||
Preserve Appearance and Overprints Сохранять оформление и наложения
|
||||
Preserve CMYK Numbers Сохранять значения CMYK
|
||||
Preserve RGB Numbers Сохранять значения RGB
|
||||
Device to Simulate: Имитируемое устройство:
|
||||
Simulate Paper Color Имитировать цвет бумаги
|
||||
Simulate Black Ink Имитировать чёрную краску
|
||||
Preserve Editing Capabilities Сохранять возможности редактирования
|
||||
Preserve editing capabilities Сохранять возможности редактирования
|
||||
Preserve Lightness Сохранять светлоту
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2791,6 +2791,10 @@ font-technology Variable Variabla
|
||||
Preserve Alpha Transparency Bevara alfatransparens
|
||||
Preserve Appearance and Overprints Bevara utseende och övertryck
|
||||
Preserve CMYK Numbers Bevara CMYK-värden
|
||||
Preserve RGB Numbers Bevara RGB-värden
|
||||
Device to Simulate: Enhet att simulera:
|
||||
Simulate Paper Color Simulera pappersfärg
|
||||
Simulate Black Ink Simulera svart bläck
|
||||
Preserve Editing Capabilities Bevara redigeringsmöjligheter
|
||||
Preserve editing capabilities Bevara redigeringsmöjligheter
|
||||
Preserve Lightness Bevara ljushet
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -570,6 +570,25 @@ fn objects_on_path_detach_strings_are_in_complete_catalogs() {
|
||||
}
|
||||
}
|
||||
|
||||
/// View › Proof Setup › Customize's labels.
|
||||
#[test]
|
||||
fn proof_setup_dialog_labels_are_in_complete_catalogs() {
|
||||
let labels = [
|
||||
"Proof Setup",
|
||||
"Device to Simulate:",
|
||||
"Preserve CMYK Numbers",
|
||||
"Preserve RGB Numbers",
|
||||
"Rendering intent:",
|
||||
"Simulate Paper Color",
|
||||
"Simulate Black Ink",
|
||||
];
|
||||
for lang in LANGUAGES.iter().filter(|lang| lang.complete_menus) {
|
||||
for label in labels {
|
||||
assert!(lang.catalog().plain(label).is_some(), "{} is missing {label}", lang.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The PSD Import Options dialog's labels, and the warnings and errors of opening and placing a
|
||||
/// PSD or PSB file with its layers and slices: each complete catalog translates every one, keeping
|
||||
/// its numbers, and translates a reason given inside one.
|
||||
|
||||
@@ -2640,6 +2640,10 @@ shape Open Açık
|
||||
Preserve Alpha Transparency Alfa Şeffaflığını Koruyun
|
||||
Preserve Appearance and Overprints Görünümü ve Üst Baskıları Koru
|
||||
Preserve CMYK Numbers CMYK Numaralarını Koru
|
||||
Preserve RGB Numbers RGB Numaralarını Koru
|
||||
Device to Simulate: Simüle Edilecek Aygıt:
|
||||
Simulate Paper Color Kağıt Rengini Simüle Et
|
||||
Simulate Black Ink Siyah Mürekkebi Simüle Et
|
||||
Preserve Editing Capabilities Düzenleme Yeteneklerini Koruyun
|
||||
Preserve editing capabilities Düzenleme yeteneklerini koruyun
|
||||
Preserve Lightness Hafifliği Koruyun
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2907,6 +2907,10 @@ diagnostics ui інтерфейс
|
||||
Preserve Alpha Transparency Зберігати альфа-прозорість
|
||||
Preserve Appearance and Overprints Зберігати оформлення та накладення
|
||||
Preserve CMYK Numbers Зберігати значення CMYK
|
||||
Preserve RGB Numbers Зберігати значення RGB
|
||||
Device to Simulate: Імітований пристрій:
|
||||
Simulate Paper Color Імітувати колір паперу
|
||||
Simulate Black Ink Імітувати чорну фарбу
|
||||
Preserve Editing Capabilities Зберігати можливості редагування
|
||||
Preserve editing capabilities Зберігати можливості редагування
|
||||
Preserve Lightness Зберігати світлоту
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -3234,6 +3234,10 @@ diagnostics ui giao diện
|
||||
Preserve Alpha Transparency Bảo lưu trong suốt kênh Alpha
|
||||
Preserve Appearance and Overprints Bảo lưu diện mạo và in chồng
|
||||
Preserve CMYK Numbers Bảo lưu giá trị CMYK
|
||||
Preserve RGB Numbers Bảo lưu giá trị RGB
|
||||
Device to Simulate: Thiết bị cần giả lập:
|
||||
Simulate Paper Color Giả lập màu giấy
|
||||
Simulate Black Ink Giả lập mực đen
|
||||
Preserve Editing Capabilities Bảo lưu khả năng chỉnh sửa
|
||||
Preserve editing capabilities Bảo lưu khả năng chỉnh sửa
|
||||
Preserve Lightness Bảo lưu độ sáng
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2758,6 +2758,10 @@ diagnostics ui 界面
|
||||
Preserve Alpha Transparency 保留 Alpha 透明度
|
||||
Preserve Appearance and Overprints 保留外观和叠印
|
||||
Preserve CMYK Numbers 保留 CMYK 数值
|
||||
Preserve RGB Numbers 保留 RGB 数值
|
||||
Device to Simulate: 要模拟的设备:
|
||||
Simulate Paper Color 模拟纸张颜色
|
||||
Simulate Black Ink 模拟黑色油墨
|
||||
Preserve Editing Capabilities 保留编辑功能
|
||||
Preserve editing capabilities 保留编辑能力
|
||||
Preserve Lightness 保留亮度
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4191,6 +4191,10 @@ diagnostics ui 介面
|
||||
Preserve Alpha Transparency 保留 Alpha 透明度
|
||||
Preserve Appearance and Overprints 保留外觀與疊印
|
||||
Preserve CMYK Numbers 保留 CMYK 數值
|
||||
Preserve RGB Numbers 保留 RGB 數值
|
||||
Device to Simulate: 要模擬的裝置:
|
||||
Simulate Paper Color 模擬紙張顏色
|
||||
Simulate Black Ink 模擬黑色油墨
|
||||
Preserve Editing Capabilities 保留編輯功能
|
||||
Preserve editing capabilities 保留編輯功能
|
||||
Preserve Lightness 保留亮度
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -865,6 +865,10 @@ fn run_ui_part8(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result<
|
||||
crate::dialogs::saturate::open(app);
|
||||
Ok(Value::Null)
|
||||
}
|
||||
"ui.proofSetupDialog" => {
|
||||
crate::dialogs::proof_setup::open(app);
|
||||
Ok(Value::Null)
|
||||
}
|
||||
"ui.indexedColorDialog" => {
|
||||
crate::dialogs::indexed_color::open(app);
|
||||
Ok(Value::Null)
|
||||
|
||||
@@ -110,6 +110,13 @@ pub fn checked(app: &VectorcraftApp, id: &str, p: &Value) -> Option<bool> {
|
||||
"view.proofColors" => vectorcraft_render::proof::view().proof_colors,
|
||||
"view.overprintPreview" => vectorcraft_render::proof::view().overprint,
|
||||
"view.proofSetup" => p.get("target").and_then(Value::as_str) == Some(vectorcraft_render::proof::view().setup.target.id().as_str()),
|
||||
// Customize… is checked while the proof simulates a profile it chose.
|
||||
"ui.proofSetupDialog" => {
|
||||
matches!(
|
||||
vectorcraft_render::proof::view().setup.target,
|
||||
vectorcraft_color::cms::ProofTarget::Cmyk(_) | vectorcraft_color::cms::ProofTarget::Rgb(_)
|
||||
)
|
||||
}
|
||||
"perspective.grid.snap" => perspective_grid(app).is_some_and(|g| g.snap),
|
||||
"perspective.grid.lockStation" => perspective_grid(app).is_some_and(|g| g.lock_station),
|
||||
"file.documentColorMode" | "object.convertDocumentColorMode" => {
|
||||
|
||||
@@ -582,7 +582,7 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec<Item>)> {
|
||||
cp("Color blindness – Protanopia-type", "view.proofSetup", json!({"target": "protanopia", "proof": true})),
|
||||
cp("Color blindness – Deuteranopia-type", "view.proofSetup", json!({"target": "deuteranopia", "proof": true})),
|
||||
cp("Color blindness – Tritanopia-type", "view.proofSetup", json!({"target": "tritanopia", "proof": true})),
|
||||
cp("Customize…", "window.panel", json!({"panel": "separations"})),
|
||||
c("Customize…", "ui.proofSetupDialog"),
|
||||
],
|
||||
),
|
||||
c("Proof Colors", "view.proofColors"),
|
||||
|
||||
@@ -1159,6 +1159,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
"",
|
||||
"{} open Saturate for the selection (dialog `saturate`, fields `intensity` −100..100, `preview`): previews live, OK runs edit.colors.saturate as one undo step",
|
||||
),
|
||||
(
|
||||
"ui.proofSetupDialog",
|
||||
"Customize…",
|
||||
"",
|
||||
"{} open View › Proof Setup › Customize (dialog `proofSetup`, fields `device` (\"workingCmyk\", \"cmyk:<profile>\" or \"rgb:<profile>\": any CMYK or RGB profile), `preserveNumbers`, `intent` (used while preserveNumbers is off), `simulatePaper` and `simulateBlack` (CMYK devices only), `preview` (on): Preview shows the proof on the canvas, OK runs view.proofSetup with these and proof: true, Cancel puts the earlier proof view back)",
|
||||
),
|
||||
(
|
||||
"ui.indexedColorDialog",
|
||||
"Convert to Indexed Color…",
|
||||
|
||||
@@ -864,6 +864,11 @@ pub struct UiState {
|
||||
/// [`crate::dialogs::settle`] opens the choice again once no dialog is open.
|
||||
#[serde(skip)]
|
||||
pub stopped_plugin: Option<Value>,
|
||||
/// The proof view the Proof Setup dialog found, and the view its preview shows on the canvas,
|
||||
/// while the preview shows. When another dialog takes its place, [`crate::dialogs::settle`]
|
||||
/// puts the first view back, unless the view has changed from the preview since.
|
||||
#[serde(skip)]
|
||||
pub proof_preview: Option<(Value, vectorcraft_render::proof::ProofView)>,
|
||||
/// The search the Missing Fonts dialog started (`text.findFontFiles`'s `id`), stopped once the
|
||||
/// dialog is gone.
|
||||
#[serde(skip)]
|
||||
@@ -1365,6 +1370,7 @@ impl Default for UiState {
|
||||
pending_fonts: vec![],
|
||||
fonts_dialog: None,
|
||||
stopped_plugin: None,
|
||||
proof_preview: None,
|
||||
dialog_search: None,
|
||||
links_search: None,
|
||||
dxf_options: Value::Null,
|
||||
|
||||
@@ -1237,6 +1237,15 @@ describes the second Alt-click or Option-click on the eye bringing every separat
|
||||
that plate alone). A hidden plate, another plate while one shows alone, or any plate while none is shown becomes
|
||||
the only plate shown; these cases are VectorCraft's own rules. `only` always shows just the named plate, so
|
||||
repeating it changes nothing. Neither adds an undo step.
|
||||
View › Proof Setup › Customize… (`ui.proofSetupDialog`, dialog `proofSetup`) sets the custom proof through
|
||||
`view.proofSetup`: `target` `"cmyk:<profile>"` or `"rgb:<profile>"` names any CMYK or RGB profile as the device to
|
||||
simulate (a profile that is not loaded is an error), `preserveNumbers` sends the colors' numbers in the document's
|
||||
space to the device unchanged instead of converting them with `intent` (each color as it is painted, and a placed
|
||||
CMYK image's own inks; an RGB image's pixels go through their numbers in the document's space, and transparency mixes
|
||||
the proofed colors on the device's paper), and
|
||||
`simulateBlack` shows the device's black
|
||||
as the dark gray it prints (`simulatePaper` does so too, on the paper's color; both act on CMYK devices only). The
|
||||
reply carries `preserveNumbers` and `simulateBlack` with the other proof settings.
|
||||
The Separations panel's Assign rows (where Edit › Assign Profile… goes) act on the profile of the document's color
|
||||
mode: Don't Color Manage This Document runs `edit.assignProfile` with null for that model (no profile, so the colors
|
||||
show through the working space), Working RGB or Working CMYK with the working space's name (that profile stays
|
||||
|
||||
@@ -1949,6 +1949,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
A double-click right of an RGB field switches the Color panel's R, G and B between percent and 0 to 255 ([Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), Color panel). In VectorCraft the color does not change, Web Safe RGB and the hex field stay in 0 to 255, and the panel keeps the choice between sessions (`ui.colorPanel {rgbPercent}`); the color mixer of the Fill and Stroke chips and the gradient stop dialog follow the same setting. Toggle RGB Percent (`ui.colorRgbPercent`) in the command palette and Keyboard Shortcuts switches the units from the keyboard. Tests: `rgb_percent_switches_the_rgb_fields_between_percent_and_0_to_255`, `rgb_percent_does_not_switch_while_the_rows_are_disabled`, `rgb_percent_comes_back_after_a_restart` and `toggle_rgb_percent_switches_the_units_from_the_keyboard` in `crates/ui-egui/src/panels/color/tests.rs`.
|
||||
View › Proof Setup › Color blindness – Tritanopia-type turns Proof Colors on and proofs the canvas with the tritanopia simulation of Brettel, Viénot and Mollon (1997). The Separations Preview panel's Proof Setup list offers the same target (`view.proofSetup {target: "tritanopia"}`). Grays keep their value.
|
||||
In VectorCraft the Color Wheel panel menu's Show Color Vision Preview (`ui.colorWheel {vision: true}`) adds a row of four chips under the wheel or the box: the current color through the protanopia, deuteranopia and tritanopia simulations that View › Proof Setup uses, and an achromatopsia chip, which is VectorCraft's own gray with the color's CIE L*. Each chip takes the keyboard focus and gives its name and hex value in its tooltip and to screen readers, and a click on one does not apply it. The setting is kept with the preferences. Tests: `crates/ui-egui/src/panels/tests_color_wheel_vision.rs`.
|
||||
View › Proof Setup › Customize… opens a Proof Setup dialog with Device to Simulate (the working CMYK space or any CMYK or RGB profile), Preserve CMYK Numbers or Preserve RGB Numbers, Rendering Intent (used while the numbers are not preserved), Simulate Paper Color and Simulate Black Ink, and Preview; OK sets the proof and turns Proof Colors on ([Soft-proof colors](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=146), "Custom soft-proof options"). In VectorCraft, Simulate Paper Color also shows the black ink, the two simulations act on CMYK devices only, and Cancel puts the earlier proof back (`ui.proofSetupDialog`, `view.proofSetup {preserveNumbers, simulateBlack}`). Tests: `simulate_black_ink_shows_the_press_black_as_gray`, `preserve_cmyk_numbers_sends_the_numbers_unchanged` and `rgb_device_proofs_show_the_device_numbers` in `crates/color/src/cms/tests.rs`, `proof_setup_takes_the_custom_proof_settings` in `crates/engine/src/tests/colormgmt.rs`, `customize_sets_the_proof_setup_and_turns_proof_colors_on` and `preview_shows_the_settings_and_cancel_puts_the_view_back` in `crates/ui-egui/src/dialogs/proof_setup.rs`.
|
||||
The Separations Preview panel's Gamut Check button reports one color outside the CMYK gamut in the singular and more in the plural, in English and in each language's plural forms (`gamut_check_status_takes_the_plural_form` in `crates/ui-egui/src/i18n/tests.rs`).
|
||||
The "?" on the Fill and Stroke proxies finds a few selected objects along their cached places in the document instead of walking every object; a large selection takes one walk, as before. The proxies show the same paints and question marks as before, also for an id that a damaged file repeats. On a document of 50,000 rectangles in 500 groups on 5 layers with one object selected, the check takes under 5 µs of CPU time instead of a median of 995 µs in a release build on Linux, so the gain shows on large documents (seven alternating runs, `cargo test --release -p vectorcraft-engine --lib proxy_mixed_timing -- --ignored --nocapture`).
|
||||
- **Document Color Mode outside the layers:** File › Document Color Mode (in one undo step) and `document.open {colorMode}` also convert the colors of graph designs, graphic styles, opacity-mask art, the tile that pattern editing's Cancel puts back and the art of brushes (with a Hue Shift brush's key color); a tint of a global swatch there becomes the converted swatch's color at its tint, as in the art.
|
||||
|
||||
Reference in new issue
Block a user