Proof Setup: filters in a CMYK document keep their ink channels

With a proof that preserves the colors' numbers, art drawn in screen
colors in a CMYK document (an art brush's art) ran its filters on RGB
channels, so Color Halftone screened lights instead of inks while the
proof was on. The proofed screen ink now selects the same CMYK channels
as the unproofed one.
This commit is contained in:
dotCooCoo
2026-11-14 22:04:30 -08:00
parent 3c5201c7a2
commit fca88e935c
2 changed files with 32 additions and 1 deletions
+31
View File
@@ -348,6 +348,37 @@ mod tests {
}
}
/// 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]
+1 -1
View File
@@ -122,7 +122,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