From 116a8c2411e46e9471953a5e641211f410d02cb2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 24 Nov 2026 00:45:00 -0800 Subject: [PATCH] Overprint: a white spot ink keeps overprinting with Discard White Overprint With Discard White Overprint on, PDF export, Overprint Preview, Separations Preview and printed separations took the overprint off any white paint, including a tint above 0% of a spot swatch whose color is white, which prints as that ink. Such a tint now keeps its overprint in fills, strokes, character paints and a colorized image's color; process white and a 0% tint still knock out. DiscardWhite holds the setting and the document's spot inks, and Document::discards_white_overprint gives the same answer for the PDF and EPS writers. --- crates/doc/src/overprint.rs | 96 +++++++++++++++++++++++++++----- crates/eps/src/scene.rs | 3 +- crates/pdf/src/export/nodes.rs | 14 ++--- crates/pdf/src/print.rs | 6 +- crates/pdf/src/print/plates.rs | 16 +++--- crates/pdf/src/tests/colorize.rs | 26 +++++++++ crates/render/src/proof.rs | 13 +++-- docs/mcp.md | 5 +- docs/target-app-parity.md | 2 +- 9 files changed, 137 insertions(+), 44 deletions(-) diff --git a/crates/doc/src/overprint.rs b/crates/doc/src/overprint.rs index afe8ceedcc..38a62e0341 100644 --- a/crates/doc/src/overprint.rs +++ b/crates/doc/src/overprint.rs @@ -2,7 +2,7 @@ //! over the inks below instead of knocking them out ([`crate::FillLayer::overprint`]). //! Edit → Edit Colors → Overprint Black sets it on black fills and strokes ([`OverprintBlack`]). -use std::collections::BTreeMap; +use std::collections::{BTreeMap, BTreeSet}; use std::sync::Arc; use vectorcraft_color::{BlendMode, Color, GradientKind, Paint}; @@ -181,9 +181,9 @@ pub fn image_row_draws(i: &crate::AppearanceItem) -> bool { } /// Whether paint `paint` of blend mode `blend` darkens when `overprint` asks it to: with the -/// Normal blend, and not white with `discard_white` (Document Setup → Discard White Overprint). -fn darkens(overprint: bool, blend: BlendMode, paint: &Paint, discard_white: bool) -> bool { - overprint && blend == BlendMode::Normal && !(discard_white && is_white(paint)) +/// Normal blend, and not a white that `discard_white` knocks out ([`DiscardWhite::discards`]). +fn darkens(overprint: bool, blend: BlendMode, paint: &Paint, discard_white: &DiscardWhite) -> bool { + overprint && blend == BlendMode::Normal && !discard_white.discards(paint) } /// The effects that only move or reshape what an object draws, keeping its own colors, besides @@ -236,12 +236,12 @@ pub fn refuses_colorize(n: &Node, images: &BTreeMap) -> bool } /// Whether colorized image `n` is drawn overprinting as a whole: its color overprints -/// ([`Node::colorize_overprints`]) with the Normal blend and is not white with `discard_white`, +/// ([`Node::colorize_overprints`]) with the Normal blend and is not a white `discard_white` knocks out, /// the pixels it shows in `images` take its color ([`refuses_colorize`]), each of its own visible /// effects only reshapes it ([`reshapes_only`]), and each row that draws ([`image_row_draws`]) /// overprints that way too. A colorized image's color is not a fill row, so the whole node /// overprints or none of it does. -pub fn image_overprints_whole(n: &Node, discard_white: bool, images: &BTreeMap) -> bool { +pub fn image_overprints_whole(n: &Node, discard_white: &DiscardWhite, images: &BTreeMap) -> bool { let row = |i: &crate::AppearanceItem| match i { crate::AppearanceItem::Fill(l) => darkens(l.overprint, l.blend, &l.paint, discard_white), crate::AppearanceItem::Stroke(l) => darkens(l.overprint, l.blend, &l.paint, discard_white), @@ -258,10 +258,10 @@ pub fn image_overprints_whole(n: &Node, discard_white: bool, images: &BTreeMap, discard_white: bool, images: &BTreeMap) { +/// that colour, where Multiply would darken it. White fills and strokes that `discard_white` +/// (Document Setup → Discard White Overprint) knocks out do so instead. A colorized image +/// darkens as a whole ([`image_overprints_whole`], with the document's `images`). +pub fn darken_overprints(a: &mut Arc, discard_white: &DiscardWhite, images: &BTreeMap) { if !a.has_overprint() { return; } @@ -293,6 +293,34 @@ pub fn is_white(p: &Paint) -> bool { } } +/// Discard White Overprint (Document Setup) as output applies it: whether it is on, and the spot +/// inks a white tint of which still overprints ([`Document::spot_ink`]). +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DiscardWhite { + on: bool, + spot_inks: BTreeSet, +} + +impl DiscardWhite { + /// The document's setting and spot inks. + pub fn of(doc: &Document) -> Self { + let spot_inks = doc.swatches_iter().map(|s| &s.name).filter(|n| doc.swatch(n).is_some_and(|s| s.spot && s.paint.color().is_some())); + Self { on: doc.setup.discard_white_overprint, spot_inks: spot_inks.cloned().collect() } + } + + /// The setting `on`, with no spot inks. + pub fn new(on: bool) -> Self { + Self { on, spot_inks: BTreeSet::new() } + } + + /// Whether `p` loses its overprint: the setting is on and `p` is paper white + /// ([`is_white`]), not a tint above 0% of a spot ink, which prints as that ink. + pub fn discards(&self, p: &Paint) -> bool { + let spot = matches!(p, Paint::Solid { swatch: Some(name), tint, .. } if *tint > 0.0 && self.spot_inks.contains(name)); + self.on && is_white(p) && !spot + } +} + impl Document { /// The names of the spot swatches. pub fn spot_names(&self) -> Vec { @@ -306,6 +334,12 @@ impl Document { matches!(p, Paint::Solid { swatch: Some(name), tint, .. } if *tint > 0.0 && self.swatch(name).is_some_and(|s| s.spot && s.paint.color().is_some())) } + /// Whether Discard White Overprint (Document Setup) takes the overprint off `p` + /// ([`DiscardWhite::discards`]). + pub fn discards_white_overprint(&self, p: &Paint) -> bool { + self.setup.discard_white_overprint && is_white(p) && !self.spot_ink(p) + } + /// Files from before per-fill/stroke overprint listed the objects marked Overprint Black /// under [`LEGACY_OVERPRINT_KEY`]: their 100% black fills and strokes overprint now. pub fn migrate_overprint_black(&mut self) { @@ -493,7 +527,7 @@ mod tests { fn a_white_colorized_image_knocks_out_under_discard_white() { let image = |color: Paint, discard_white: bool| { let mut a = Arc::new(colorized(color, Paint::None)); - darken_overprints(&mut a, discard_white, &BTreeMap::new()); + darken_overprints(&mut a, &DiscardWhite::new(discard_white), &BTreeMap::new()); a.blend }; let white = Paint::solid(Color::cmyk(0.0, 0.0, 0.0, 0.0)); @@ -502,11 +536,43 @@ mod tests { assert_eq!(image(cmyk(0.0, 0.0, 0.0, 1.0), true), BlendMode::Darken); } + /// A tint above 0% of a spot ink whose color is white keeps overprinting with Discard White + /// Overprint, as an image's color and as a fill; a 0% tint, a process white and a swatch that + /// is not spot knock out. + #[test] + fn a_white_spot_ink_keeps_overprinting_under_discard_white() { + let mut doc = Document::new(100.0, 100.0); + let white = Color::cmyk(0.0, 0.0, 0.0, 0.0); + doc.swatches.push(crate::Swatch { name: "White Ink".into(), paint: Paint::solid(white), global: true, spot: true }); + doc.swatches.push(crate::Swatch { name: "Paper".into(), paint: Paint::solid(white), global: true, spot: false }); + doc.setup.discard_white_overprint = true; + let discard = DiscardWhite::of(&doc); + let linked = |name: &str, tint: f32| Paint::Solid { color: white, swatch: Some(name.into()), tint }; + let blend = |color: Paint, fill: Paint| { + let mut n = colorized(color, Paint::None); + if let Some(f) = n.appearance.fill_mut() { + f.paint = fill; + f.overprint = true; + } + let mut a = Arc::new(n); + darken_overprints(&mut a, &discard, &BTreeMap::new()); + (a.blend, a.appearance.fill().map(|f| f.blend)) + }; + let spot = linked("White Ink", 0.5); + assert_eq!(blend(spot.clone(), spot.clone()), (BlendMode::Darken, Some(BlendMode::Darken))); + assert!(doc.spot_ink(&spot) && !discard.discards(&spot)); + for knocks_out in [linked("White Ink", 0.0), linked("Paper", 1.0), Paint::solid(white)] { + assert!(discard.discards(&knocks_out), "{knocks_out:?}"); + assert_eq!(blend(knocks_out.clone(), knocks_out.clone()).0, BlendMode::Normal, "{knocks_out:?}"); + } + assert!(!DiscardWhite::new(false).discards(&Paint::solid(white))); + } + #[test] fn a_colorized_image_showing_pixels_that_refuse_its_color_keeps_knocking_out() { let blend = |images: &BTreeMap| { let mut a = Arc::new(colorized(cmyk(0.0, 0.0, 0.0, 1.0), Paint::None)); - darken_overprints(&mut a, false, images); + darken_overprints(&mut a, &DiscardWhite::new(false), images); a.blend }; let bytes = crate::links::missing_placeholder().unwrap(); @@ -529,7 +595,7 @@ mod tests { } } let mut a = Arc::new(n); - darken_overprints(&mut a, false, &BTreeMap::new()); + darken_overprints(&mut a, &DiscardWhite::new(false), &BTreeMap::new()); a.blend }; let shape = "convertToShape.rectangle"; @@ -559,7 +625,7 @@ mod tests { f.effects.push(effect); } let mut a = Arc::new(n); - darken_overprints(&mut a, false, &BTreeMap::new()); + darken_overprints(&mut a, &DiscardWhite::new(false), &BTreeMap::new()); a.blend }; assert_eq!(blend(false, 0.0), BlendMode::Darken, "a fill with no opacity paints nothing"); @@ -574,7 +640,7 @@ mod tests { let mut n = colorized(cmyk(0.0, 0.0, 0.0, 1.0), Paint::None); n.appearance.effects.push(crate::Effect { id: id.into(), params: serde_json::json!({}), visible }); let mut a = Arc::new(n); - darken_overprints(&mut a, false, &BTreeMap::new()); + darken_overprints(&mut a, &DiscardWhite::new(false), &BTreeMap::new()); a.blend }; assert_eq!(blend("stylize.dropShadow", true), BlendMode::Normal, "a drop shadow is not darkened with the image"); diff --git a/crates/eps/src/scene.rs b/crates/eps/src/scene.rs index 76c6181ced..ba5db9a98c 100644 --- a/crates/eps/src/scene.rs +++ b/crates/eps/src/scene.rs @@ -586,8 +586,7 @@ impl<'a> Scene<'a> { // (a plate's colors come from the separator, which has applied it already); a // spot ink with a white color still overprints, as it is written as that ink. Some(p @ Paint::Solid { .. }) if blob.is_none_or(|b| b.gray_source().is_some()) => { - let discarded = - !self.plate && self.doc.setup.discard_white_overprint && vectorcraft_doc::overprint::is_white(p) && !self.doc.spot_ink(p); + let discarded = !self.plate && self.doc.discards_white_overprint(p); let on = self.overprint_on(n.colorize_overprints() && !discarded); self.colorized_image(im, blob, p, on); self.overprint_off(on); diff --git a/crates/pdf/src/export/nodes.rs b/crates/pdf/src/export/nodes.rs index 5871418578..9e5b219258 100644 --- a/crates/pdf/src/export/nodes.rs +++ b/crates/pdf/src/export/nodes.rs @@ -525,12 +525,12 @@ impl Exporter<'_> { } /// Draw image `im` of node `n` colorized with `p` ([`Self::colorized_image`]), overprinting - /// when its color does ([`Node::colorize_overprints`]). A white process color that overprints - /// (Discard White Overprint off) puts no ink down, so it paints nothing. + /// when its color does ([`Node::colorize_overprints`]). A white color that is not a spot ink + /// ([`Document::spot_ink`]) and overprints (Discard White Overprint off) puts no ink down, so + /// it paints nothing. fn colorized(&mut self, s: &mut Surface, n: &Node, im: &vectorcraft_doc::ImageObject, p: &Paint) { let overprint = n.colorize_overprints() && self.overprint; - let spot = matches!(p, Paint::Solid { swatch: Some(name), .. } if self.doc.swatch(name).is_some_and(|w| w.spot)); - if overprint && !self.doc.setup.discard_white_overprint && !spot && vectorcraft_doc::overprint::is_white(p) { + if overprint && !self.doc.setup.discard_white_overprint && !self.doc.spot_ink(p) && vectorcraft_doc::overprint::is_white(p) { return; } match self.colorized_image(im, p, !n.extras().pixelated, overprint) { @@ -637,9 +637,9 @@ impl Exporter<'_> { /// Draw a fill or stroke of `paint` with `draw`: as a form marked to overprint when it /// `overprints`, paints and overprints are kept (but not a white one with Discard White - /// Overprint). + /// Overprint, [`Document::discards_white_overprint`]). pub(super) fn overprinting(&mut self, s: &mut Surface, overprints: bool, paint: &Paint, draw: impl FnOnce(&mut Self, &mut Surface)) { - let white = || self.doc.setup.discard_white_overprint && vectorcraft_doc::overprint::is_white(paint); + let white = || self.doc.discards_white_overprint(paint); if overprints && self.overprint && !paint.is_none() && !white() { self.overprinted = true; crate::forms::form(s, Mark::Overprint, |s| draw(self, s)); @@ -652,7 +652,7 @@ impl Exporter<'_> { /// with [`Self::darken_overprints`] an overprinting one is drawn with Darken (not a white one /// with Discard White Overprint). pub(super) fn char_overprinting(&mut self, s: &mut Surface, overprints: bool, paint: &Paint, draw: impl FnOnce(&mut Self, &mut Surface)) { - let white = vectorcraft_doc::overprint::is_white(paint) && self.doc.setup.discard_white_overprint; + let white = self.doc.discards_white_overprint(paint); if overprints && self.darken_overprints && !paint.is_none() && !white { s.push_blend_mode(krilla::blend::BlendMode::Darken); self.overprinting(s, overprints, paint, draw); diff --git a/crates/pdf/src/print.rs b/crates/pdf/src/print.rs index 0672bf97af..604b548a3c 100644 --- a/crates/pdf/src/print.rs +++ b/crates/pdf/src/print.rs @@ -40,7 +40,7 @@ use kurbo::{Affine, Rect, Vec2}; use serde::Serialize; use vectorcraft_color::cms::{self, ProfileKind}; use vectorcraft_doc::marks::PrinterMarks; -use vectorcraft_doc::overprint::{OverprintBlack, clear_overprints, darken_overprints}; +use vectorcraft_doc::overprint::{DiscardWhite, OverprintBlack, clear_overprints, darken_overprints}; use vectorcraft_doc::{ColorMode, Document, Node, NodeKind}; pub use layout::{MAX_COPIES_PER_SHEET, MAX_TILES, TileGrid}; @@ -411,12 +411,12 @@ fn composite_overprints(doc: &mut Document, set: &PrintSettings) { if set.output.mode == OutputMode::Separations || how == PrintOverprints::Preserve { return; } - let discard_white = doc.setup.discard_white_overprint; + let discard_white = DiscardWhite::of(doc); let symbols = doc.symbols.iter_mut().map(|s| &mut s.art); let nodes = doc.layers.iter_mut().chain(symbols).chain(doc.patterns.iter_mut().flat_map(|p| p.art.iter_mut())); for n in nodes { if how == PrintOverprints::Simulate { - darken_overprints(n, discard_white, &doc.images); + darken_overprints(n, &discard_white, &doc.images); } clear_overprints(n); } diff --git a/crates/pdf/src/print/plates.rs b/crates/pdf/src/print/plates.rs index 478b38b329..66c5092391 100644 --- a/crates/pdf/src/print/plates.rs +++ b/crates/pdf/src/print/plates.rs @@ -10,7 +10,7 @@ use vectorcraft_color::swatch::REGISTRATION; use vectorcraft_color::{BlendMode, Color, GradientKind, GradientStop, Paint}; use vectorcraft_doc::inks::{Link, StopPlates, inks, plates, spot_color, stop_inks, visit_node_colors}; use vectorcraft_doc::overprint::{ - colorized_shown_key, darken_overprints, image_overprints_whole, image_row_draws, is_black_ink, is_colorized_image, is_white, refuses_colorize, + DiscardWhite, colorized_shown_key, darken_overprints, image_overprints_whole, image_row_draws, is_black_ink, is_colorized_image, refuses_colorize, }; use vectorcraft_doc::{AppearanceItem, ColorMode, Document, ImageBlob, Node, NodeKind}; @@ -238,8 +238,8 @@ impl<'a> Separator<'a> { /// Overprinting fills and strokes of `a`'s subtree with a Normal blending mode, and /// overprinting character fills and strokes, that put none of ink `plate` down leave its plate - /// as it is: they are drawn as nothing on it (white ones with `discard_white` aside, which - /// knock out). A writer without blending modes (PostScript) then keeps the ink below them, + /// as it is: they are drawn as nothing on it (white ones that `discard_white` knocks out + /// aside, [`DiscardWhite::discards`]). A writer without blending modes (PostScript) then keeps the ink below them, /// where it would draw their Darken as a knockout. One that puts any ink down is drawn, and on /// a PostScript plate its ink replaces the ink below, as a nonzero component of an overprinting /// color replaces the backdrop's with overprint mode 1 (ISO 32000-1, 11.7.4.2). On a @@ -250,8 +250,8 @@ impl<'a> Separator<'a> { /// draws, the PostScript writer leaves out the image's paper-white pixels and draws the row. /// A colorized image that does not overprint as a whole, or whose pixels don't take its color /// ([`refuses_colorize`]) and so print as they are, knocks out on the plate. - fn clear_inkless_overprints(&self, plate: &str, a: &mut Arc, discard_white: bool) { - let inkless = |overprint: bool, p: &Paint| overprint && !p.is_none() && !(discard_white && is_white(p)) && self.no_ink(plate, p); + fn clear_inkless_overprints(&self, plate: &str, a: &mut Arc, discard_white: &DiscardWhite) { + let inkless = |overprint: bool, p: &Paint| overprint && !p.is_none() && !discard_white.discards(p) && self.no_ink(plate, p); let n = Arc::make_mut(a); let whole = image_overprints_whole(n, discard_white, &self.doc.images); if n.colorize_overprints() && !whole { @@ -296,12 +296,12 @@ impl<'a> Separator<'a> { /// ink the plate below shows through instead of being knocked out. pub fn plate(&self, plate: &str) -> Document { let mut d = self.doc.clone(); - let discard_white = d.setup.discard_white_overprint; + let discard_white = DiscardWhite::of(self.doc); let mut colorized = BTreeSet::new(); let nodes = d.layers.iter_mut().chain(d.symbols.iter_mut().map(|s| &mut s.art)).chain(d.patterns.iter_mut().flat_map(|p| p.art.iter_mut())); for n in nodes { - self.clear_inkless_overprints(plate, n, discard_white); - darken_overprints(n, discard_white, &d.images); + self.clear_inkless_overprints(plate, n, &discard_white); + darken_overprints(n, &discard_white, &d.images); self.node(plate, Arc::make_mut(n)); keep_colorized_pixels(n, &d.images, &mut colorized); } diff --git a/crates/pdf/src/tests/colorize.rs b/crates/pdf/src/tests/colorize.rs index 399dab7288..6124a4a637 100644 --- a/crates/pdf/src/tests/colorize.rs +++ b/crates/pdf/src/tests/colorize.rs @@ -375,6 +375,32 @@ fn separations_hide_an_overprinting_image_on_plates_without_its_ink() { } } +/// With Discard White Overprint on, an overprinting colorized image in a tint of a spot ink whose +/// color is white still overprints, in the PDF and on printed separations: it prints as that ink, +/// not as paper white. +#[test] +fn a_white_spot_ink_image_overprints_with_discard_white_overprint() { + let white = Color::cmyk(0.0, 0.0, 0.0, 0.0); + let spot = Paint::Solid { color: white, swatch: Some("White Ink".into()), tint: 0.5 }; + let mut d = doc(ColorMode::Cmyk, Some(spot)); + d.swatches.push(Swatch { name: "White Ink".into(), paint: Paint::solid(white), global: true, spot: true }); + d.setup.discard_white_overprint = true; + let id = d.layers[0].children().unwrap()[0].id; + d.node_mut(id).unwrap().extras_mut().colorize_overprint = true; + let out = pdf(&d); + assert!(String::from_utf8_lossy(&out).contains("/OP true/op true"), "the image overprints"); + assert!(images(&out).contains(&("DeviceN".into(), vec!["White Ink".into()], true)), "{:?}", images(&out)); + + let settings: PrintSettings = serde_json::from_value(serde_json::json!({"output": {"mode": "separations"}})).unwrap(); + let names: Vec = print_inks(&d, &settings).0.into_iter().map(|i| i.name).collect(); + for postscript in [true, false] { + let job = plan(&d, &PrintOptions { settings: settings.clone(), postscript, ..Default::default() }).unwrap(); + for (name, p) in names.iter().zip(&job.plates) { + assert_eq!(p.layers[0].children().unwrap()[0].visible, name == "White Ink", "{name}"); + } + } +} + /// An overprinting colorized image whose pixels don't take its color (a color preview of its /// file) is separated as those pixels on every plate, so it is not hidden on the plates its /// color puts no ink on. diff --git a/crates/render/src/proof.rs b/crates/render/src/proof.rs index 03bb42fcfe..18e25a1e5a 100644 --- a/crates/render/src/proof.rs +++ b/crates/render/src/proof.rs @@ -35,7 +35,7 @@ pub use vectorcraft_color::cms::{Intent, ProofSetup, ProofTarget}; use vectorcraft_color::{Color, Paint, Swatch, SwatchGroup}; pub use vectorcraft_doc::inks::{Inks, Link, Plate, inks, map_document_colors, map_node_colors, plates, spot_color}; use vectorcraft_doc::inks::{StopPlates, map_node_inks, stop_inks}; -use vectorcraft_doc::overprint::darken_overprints; +use vectorcraft_doc::overprint::{DiscardWhite, darken_overprints}; use vectorcraft_doc::{AppearanceItem, Document, ImageBlob, Node, NodeId, Shared}; use vello_cpu::Pixmap; use vello_cpu::color::PremulRgba8; @@ -399,7 +399,8 @@ pub(crate) struct Prepared { /// What [`prepare`] reads besides the art. #[derive(PartialEq)] struct Inputs { - discard_white: bool, + /// Discard White Overprint, with the spot inks a white tint of which still overprints. + discard_white: DiscardWhite, /// [`images_state`]: which pixels a colorized image shows, and whether they take its color /// ([`ImageBlob::takes_colorize`]), and so whether it darkens, depend on the document's images. images: u64, @@ -444,7 +445,7 @@ impl PartialEq for Plates { /// print it ([`plate_color`]). struct How<'a> { doc: &'a Document, - discard_white: bool, + discard_white: DiscardWhite, /// Separations Preview: the color settings, the proof setup and the visible plates. plates: Option<(&'a Cms, &'a ProofSetup, &'a [String])>, } @@ -458,7 +459,7 @@ impl How<'_> { /// Change the fills, strokes and other colors of node `a`, which holds no members. fn apply(&self, a: &mut Arc) { - darken_overprints(a, self.discard_white, &self.doc.images); + darken_overprints(a, &self.discard_white, &self.doc.images); if let Some((c, proof, visible)) = self.plates { map_node_inks(Arc::make_mut(a), &mut |col, sw, plates| plate_color(self.doc, c, proof, visible, col, sw, plates)); } @@ -477,7 +478,7 @@ pub(crate) fn prepare<'a>(doc: &'a Document, opts: &RenderOptions, kept: &mut Op let seps = opts.proof.as_ref().and_then(|p| p.separations.as_ref().map(|s| (p, s))); let c = cms::active(); let inputs = Inputs { - discard_white: doc.setup.discard_white_overprint, + discard_white: DiscardWhite::of(doc), images: images_state(&doc.images), plates: seps.map(|(proof, _)| Plates { proof: proof.clone(), @@ -489,7 +490,7 @@ pub(crate) fn prepare<'a>(doc: &'a Document, opts: &RenderOptions, kept: &mut Op }), }; let earlier = kept.take().filter(|k| k.inputs == inputs); - let how = How { doc, discard_white: inputs.discard_white, plates: seps.map(|(proof, visible)| (&*c, proof, visible.as_slice())) }; + let how = How { doc, discard_white: inputs.discard_white.clone(), plates: seps.map(|(proof, visible)| (&*c, proof, visible.as_slice())) }; let none = (vec![], vec![]); let (layers, art) = earlier.as_ref().map_or((&none, &none), |k| (&k.layers, &k.art)); let made_layers = prepare_list(&doc.layers, &layers.0, &layers.1, &how); diff --git a/docs/mcp.md b/docs/mcp.md index 7f01ce15d9..ba881ac28e 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5089,9 +5089,10 @@ printed plates an image whose pixels do not take its color (a preview of its fil pixels. Older files that listed Overprint Black objects in the document get the flags on load. PDF export writes them with `advanced.overprint: "preserve"` (the default): each overprinting fill and stroke sets a graphics state with `/OP true /op true /OPM 1` (`/OPM 0` in PDF/A). With `discardWhiteOverprint` (`document.setup`, on by -default) white ones knock out instead; `"discard"` writes none. EPS export (`overprints: "preserve"`, the default) turns +default) white ones knock out instead, but not a tint above 0% of a spot swatch, which prints as that ink; +`"discard"` writes none. EPS export (`overprints: "preserve"`, the default) turns overprinting on for a colorized image's color as it does for fills and strokes, except a white color with -`discardWhiteOverprint` on, which knocks out. PDF export writes an overprinting +`discardWhiteOverprint` on, which knocks out unless it is such a spot tint. PDF export writes an overprinting colorized image in a gray or CMYK color in only the process inks the color puts down, and EPS export does too (one DeviceN image at Level 3, one Separation image per ink at Level 2). The previews and printed separations show a colorized image knocking out when it has a visible effect of its own other than a warp or a geometry effect (a drop diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index a523ef3996..5ee2884f3f 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1996,7 +1996,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Colorized images (#1466):** a fill color applied to a selected grayscale or 1-bit image (`paint.setFill`) colorizes it with black, white, a process color or a spot color, and refuses a process color when the image has an alpha channel ([Convert color modes](https://web.archive.org/web/20251220223850/https://helpx.adobe.com/illustrator/desktop/manage-colors/select-and-adjust-colors/convert-color-modes.html), "Colorize Grayscale or 1-bit images"); black and white are accepted there too. The canvas draws each pixel in the color as far as the pixel is dark, with white pixels transparent; PDF export writes the image in the color (a spot color as its ink, Registration in every ink) with the image as its soft mask; Separations Preview and printed separations show it on its color's plates; native files keep the color. SVG writes the fill color through a coverage mask (or a colorized PNG in Tiny 1.2); EPS writes binary coverage as an image mask in the color's ink, and a grayscale image as ink samples scaled by coverage, with white pixels left out at Level 3 and gray midtones written over white. The prompt for deleting several swatches and groups uses the interface language's plural form for the count. Evidence: `deleting_several_swatches_uses_each_count_form` in `crates/ui-egui/src/panels/swatches/tests.rs`. - **Colorized images (#1466):** a fill color applied to a selected grayscale or 1-bit image (`paint.setFill`) colorizes it with black, white, a process color or a spot color, and refuses a process color when the image has an alpha channel ([Convert color modes](https://web.archive.org/web/20251220223850/https://helpx.adobe.com/illustrator/desktop/manage-colors/select-and-adjust-colors/convert-color-modes.html), "Colorize Grayscale or 1-bit images"); black and white are accepted there too. The canvas draws each pixel in the color as far as the pixel is dark, with white pixels transparent; PDF export writes the image in the color (a spot color as its ink, Registration in every ink) with the image as its soft mask; Separations Preview and printed separations show it on its color's plates; native files keep the color. EPS and SVG write the image's own pixels. - - **Colorized images overprint:** Overprint Fill (`object.setOverprint {fill: true}`) on a colorized grayscale or 1-bit image makes its color print over the inks below instead of knocking them out. Raster art has an overprint setting in the [scripting reference](https://ai-scripting.docsforadobe.dev/jsobjref/RasterItem/). `attributes.info` reports it, native files keep it, and Overprint Preview, Separations Preview and printed separations show it; they show an image knocking out when it has a visible effect of its own other than a warp or a geometry effect (a drop shadow, a glow, a raster effect or a color adjustment), or a fill or stroke with an opacity above 0 that draws a shape with Convert to Shape or Outline Object and does not overprint. Printed separations also show an image knocking out when its pixels do not take its color (a preview of its file), and separate those pixels as they are. PDF and EPS export leave raster effects out and still overprint such an image. PDF export draws the image with an overprinting graphics state and writes a gray or process color as an image of only the process inks it puts down (ISO 32000-1 §8.6.7). EPS export turns overprinting on for it and writes a gray or process color in only the process inks it puts down (one DeviceN image at Level 3, one Separation image per ink at Level 2). A legacy `.ai` file writes it with the image mask's fill overprint, and reading one takes the fill overprint in force at the image mask. White follows the rule for white fills: with Discard White Overprint on, PDF export, EPS export, the previews and printed separations show a white color knocking out. Taking the color off with a fill of None also turns its overprint off. Edit › Edit Colors › Overprint Black and Print Ink Fixes' Remove White Overprint reach a colorized image's color as its fill. Evidence: engine `tests::colorize::overprint_fill_makes_a_colorized_images_color_overprint`, `tests::colorize::overprint_black_and_print_fixes_reach_a_colorized_images_color`, `tests::colorize::flattening_without_preserve_overprints_drops_a_colorized_images_overprint`, `tests::colorize::flattening_without_preserve_overprints_clears_an_uncolored_images_overprint`, doc `overprint::tests::a_white_colorized_image_knocks_out_under_discard_white`, `overprint::tests::a_colorized_image_darkens_unless_its_rows_draw_an_effect`, `overprint::tests::a_colorized_image_darkens_past_a_row_with_no_opacity`, `overprint::tests::a_colorized_image_with_a_node_effect_keeps_knocking_out`, `overprint::tests::overprint_black_takes_a_black_colorized_image`, `overprint::tests::clearing_overprints_clears_the_flag_of_an_image_without_a_color`, render `tests::colorize::an_overprinting_colorized_image_keeps_the_ink_below_in_the_previews`, pdf `tests::colorize::an_overprinting_colorized_image_sets_overprint`, `tests::colorize::separations_hide_an_overprinting_image_on_plates_without_its_ink`, `tests::colorize::separations_show_an_overprinting_image_whose_pixels_refuse_its_color`, eps `tests::an_overprinting_colorized_image_writes_only_its_process_inks`, `tests::a_plate_leaves_out_an_overprinting_image_without_its_ink`, `tests::an_overprinting_colorized_image_at_the_page_limit_keeps_all_its_inks_or_none`, `legacy_ai::tests::a_colorized_image_mask_takes_the_fill_overprint_in_force`, doc `live::tests::mesh_warp_image_pieces_keep_an_overprinting_color`, effects `tests::an_image_under_a_geometry_effect_keeps_its_color_and_smoothing`. + - **Colorized images overprint:** Overprint Fill (`object.setOverprint {fill: true}`) on a colorized grayscale or 1-bit image makes its color print over the inks below instead of knocking them out. Raster art has an overprint setting in the [scripting reference](https://ai-scripting.docsforadobe.dev/jsobjref/RasterItem/). `attributes.info` reports it, native files keep it, and Overprint Preview, Separations Preview and printed separations show it; they show an image knocking out when it has a visible effect of its own other than a warp or a geometry effect (a drop shadow, a glow, a raster effect or a color adjustment), or a fill or stroke with an opacity above 0 that draws a shape with Convert to Shape or Outline Object and does not overprint. Printed separations also show an image knocking out when its pixels do not take its color (a preview of its file), and separate those pixels as they are. PDF and EPS export leave raster effects out and still overprint such an image. PDF export draws the image with an overprinting graphics state and writes a gray or process color as an image of only the process inks it puts down (ISO 32000-1 §8.6.7). EPS export turns overprinting on for it and writes a gray or process color in only the process inks it puts down (one DeviceN image at Level 3, one Separation image per ink at Level 2). A legacy `.ai` file writes it with the image mask's fill overprint, and reading one takes the fill overprint in force at the image mask. White follows the rule for white fills: with Discard White Overprint on, PDF export, EPS export, the previews and printed separations show a white color knocking out, but a tint above 0% of a spot swatch whose color is white keeps overprinting, as it does for fills and strokes in PDF export, the previews and printed separations ([White overprint](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/white-overprint.html)). Taking the color off with a fill of None also turns its overprint off. Edit › Edit Colors › Overprint Black and Print Ink Fixes' Remove White Overprint reach a colorized image's color as its fill. Evidence: engine `tests::colorize::overprint_fill_makes_a_colorized_images_color_overprint`, `tests::colorize::overprint_black_and_print_fixes_reach_a_colorized_images_color`, `tests::colorize::flattening_without_preserve_overprints_drops_a_colorized_images_overprint`, `tests::colorize::flattening_without_preserve_overprints_clears_an_uncolored_images_overprint`, doc `overprint::tests::a_white_colorized_image_knocks_out_under_discard_white`, `overprint::tests::a_white_spot_ink_keeps_overprinting_under_discard_white`, `overprint::tests::a_colorized_image_darkens_unless_its_rows_draw_an_effect`, `overprint::tests::a_colorized_image_darkens_past_a_row_with_no_opacity`, `overprint::tests::a_colorized_image_with_a_node_effect_keeps_knocking_out`, `overprint::tests::overprint_black_takes_a_black_colorized_image`, `overprint::tests::clearing_overprints_clears_the_flag_of_an_image_without_a_color`, render `tests::colorize::an_overprinting_colorized_image_keeps_the_ink_below_in_the_previews`, pdf `tests::colorize::an_overprinting_colorized_image_sets_overprint`, `tests::colorize::separations_hide_an_overprinting_image_on_plates_without_its_ink`, `tests::colorize::separations_show_an_overprinting_image_whose_pixels_refuse_its_color`, `tests::colorize::a_white_spot_ink_image_overprints_with_discard_white_overprint`, eps `tests::an_overprinting_colorized_image_writes_only_its_process_inks`, `tests::a_white_spot_ink_colorized_image_overprints_with_discard_white_overprint`, `tests::a_plate_leaves_out_an_overprinting_image_without_its_ink`, `tests::an_overprinting_colorized_image_at_the_page_limit_keeps_all_its_inks_or_none`, `legacy_ai::tests::a_colorized_image_mask_takes_the_fill_overprint_in_force`, doc `live::tests::mesh_warp_image_pieces_keep_an_overprinting_color`, effects `tests::an_image_under_a_geometry_effect_keeps_its_color_and_smoothing`. - **Missing library files:** a persistent swatch or graphic style library panel whose file is gone at startup reopens and stays in the preferences, showing the file's path with Locate Library… (`ui.libraryPanel.locate`), which reads the file from where it is now into the same panel. - **Swatch library and Recolor Artwork parameters:** the `swatch.library.*` commands, `swatch.resetDefaults`, the graphic style library save, load and add, the `recolor.*` commands and `color.harmony`'s `limitTo` refuse parameters of the wrong form, such as `names: "Grays"`, `limitTo: 5` or `includeImages: "false"`. Errors name the parameter, except that a `limitTo` that is not a string, such as `5`, gets an unknown-library error. A `null` counts as left out except for `recolor.apply`'s `model`, which must be a string when given. - **OKLCH Sliders (Color Wheel panel):** as VectorCraft's own addition, the Color Wheel panel's menu item OKLCH Sliders (`ui.colorWheel {sliders: "oklch"}`, kept with the preferences) shows L, C and H rows under the wheel or the box that edit the color by the OKLCH lightness (0 to 100 %), chroma (0 to 100 % of 0.4) and hue (0 to 360°) of its display sRGB, as CSS Color 4 defines them (https://www.w3.org/TR/css-color-4/#specifying-oklab-oklch). Each track dims the colors outside sRGB, and a tick on the C track marks the largest chroma sRGB holds at the row's L and H; a color outside sRGB keeps L and H and takes the largest chroma that fits, and the C row keeps the chroma asked for. The rows take the arrow keys after a click and report their names, values, ranges and adjust actions to screen readers. While the active document's RGB space (its assigned profile, else the working RGB space of Edit › Color Settings) is not sRGB, the unchecked item is gray and `ui.colorWheel {sliders: "oklch"}` answers an error; rows shown before the space changed are gray, and the checked item still hides them. `color.convert {color, to: "oklch"}` answers the same L, C and H for a color inside sRGB. For a color outside sRGB, it clips the display RGB to 0 to 1 first, so its L, C and H can differ from the rows' values. Evidence: `crates/color/src/oklab.rs` tests; `convert_to_oklch_answers_lightness_chroma_and_hue` in `crates/engine/src/tests/colormgmt.rs`; the OKLCH tests in `crates/ui-egui/src/panels/tests_color_wheel.rs`, `the_oklch_tracks_dim_the_colors_outside_srgb_and_the_tick_marks_the_largest_chroma` and `oklch_sliders_are_gray_after_the_working_space_changes` among them. Scores and estimates are unchanged.