Appearance of Black › Printing / Exporting: cover ink-plane documents and CMYK exports

Drops the documented richBlack parameter: commands don't list it.
This commit is contained in:
bflatastic 2026-10-14 04:50:37 +07:00
parent b6d14b1fd0
commit cfa65a2148
2 changed files with 24 additions and 1 deletions

View File

@ -136,6 +136,29 @@ fn black_output_rich_draws_pure_cmyk_black_as_rgb_black_in_png() {
assert_eq!(centre(&mut s), rich, "a rich black shows the same either way");
}
/// Output All Blacks as Rich Black reaches a CMYK document composed from ink planes (one with a
/// blending mode) as it does one drawn directly, and leaves CMYK-model exports alone: only RGB
/// output changes.
#[test]
fn black_output_rich_covers_ink_plane_documents_and_leaves_cmyk_exports_alone() {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 40, "height": 20, "colorMode": "cmyk"})).unwrap();
s.execute("paint.setStroke", &json!({"none": true})).unwrap();
s.execute("paint.setFill", &json!({"color": {"c": 0, "m": 0, "y": 0, "k": 1}})).unwrap();
s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 20, "height": 20})).unwrap();
s.execute("shape.rectangle", &json!({"x": 30, "y": 0, "width": 10, "height": 20})).unwrap();
s.execute("transparency.set", &json!({"blendMode": "multiply"})).unwrap();
let png =
|s: &mut Session| rgba(&b64(&s.execute("document.export", &json!({"format": "png", "background": "white"})).unwrap())).get_pixel(10, 10).0;
let cmyk = |s: &mut Session, format: &str| b64(&s.execute("document.export", &json!({"format": format, "colorModel": "cmyk"})).unwrap());
let accurate = png(&mut s);
assert!(accurate[0] > 10, "accurate: dark grey, {accurate:?}");
let inks = [cmyk(&mut s, "tiff"), cmyk(&mut s, "jpg")];
s.execute("prefs.set", &json!({"key": "blackOutput", "value": "rich"})).unwrap();
assert_eq!(png(&mut s), [0, 0, 0, 255], "rich: RGB black through the ink planes too");
assert!(inks == [cmyk(&mut s, "tiff"), cmyk(&mut s, "jpg")], "CMYK exports keep the document's inks");
}
#[test]
fn formats_list_the_raster_options() {
let mut s = Session::new();

View File

@ -1806,7 +1806,7 @@ black tints and images show the same either way, and exports are unchanged. `bla
Printing / Exporting, `accurate` by default) does the same for RGB raster exports (`document.export`,
`document.serialize`, `document.exportSelection`, `document.exportForScreens`, `document.exportForOffice`) and for
Print as Bitmap: `rich` draws pure CMYK black as RGB black in the pixels; CMYK ink exports and the document's
colours stay as they are. Agents can also pass `richBlack: true` on those raster options. `antiAliasedBitmaps` (off by default;
colours stay as they are. `antiAliasedBitmaps` (off by default;
desktop app): in View › Pixel Preview, on softens placed and embedded bitmaps; off, their pixels stay hard-edged.
`disableAutoAddDelete` (off by default): on, the Pen no longer adds or deletes an anchor when a click lands on a
segment or an anchor of a selected path.