mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-24 17:23:00 +00:00
Images: colorized image overprint keeps main's white rule and skips painted effects
White now follows the rule main has for white fills: with Discard White Overprint on, PDF export, the previews and printed separations knock a white color out, and EPS export turns overprinting on as it does for fills and strokes. The changes to EPS output for white fills and to white spot inks are no longer part of this change. - The previews and printed separations treat an image with a visible drop shadow, outer glow or Gaussian blur of its own as knocking out, so the effect is not darkened or hidden with the image. - Legacy .ai reading takes an image mask's fill overprint only from an O written after the previous object, not from the path before it. - A fill of None, which takes the color off, also turns its overprint off. - On a PostScript separation plate, an overprinting image whose color puts none of the plate's ink down is left out while a fill or stroke of it still draws, and an image that does not overprint as a whole knocks out. - PDF export writes an overprinting gray color as an image of black ink alone, so the other process inks below it stay.
This commit is contained in:
@@ -231,6 +231,7 @@ pub(crate) fn mesh_warp_image_with(
|
||||
g.knockout = crate::Knockout::On;
|
||||
if let Some(e) = g.extras_if_any() {
|
||||
e.colorize = None;
|
||||
e.colorize_overprint = false;
|
||||
e.image_quad = None;
|
||||
}
|
||||
if mesh_warp_cost(k) > MAX_GENERATED {
|
||||
|
||||
+38
-78
@@ -168,44 +168,6 @@ impl Node {
|
||||
}
|
||||
}
|
||||
|
||||
/// Document Setup → Discard White Overprint as it applies to paints: off, or on with the names of
|
||||
/// the document's spot swatches. Paper white knocks out where it overprints; the color of a spot
|
||||
/// swatch is an ink of its own, so a white spot ink still overprints.
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
pub struct DiscardWhite(Option<Vec<String>>);
|
||||
|
||||
impl DiscardWhite {
|
||||
/// The setting of document `doc`.
|
||||
pub fn of(doc: &Document) -> Self {
|
||||
Self(doc.setup.discard_white_overprint.then(|| doc.spot_names()))
|
||||
}
|
||||
|
||||
/// Whether `p` knocks out instead of overprinting.
|
||||
pub fn knocks_out(&self, p: &Paint) -> bool {
|
||||
self.0.as_ref().is_some_and(|spots| is_paper_white(p, |name| spots.iter().any(|s| s == name)))
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether `p` is paper white ([`is_white`]) and not linked to a swatch that `spot` says is a
|
||||
/// spot ink.
|
||||
fn is_paper_white(p: &Paint, spot: impl Fn(&str) -> bool) -> bool {
|
||||
is_white(p) && !matches!(p, Paint::Solid { swatch: Some(name), .. } if spot(name))
|
||||
}
|
||||
|
||||
impl Document {
|
||||
/// Whether paint `p` is paper white: white ([`is_white`]) and not linked to a spot swatch,
|
||||
/// whose white is an ink.
|
||||
pub fn is_paper_white(&self, p: &Paint) -> bool {
|
||||
is_paper_white(p, |name| self.swatch(name).is_some_and(|w| w.spot))
|
||||
}
|
||||
|
||||
/// Whether paint `p` knocks out where it overprints under Document Setup → Discard White
|
||||
/// Overprint ([`DiscardWhite`]).
|
||||
pub fn discards_white(&self, p: &Paint) -> bool {
|
||||
self.setup.discard_white_overprint && self.is_paper_white(p)
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether fill or stroke row `i` of an image draws: it is visible, has a paint (a stroke a
|
||||
/// width too) and a visible Convert to Shape or Outline Object, which gives a row on an image a
|
||||
/// shape of its own ([`crate::Effect::gives_image_shape`]).
|
||||
@@ -218,22 +180,26 @@ 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 knocked out by `discard_white`.
|
||||
fn darkens(overprint: bool, blend: BlendMode, paint: &Paint, discard_white: &DiscardWhite) -> bool {
|
||||
overprint && blend == BlendMode::Normal && !discard_white.knocks_out(paint)
|
||||
/// 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))
|
||||
}
|
||||
|
||||
/// Whether colorized image `n` is drawn overprinting as a whole: its color overprints
|
||||
/// ([`Node::colorize_overprints`]) with the Normal blend and is not knocked out by
|
||||
/// `discard_white`, 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: &DiscardWhite) -> bool {
|
||||
/// ([`Node::colorize_overprints`]) with the Normal blend and is not white with `discard_white`,
|
||||
/// none of its own visible effects paints past the image (a drop shadow, an outer glow or a blur,
|
||||
/// [`crate::symbol_nine_slice::PAINTED_EFFECTS`]), 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) -> 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),
|
||||
};
|
||||
let paints_past = n.appearance.effects.iter().any(|e| e.visible && crate::symbol_nine_slice::PAINTED_EFFECTS.contains(&e.id.as_str()));
|
||||
n.colorize_overprints()
|
||||
&& n.extras().colorize.as_deref().is_some_and(|p| darkens(true, n.blend, p, discard_white))
|
||||
&& !paints_past
|
||||
&& n.appearance.items.iter().filter(|i| image_row_draws(i)).all(row)
|
||||
}
|
||||
|
||||
@@ -241,10 +207,10 @@ pub fn image_overprints_whole(n: &Node, discard_white: &DiscardWhite) -> bool {
|
||||
/// mode of their own keep it), copying only the nodes on the way to them: on screen and on a
|
||||
/// printed plate this approximates their inks printing over the inks below. Darken keeps the
|
||||
/// stronger ink of each plate (and each additive channel), so a colour overprinting itself stays
|
||||
/// that colour, where Multiply would darken it. Paints that `discard_white` knocks out
|
||||
/// (Document Setup → Discard White Overprint) are left as they are. A colorized image darkens as
|
||||
/// a whole ([`image_overprints_whole`]).
|
||||
pub fn darken_overprints(a: &mut Arc<Node>, discard_white: &DiscardWhite) {
|
||||
/// that colour, where Multiply would darken it. With `discard_white`
|
||||
/// (Document Setup → Discard White Overprint) white fills and strokes knock out instead. A
|
||||
/// colorized image darkens as a whole ([`image_overprints_whole`]).
|
||||
pub fn darken_overprints(a: &mut Arc<Node>, discard_white: bool) {
|
||||
if !a.has_overprint() {
|
||||
return;
|
||||
}
|
||||
@@ -466,37 +432,16 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_white_spot_ink_overprints_under_discard_white() {
|
||||
let mut d = Document::new(100.0, 100.0);
|
||||
let white = Color::cmyk(0.0, 0.0, 0.0, 0.0);
|
||||
d.swatches.push(vectorcraft_color::Swatch { name: "Opaque White".into(), paint: Paint::solid(white), global: true, spot: true });
|
||||
let spot = Paint::Solid { color: white, swatch: Some("Opaque White".into()), tint: 1.0 };
|
||||
let paper = Paint::solid(white);
|
||||
d.setup.discard_white_overprint = true;
|
||||
let discard = DiscardWhite::of(&d);
|
||||
assert!(discard.knocks_out(&paper) && d.discards_white(&paper), "paper white knocks out");
|
||||
assert!(!discard.knocks_out(&spot) && !d.discards_white(&spot), "a white spot ink is an ink");
|
||||
d.setup.discard_white_overprint = false;
|
||||
assert!(!DiscardWhite::of(&d).knocks_out(&paper) && !d.discards_white(&paper), "off: white overprints too");
|
||||
|
||||
// The previews darken the spot ink and leave paper white knocking out.
|
||||
let blend = |fill: Paint| {
|
||||
let mut n = Node::path(NodeId(1), Default::default(), Appearance::basic(fill, Paint::None, 0.0));
|
||||
if let Some(f) = n.appearance.fill_mut() {
|
||||
f.overprint = true;
|
||||
}
|
||||
let mut a = Arc::new(n);
|
||||
darken_overprints(&mut a, &discard);
|
||||
a.appearance.fill().map(|f| f.blend)
|
||||
};
|
||||
assert_eq!(blend(spot.clone()), Some(BlendMode::Darken));
|
||||
assert_eq!(blend(paper.clone()), Some(BlendMode::Normal));
|
||||
let image = |color: Paint| {
|
||||
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);
|
||||
darken_overprints(&mut a, discard_white);
|
||||
a.blend
|
||||
};
|
||||
assert_eq!((image(spot), image(paper)), (BlendMode::Darken, BlendMode::Normal), "a colorized image's color too");
|
||||
let white = Paint::solid(Color::cmyk(0.0, 0.0, 0.0, 0.0));
|
||||
assert_eq!(image(white.clone(), true), BlendMode::Normal, "white knocks out, as a white fill does");
|
||||
assert_eq!(image(white, false), BlendMode::Darken);
|
||||
assert_eq!(image(cmyk(0.0, 0.0, 0.0, 1.0), true), BlendMode::Darken);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -510,7 +455,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
let mut a = Arc::new(n);
|
||||
darken_overprints(&mut a, &DiscardWhite::default());
|
||||
darken_overprints(&mut a, false);
|
||||
a.blend
|
||||
};
|
||||
let shape = "convertToShape.rectangle";
|
||||
@@ -522,6 +467,21 @@ mod tests {
|
||||
assert_eq!(blend(Some((shape, true)), true), BlendMode::Darken, "with an overprinting row the whole image overprints");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_colorized_image_with_a_node_effect_keeps_knocking_out() {
|
||||
let blend = |id: &str, visible: bool| {
|
||||
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);
|
||||
a.blend
|
||||
};
|
||||
assert_eq!(blend("stylize.dropShadow", true), BlendMode::Normal, "a drop shadow is not darkened with the image");
|
||||
assert_eq!(blend("stylize.outerGlow", true), BlendMode::Normal, "nor an outer glow");
|
||||
assert_eq!(blend("stylize.dropShadow", false), BlendMode::Darken, "a hidden effect draws nothing");
|
||||
assert_eq!(blend("distort.roughen", true), BlendMode::Darken, "a geometry effect reshapes the image itself");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn overprint_black_takes_a_black_colorized_image() {
|
||||
let off = |mut n: Node| {
|
||||
|
||||
@@ -212,8 +212,6 @@ fn flattening_cropped_art_keeps_the_art_under_its_hidden_part() {
|
||||
fn overprints_are_kept_or_discarded() {
|
||||
let mut s = session(100.0, 100.0, 1);
|
||||
let id = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 30, "height": 30})).unwrap()["id"].as_u64().unwrap();
|
||||
// Not white, which Discard White Overprint (on by default) knocks out.
|
||||
s.execute("paint.setFill", &json!({"ids": [id], "color": {"c": 100, "m": 0, "y": 0, "k": 0}})).unwrap();
|
||||
s.execute("attributes.set", &json!({"ids": [id], "overprintFill": true})).unwrap();
|
||||
let kept = postscript(&b64(&s.execute("document.exportEps", &json!({"previewFormat": "none"})).unwrap()));
|
||||
assert!(kept.contains("true op\n"), "{kept}");
|
||||
|
||||
@@ -677,7 +677,13 @@ pub(crate) fn apply_paint(s: &mut Session, p: &Value, paint: Paint, fill: bool)
|
||||
characters.borrow_mut().push(n.id);
|
||||
}
|
||||
if index.is_none() && colorized.contains(&n.id) {
|
||||
n.extras_mut().colorize = paint.color().map(|_| Box::new(paint.clone()));
|
||||
let colorize = paint.color().map(|_| Box::new(paint.clone()));
|
||||
// Without a color the image has nothing to overprint, and a later color starts
|
||||
// knocking out.
|
||||
if colorize.is_none() {
|
||||
n.extras_mut().colorize_overprint = false;
|
||||
}
|
||||
n.extras_mut().colorize = colorize;
|
||||
return Ok(());
|
||||
}
|
||||
if index.is_none()
|
||||
|
||||
@@ -751,6 +751,13 @@ fn overprint_fill_makes_a_colorized_images_color_overprint() {
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(!overprints(&s), "undo makes it knock out again");
|
||||
assert_eq!(s.execute("attributes.info", &json!({})).unwrap()["overprintFill"], false);
|
||||
|
||||
// Taking the color off drops its overprint, so a new color knocks out.
|
||||
s.execute("object.setOverprint", &json!({"fill": true})).unwrap();
|
||||
s.execute("paint.setFill", &json!({"none": true})).unwrap();
|
||||
assert!(!s.doc().unwrap().doc.node(id).unwrap().extras().colorize_overprint);
|
||||
s.execute("paint.setFill", &json!({"swatch": "Ink"})).unwrap();
|
||||
assert!(!overprints(&s), "a new color starts knocking out");
|
||||
}
|
||||
|
||||
/// Overprint Black and Print Ink Fixes' Remove White Overprint treat a colorized image's color as
|
||||
|
||||
@@ -531,6 +531,9 @@ struct Reader<'a> {
|
||||
/// The last object read is an image, and only the operators that end its raster (`XH`, `Xr`,
|
||||
/// `N`) came since: its name and opacity mask still follow.
|
||||
image_tail: bool,
|
||||
/// An `O` came since the last object: an image mask read now takes its fill overprint. One
|
||||
/// set for a path before it does not reach the image.
|
||||
image_overprint: bool,
|
||||
nodes: usize,
|
||||
/// What layers that show have that this reader doesn't read (errors).
|
||||
unsupported: BTreeSet<String>,
|
||||
@@ -840,6 +843,7 @@ impl<'a> Reader<'a> {
|
||||
foreign_data: None,
|
||||
after_object: false,
|
||||
image_tail: false,
|
||||
image_overprint: false,
|
||||
nodes: 0,
|
||||
unsupported: BTreeSet::new(),
|
||||
unknown: BTreeSet::new(),
|
||||
|
||||
@@ -821,7 +821,8 @@ impl<'a> Reader<'a> {
|
||||
}
|
||||
|
||||
/// Add an image object with the state's transparency, `mask` as its opacity mask and
|
||||
/// `colorize` as the color that colorizes it, which overprints when the fill overprint (`O`) is on.
|
||||
/// `colorize` as the color that colorizes it, which overprints when an `O` written since the
|
||||
/// last object turned the fill overprint on.
|
||||
fn add_image_colorized(&mut self, im: ImageObject, mask: Option<OpacityMask>, colorize: Option<Paint>, hidden: bool) -> Result<(), String> {
|
||||
let gs = self.gs.clone();
|
||||
let mut node = self.new_node(NodeKind::Image(Box::new(im)), &gs);
|
||||
@@ -829,7 +830,7 @@ impl<'a> Reader<'a> {
|
||||
node.blend = gs.blend;
|
||||
node.knockout_shape = gs.knockout_shape;
|
||||
node.extras_mut().mask = mask.map(Box::new);
|
||||
node.extras_mut().colorize_overprint = colorize.is_some() && gs.overprint_fill;
|
||||
node.extras_mut().colorize_overprint = colorize.is_some() && self.image_overprint && gs.overprint_fill;
|
||||
node.extras_mut().colorize = colorize.map(Box::new);
|
||||
self.add(node, hidden)?;
|
||||
self.image_tail = self.after_object;
|
||||
|
||||
@@ -62,6 +62,7 @@ impl<'a> Reader<'a> {
|
||||
None => return Err("it has art outside its layers".into()),
|
||||
}
|
||||
self.after_object = true;
|
||||
self.image_overprint = false;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -286,7 +286,10 @@ impl<'a> Reader<'a> {
|
||||
"p" | "P" => self.pattern_paint(w, &vals),
|
||||
// A pattern's definition ends.
|
||||
"E" if self.pattern.is_some() => self.done = true,
|
||||
"O" => self.gs.overprint_fill = Self::nums(&vals).last() == Some(&1.0),
|
||||
"O" => {
|
||||
self.gs.overprint_fill = Self::nums(&vals).last() == Some(&1.0);
|
||||
self.image_overprint = true;
|
||||
}
|
||||
"R" => self.gs.overprint_stroke = Self::nums(&vals).last() == Some(&1.0),
|
||||
"XR" => self.gs.rule = if Self::nums(&vals).last() == Some(&1.0) { FillRule::EvenOdd } else { FillRule::NonZero },
|
||||
// Show Center (§12): 1 shows the center point of the paths that follow, and 0 leaves
|
||||
|
||||
@@ -1067,6 +1067,44 @@ fn colorized_images_keep_their_color() {
|
||||
assert_eq!(out.warnings, [IMAGE_ALPHA]);
|
||||
}
|
||||
|
||||
/// A colorized image mask overprints when an `O` written for it says so, and not because the
|
||||
/// path before it overprints.
|
||||
#[test]
|
||||
fn a_colorized_image_mask_takes_only_its_own_fill_overprint() {
|
||||
let opened = |square_overprints: bool, image_overprints: bool, drop_own: bool| {
|
||||
let mut doc = Document::new(200.0, 100.0);
|
||||
doc.layers.clear();
|
||||
let layer = doc.add_layer(Some("Art"));
|
||||
let mut square = shape(&mut doc, shapes::rectangle(Rect::new(5.0, 5.0, 45.0, 30.0)), red(), Paint::None);
|
||||
if let Some(f) = square.appearance.fill_mut() {
|
||||
f.overprint = square_overprints;
|
||||
}
|
||||
doc.insert(Some(layer), usize::MAX, square).unwrap();
|
||||
let paint = Paint::solid(Color::cmyk(0.0, 0.5, 1.0, 0.0));
|
||||
let mask: Vec<u8> = "1001011001101001".bytes().map(|b| if b == b'1' { 0 } else { 255 }).collect();
|
||||
let mut bitmap = colorized_image(&mut doc, (8, 2), mask, &paint, (10.0, 10.0));
|
||||
bitmap.extras_mut().colorize_overprint = image_overprints;
|
||||
doc.insert(Some(layer), usize::MAX, bitmap).unwrap();
|
||||
let mut text = String::from_utf8(write(&doc).bytes).unwrap();
|
||||
if drop_own {
|
||||
let own = "0 0.5 1 0 k\n0 O\n";
|
||||
assert!(text.contains(own), "{text}");
|
||||
text = text.replace(own, "0 0.5 1 0 k\n");
|
||||
}
|
||||
let read = crate::import(text.as_bytes()).unwrap().document;
|
||||
let mut found = vec![];
|
||||
read.walk(|n| {
|
||||
if matches!(n.kind, NodeKind::Image(_)) {
|
||||
found.push(n.colorize_overprints());
|
||||
}
|
||||
});
|
||||
found
|
||||
};
|
||||
assert_eq!(opened(false, true, false), [true]);
|
||||
assert_eq!(opened(true, false, false), [false]);
|
||||
assert_eq!(opened(true, false, true), [false], "the square's overprint is left over");
|
||||
}
|
||||
|
||||
/// The pieces of a colorized warped image work out the image's coverage once, and an image with
|
||||
/// other data works out its own: a black and white image's pieces are written as image masks
|
||||
/// in its color, and a gray image's pieces with its color in their pixels.
|
||||
|
||||
@@ -514,10 +514,9 @@ impl<'a> Scene<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Turn overprinting on for one paint (when overprints are preserved, and `paint` is not paper
|
||||
/// white with Discard White Overprint; a white spot ink still prints); `false` when it stays off.
|
||||
fn overprint_on(&mut self, overprint: bool, paint: &Paint) -> bool {
|
||||
let on = overprint && !self.doc.discards_white(paint) && self.o.overprint == Overprint::Preserve;
|
||||
/// Turn overprinting on for one paint (when overprints are preserved); `false` when it stays off.
|
||||
fn overprint_on(&mut self, overprint: bool) -> bool {
|
||||
let on = overprint && self.o.overprint == Overprint::Preserve;
|
||||
if on {
|
||||
self.line("true op");
|
||||
}
|
||||
@@ -576,8 +575,11 @@ impl<'a> Scene<'a> {
|
||||
let im = &*shown;
|
||||
let blob = self.doc.image_blob(im);
|
||||
match n.extras().colorize.as_deref() {
|
||||
// On a plate, an overprinting image whose color puts none of the plate's ink
|
||||
// down is drawn as nothing, as such a solid color is ([`Self::on_plate`]).
|
||||
Some(p) if self.plate && n.colorize_overprints() && vectorcraft_doc::overprint::is_white(p) => {}
|
||||
Some(p @ Paint::Solid { .. }) if blob.is_none_or(|b| b.gray_source().is_some()) => {
|
||||
let on = self.overprint_on(n.colorize_overprints(), p);
|
||||
let on = self.overprint_on(n.colorize_overprints());
|
||||
self.colorized_image(im, blob, p, on);
|
||||
self.overprint_off(on);
|
||||
}
|
||||
@@ -698,7 +700,7 @@ impl<'a> Scene<'a> {
|
||||
if p.is_none() {
|
||||
return;
|
||||
}
|
||||
let on = self.overprint_on(overprint, p);
|
||||
let on = self.overprint_on(overprint);
|
||||
match p {
|
||||
Paint::None => {}
|
||||
Paint::Solid { color, swatch, tint } => {
|
||||
@@ -801,7 +803,7 @@ impl<'a> Scene<'a> {
|
||||
};
|
||||
match &w.shape {
|
||||
WrittenShape::Stroke { width } => {
|
||||
let on = self.overprint_on(st.overprint, &st.paint);
|
||||
let on = self.overprint_on(st.overprint);
|
||||
self.line_style(st, *width);
|
||||
match &st.paint {
|
||||
Paint::Solid { color, swatch, tint } => {
|
||||
|
||||
+14
-20
@@ -446,26 +446,6 @@ fn spot_colours_are_separations_and_overprints_are_kept_or_dropped() {
|
||||
let page = checked_page(&ps);
|
||||
assert!(page.contains("true op\nVCsp0 setcolorspace 0.5 setcolor\n") && page.contains("false op"), "{page}");
|
||||
assert!(!page_of(&d, &EpsOptions { overprint: Overprint::Discard, ..opts(&d) }).contains("true op"));
|
||||
|
||||
// A white fill that overprints knocks out with Discard White Overprint (the default), and
|
||||
// overprints without it.
|
||||
let Some(id) = d.layers[0].children().and_then(|c| c.first()).map(|n| n.id) else { panic!("the rectangle") };
|
||||
if let Some(AppearanceItem::Fill(f)) = d.node_mut(id).unwrap().appearance.items.first_mut() {
|
||||
f.paint = Paint::solid(Color::WHITE);
|
||||
}
|
||||
assert!(d.setup.discard_white_overprint);
|
||||
assert!(!page_of(&d, &opts(&d)).contains("true op"));
|
||||
// A white spot ink is ink: it still overprints.
|
||||
d.swatches.push(vectorcraft_color::Swatch { name: "White Ink".into(), paint: Paint::solid(Color::WHITE), global: true, spot: true });
|
||||
if let Some(AppearanceItem::Fill(f)) = d.node_mut(id).unwrap().appearance.items.first_mut() {
|
||||
f.paint = Paint::Solid { color: Color::WHITE, swatch: Some("White Ink".into()), tint: 1.0 };
|
||||
}
|
||||
assert!(page_of(&d, &opts(&d)).contains("true op"));
|
||||
if let Some(AppearanceItem::Fill(f)) = d.node_mut(id).unwrap().appearance.items.first_mut() {
|
||||
f.paint = Paint::solid(Color::WHITE);
|
||||
}
|
||||
d.setup.discard_white_overprint = false;
|
||||
assert!(page_of(&d, &opts(&d)).contains("true op"));
|
||||
}
|
||||
|
||||
const GOLD: Color = Color::Cmyk { c: 0.0, m: 0.2, y: 0.8, k: 0.1 };
|
||||
@@ -1260,6 +1240,20 @@ fn an_overprinting_colorized_image_writes_only_its_process_inks() {
|
||||
assert!(ps.contains("VCdn0 setcolorspace") && ps.contains("/DeviceCMYK setcolorspace"), "{ps}");
|
||||
}
|
||||
|
||||
/// On a separation plate, an overprinting colorized image whose color puts none of the plate's ink
|
||||
/// down is drawn as nothing, so the ink below stays; one that knocks out is drawn as paper.
|
||||
#[test]
|
||||
fn a_plate_leaves_out_an_overprinting_image_without_its_ink() {
|
||||
let body = |overprint: bool| {
|
||||
let mut d = colorized_doc(vec![0, 128, 255], Some(Paint::solid(Color::WHITE)));
|
||||
let id = d.layers[0].children().unwrap()[0].id;
|
||||
d.node_mut(id).unwrap().extras_mut().colorize_overprint = overprint;
|
||||
crate::scene::Scene::new(&d, &opts(&d)).on_plate(true).run().body
|
||||
};
|
||||
assert!(!body(true).contains("image"), "{}", body(true));
|
||||
assert!(body(false).contains("image"), "{}", body(false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn uncolorized_image_stays_on_original_eps_path() {
|
||||
let d = colorized_doc(vec![0, 128, 255], None);
|
||||
|
||||
@@ -64,7 +64,7 @@ impl Exporter<'_> {
|
||||
/// [`vectorcraft_doc::MAX_RASTER_ALLOC`]; cached by key and paint (and size when images are
|
||||
/// resampled), image rejections too.
|
||||
/// With `interpolate` (and the export's own setting), viewers may smooth it. With `overprint`
|
||||
/// a CMYK color is written as a DeviceN space of the process inks it holds, so the plates it
|
||||
/// a gray or CMYK color is written as a DeviceN space of the process inks it holds, so the plates it
|
||||
/// leaves at zero keep the inks below: the nonzero overprint mode does not apply to an image's
|
||||
/// samples (ISO 32000-1 §8.6.7).
|
||||
pub(super) fn colorized_image(&mut self, im: &vectorcraft_doc::ImageObject, paint: &Paint, interpolate: bool, overprint: bool) -> Option<Image> {
|
||||
@@ -114,6 +114,10 @@ impl Exporter<'_> {
|
||||
Some(d) => (vec![q(*tint)], ImageColorspace::DeviceN, Some(d.clone())),
|
||||
None if registration => (vec![q(*tint); 4], ImageColorspace::Cmyk, None),
|
||||
None => match self.page_color(color) {
|
||||
// An overprinting gray: black ink only.
|
||||
Color::Gray { k } if overprint && k > 0.0 => {
|
||||
(vec![q(k)], ImageColorspace::DeviceN, DeviceNSpace::new([Colorant::Process(Process::Black)]))
|
||||
}
|
||||
Color::Gray { k } => (vec![q(1.0 - k)], ImageColorspace::Luma, None),
|
||||
// An overprinting CMYK color: the process inks it puts down.
|
||||
Color::Cmyk { c, m, y, k } if overprint && [c, m, y, k].iter().any(|v| *v > 0.0) => {
|
||||
|
||||
@@ -525,11 +525,12 @@ impl Exporter<'_> {
|
||||
}
|
||||
|
||||
/// Draw image `im` of node `n` colorized with `p` ([`Self::colorized_image`]), overprinting
|
||||
/// when its color does ([`Node::colorize_overprints`]). Paper white that overprints (Discard
|
||||
/// White Overprint off) puts no ink down, so it paints nothing.
|
||||
/// 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.
|
||||
fn colorized(&mut self, s: &mut Surface, n: &Node, im: &vectorcraft_doc::ImageObject, p: &Paint) {
|
||||
let overprint = n.colorize_overprints() && self.overprint;
|
||||
if overprint && !self.doc.setup.discard_white_overprint && self.doc.is_paper_white(p) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
match self.colorized_image(im, p, !n.extras().pixelated, overprint) {
|
||||
@@ -635,10 +636,11 @@ 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 paper white with Discard White
|
||||
/// Overprint, [`vectorcraft_doc::Document::discards_white`]).
|
||||
/// `overprints`, paints and overprints are kept (but not a white one with Discard White
|
||||
/// Overprint).
|
||||
pub(super) fn overprinting(&mut self, s: &mut Surface, overprints: bool, paint: &Paint, draw: impl FnOnce(&mut Self, &mut Surface)) {
|
||||
if overprints && self.overprint && !paint.is_none() && !self.doc.discards_white(paint) {
|
||||
let white = || self.doc.setup.discard_white_overprint && vectorcraft_doc::overprint::is_white(paint);
|
||||
if overprints && self.overprint && !paint.is_none() && !white() {
|
||||
self.overprinted = true;
|
||||
crate::forms::form(s, Mark::Overprint, |s| draw(self, s));
|
||||
} else {
|
||||
@@ -650,7 +652,8 @@ 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)) {
|
||||
if overprints && self.darken_overprints && !paint.is_none() && !self.doc.discards_white(paint) {
|
||||
let white = vectorcraft_doc::overprint::is_white(paint) && self.doc.setup.discard_white_overprint;
|
||||
if overprints && self.darken_overprints && !paint.is_none() && !white {
|
||||
s.push_blend_mode(krilla::blend::BlendMode::Darken);
|
||||
self.overprinting(s, overprints, paint, draw);
|
||||
s.pop();
|
||||
|
||||
@@ -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::{DiscardWhite, OverprintBlack, clear_overprints, darken_overprints};
|
||||
use vectorcraft_doc::overprint::{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 = DiscardWhite::of(doc);
|
||||
let discard_white = doc.setup.discard_white_overprint;
|
||||
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);
|
||||
darken_overprints(n, discard_white);
|
||||
}
|
||||
clear_overprints(n);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use vectorcraft_color::cms::{self, Cms, Model, ProfileKind};
|
||||
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::{DiscardWhite, darken_overprints, image_overprints_whole, image_row_draws, is_black_ink};
|
||||
use vectorcraft_doc::overprint::{darken_overprints, image_overprints_whole, image_row_draws, is_black_ink, is_white};
|
||||
use vectorcraft_doc::{AppearanceItem, ColorMode, Document, ImageBlob, Node, NodeKind};
|
||||
|
||||
use super::{DEFAULT_FREQUENCY, InkSettings, PrintInk, PrintSettings};
|
||||
@@ -236,19 +236,25 @@ 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 (those that `discard_white` knocks out aside). 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
|
||||
/// 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,
|
||||
/// 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
|
||||
/// PostScript plate, the stops and points of such a gradient that put none of the ink down
|
||||
/// become paper white ([`Self::clear_inkless_stops`]), which the writer leaves out there. A
|
||||
/// colorized image that overprints as a whole ([`image_overprints_whole`]) and whose color puts
|
||||
/// none of the ink down is hidden on the plate once none of its rows draws there.
|
||||
fn clear_inkless_overprints(&self, plate: &str, a: &mut Arc<Node>, discard_white: &DiscardWhite) {
|
||||
let inkless = |overprint: bool, p: &Paint| overprint && !p.is_none() && !discard_white.knocks_out(p) && self.no_ink(plate, p);
|
||||
/// none of the ink down is hidden on the plate once none of its rows draws there; while a row
|
||||
/// 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 knocks out on the plate.
|
||||
fn clear_inkless_overprints(&self, plate: &str, a: &mut Arc<Node>, discard_white: bool) {
|
||||
let inkless = |overprint: bool, p: &Paint| overprint && !p.is_none() && !(discard_white && is_white(p)) && self.no_ink(plate, p);
|
||||
let n = Arc::make_mut(a);
|
||||
let image = image_overprints_whole(n, discard_white) && n.extras().colorize.as_deref().is_some_and(|p| self.no_ink(plate, p));
|
||||
let whole = image_overprints_whole(n, discard_white);
|
||||
if n.colorize_overprints() && !whole {
|
||||
n.extras_mut().colorize_overprint = false;
|
||||
}
|
||||
let image = whole && n.extras().colorize.as_deref().is_some_and(|p| self.no_ink(plate, p));
|
||||
for it in &mut n.appearance.items {
|
||||
let normal = match it {
|
||||
AppearanceItem::Fill(l) => l.blend == BlendMode::Normal,
|
||||
@@ -287,12 +293,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 = DiscardWhite::of(&d);
|
||||
let discard_white = d.setup.discard_white_overprint;
|
||||
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);
|
||||
self.clear_inkless_overprints(plate, n, discard_white);
|
||||
darken_overprints(n, discard_white);
|
||||
self.node(plate, Arc::make_mut(n));
|
||||
keep_colorized_pixels(n, &d.images, &mut colorized);
|
||||
}
|
||||
|
||||
@@ -142,20 +142,17 @@ fn an_overprinting_colorized_image_sets_overprint() {
|
||||
let Some(id) = d.layers[0].children().and_then(|c| c.first()).map(|n| n.id) else { panic!("the image") };
|
||||
d.node_mut(id).unwrap().extras_mut().colorize_overprint = true;
|
||||
assert!(images(&pdf(&d)).contains(&("DeviceN".into(), vec!["Black".into()], true)), "{:?}", images(&pdf(&d)));
|
||||
// A gray color is black ink alone.
|
||||
d.node_mut(id).unwrap().extras_mut().colorize = Some(Box::new(Paint::solid(Color::Gray { k: 0.6 })));
|
||||
assert!(images(&pdf(&d)).contains(&("DeviceN".into(), vec!["Black".into()], true)), "{:?}", images(&pdf(&d)));
|
||||
|
||||
// Paper white knocks out with Discard White Overprint (the default); without it, overprinting
|
||||
// white puts no ink down and paints nothing.
|
||||
// White knocks out with Discard White Overprint (the default), as a white fill does; without
|
||||
// it, an overprinting white process color puts no ink down and paints nothing.
|
||||
d.node_mut(id).unwrap().extras_mut().colorize = Some(Box::new(Paint::solid(Color::cmyk(0.0, 0.0, 0.0, 0.0))));
|
||||
assert_eq!(images(&pdf(&d)).len(), 2, "the white image and its soft mask");
|
||||
assert!(!text(&d).contains("/OP true"), "white knocks out");
|
||||
d.setup.discard_white_overprint = false;
|
||||
assert!(images(&pdf(&d)).is_empty(), "{:?}", images(&pdf(&d)));
|
||||
|
||||
// A white spot ink is an ink: it overprints with Discard White Overprint too.
|
||||
let white = Color::cmyk(0.0, 0.0, 0.0, 0.0);
|
||||
d.swatches.push(Swatch { name: "Opaque White".into(), paint: Paint::solid(white), global: true, spot: true });
|
||||
d.node_mut(id).unwrap().extras_mut().colorize = Some(Box::new(Paint::Solid { color: white, swatch: Some("Opaque White".into()), tint: 1.0 }));
|
||||
d.setup.discard_white_overprint = true;
|
||||
assert!(text(&d).contains("/OP true/op true"), "the white spot ink overprints");
|
||||
}
|
||||
|
||||
/// Registration prints on every plate: the process inks and the document's spot inks.
|
||||
@@ -362,6 +359,20 @@ fn separations_hide_an_overprinting_image_on_plates_without_its_ink() {
|
||||
assert_eq!(visible, name == "Ink", "{name}");
|
||||
}
|
||||
}
|
||||
|
||||
// With a drop shadow of its own the image knocks out on every plate, so the PostScript
|
||||
// writer draws it there.
|
||||
let mut d = doc(ColorMode::Cmyk, Some(spot));
|
||||
let id = d.layers[0].children().unwrap()[0].id;
|
||||
let n = d.node_mut(id).unwrap();
|
||||
n.extras_mut().colorize_overprint = true;
|
||||
n.appearance.effects.push(vectorcraft_doc::Effect { id: "stylize.dropShadow".into(), params: serde_json::json!({}), visible: true });
|
||||
let settings: PrintSettings = serde_json::from_value(serde_json::json!({"output": {"mode": "separations"}})).unwrap();
|
||||
let job = plan(&d, &PrintOptions { settings, postscript: true, ..Default::default() }).unwrap();
|
||||
for p in &job.plates {
|
||||
let image = &p.layers[0].children().unwrap()[0];
|
||||
assert!(image.visible && !image.extras().colorize_overprint, "{:?}", image.extras());
|
||||
}
|
||||
}
|
||||
|
||||
/// Printed separations separate a colorized image with a color mask as it shows: the pixels the
|
||||
|
||||
@@ -34,7 +34,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::{DiscardWhite, darken_overprints};
|
||||
use vectorcraft_doc::overprint::darken_overprints;
|
||||
use vectorcraft_doc::{AppearanceItem, Document, ImageBlob, Node, NodeId, Shared};
|
||||
use vello_cpu::Pixmap;
|
||||
use vello_cpu::color::PremulRgba8;
|
||||
@@ -398,7 +398,7 @@ pub(crate) struct Prepared {
|
||||
/// What [`prepare`] reads besides the art.
|
||||
#[derive(PartialEq)]
|
||||
struct Inputs {
|
||||
discard_white: DiscardWhite,
|
||||
discard_white: bool,
|
||||
plates: Option<Plates>,
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ impl PartialEq for Plates {
|
||||
/// print it ([`plate_color`]).
|
||||
struct How<'a> {
|
||||
doc: &'a Document,
|
||||
discard_white: DiscardWhite,
|
||||
discard_white: bool,
|
||||
/// Separations Preview: the color settings, the proof setup and the visible plates.
|
||||
plates: Option<(&'a Cms, &'a ProofSetup, &'a [String])>,
|
||||
}
|
||||
@@ -443,7 +443,7 @@ impl How<'_> {
|
||||
|
||||
/// Change the fills, strokes and other colors of node `a`, which holds no members.
|
||||
fn apply(&self, a: &mut Arc<Node>) {
|
||||
darken_overprints(a, &self.discard_white);
|
||||
darken_overprints(a, self.discard_white);
|
||||
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));
|
||||
}
|
||||
@@ -462,7 +462,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: DiscardWhite::of(doc),
|
||||
discard_white: doc.setup.discard_white_overprint,
|
||||
plates: seps.map(|(proof, _)| Plates {
|
||||
proof: proof.clone(),
|
||||
swatches: doc.swatches.clone(),
|
||||
@@ -473,7 +473,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.clone(), plates: seps.map(|(proof, visible)| (&*c, proof, visible.as_slice())) };
|
||||
let how = How { doc, discard_white: inputs.discard_white, 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);
|
||||
|
||||
+4
-4
@@ -5087,10 +5087,10 @@ does not overprint, the whole image knocks out in the previews and on printed pl
|
||||
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
|
||||
overprinting on for each one, white ones aside with `discardWhiteOverprint`. Both exports write an overprinting
|
||||
colorized image in a CMYK color in only the process inks the color puts down (in EPS one DeviceN image at Level 3,
|
||||
one Separation image per ink at Level 2). The color of a spot swatch is an ink, so
|
||||
a white spot color keeps overprinting with `discardWhiteOverprint`, in both exports and in both previews.
|
||||
overprinting on for a colorized image's color as it does for fills and strokes. 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 so for a
|
||||
CMYK color (one DeviceN image at Level 3, one Separation image per ink at Level 2). The previews and printed
|
||||
separations show a colorized image with a visible drop shadow, outer glow or Gaussian blur of its own knocking out.
|
||||
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"object.setOverprint","params":{"ids":[12],"stroke":true}}}
|
||||
|
||||
@@ -1994,7 +1994,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, as raster art has an overprint setting of its own in the [scripting reference](https://ai-scripting.docsforadobe.dev/jsobjref/RasterItem/). `attributes.info` reports it, native files keep it, Overprint Preview, Separations Preview and printed separations show it (when a fill or stroke of the image draws a shape with Convert to Shape or Outline Object and does not overprint, the whole image knocks out there), PDF export draws the image with an overprinting graphics state (a process color as an image of only the process inks it puts down, since the nonzero overprint mode does not apply to image samples, ISO 32000-1 §8.6.7), EPS export turns overprinting on for it and writes a process color in only the process inks it puts down (one DeviceN image at Level 3, one Separation image per ink at Level 2), and a legacy `.ai` file writes it with the image mask's fill overprint and reads it back. EPS export now also leaves white fills, strokes and colorized images knocking out with Discard White Overprint on, as PDF export does; in both exports and both previews a white spot color is an ink and keeps overprinting. 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_spot_ink_overprints_under_discard_white`, `overprint::tests::a_colorized_image_darkens_unless_its_rows_draw_an_effect`, `overprint::tests::overprint_black_takes_a_black_colorized_image`, render `tests::colorize::an_overprinting_colorized_image_keeps_the_ink_below_in_the_previews`, pdf `tests::colorize::an_overprinting_colorized_image_sets_overprint`, eps `tests::spot_colours_are_separations_and_overprints_are_kept_or_dropped`, `tests::an_overprinting_colorized_image_writes_only_its_process_inks`, 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 drop shadow, outer glow or Gaussian blur of its own, or a fill or stroke that draws a shape with Convert to Shape or Outline Object and does not overprint. 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 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 reads it back. White follows the rule for white fills: with Discard White Overprint on, PDF export and the previews 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_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`, eps `tests::an_overprinting_colorized_image_writes_only_its_process_inks`, `legacy_ai::tests::a_colorized_image_mask_takes_only_its_own_fill_overprint`, 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.
|
||||
|
||||
Reference in New Issue
Block a user