From 3dac89fe53304320cce042f4af29b9a21aea0771 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 27 Nov 2026 18:12:47 -0800 Subject: [PATCH] Outline view: test the crossed box in envelopes and blends of placed documents In Outline mode without Show Images in Outline Mode, an envelope holding a placed document distorts the document's crossed box, since the envelope reads the art that PlacedDocument::art gives while placed documents are crossed. Each step of a blend of placed documents is a placed document itself, so it is drawn crossed. - outline_mode_warps_an_enveloped_placed_documents_crossed_box: an Arc warp of a placed document draws the same pixels as the same warp of its crossed box as a plain path, and the file's art with Show Images in Outline Mode on. - outline_mode_draws_each_step_of_a_blend_of_placed_documents_crossed: the step between two placed ends is crossed, and drawn uncrossed with the option on. Docs: docs/ui-parity.md row, docs/mcp.md outlineImages. --- crates/render/src/tests/placed_document.rs | 76 ++++++++++++++++++++++ docs/mcp.md | 3 +- docs/ui-parity.md | 2 +- 3 files changed, 79 insertions(+), 2 deletions(-) diff --git a/crates/render/src/tests/placed_document.rs b/crates/render/src/tests/placed_document.rs index 3e42135f1a..46ce1aad6f 100644 --- a/crates/render/src/tests/placed_document.rs +++ b/crates/render/src/tests/placed_document.rs @@ -383,6 +383,82 @@ fn an_enveloped_placed_document_shows_its_file_once_read() { assert!(after == Renderer::new().render(&d, 100, 100, Affine::IDENTITY, &opts).pixels, "as a new renderer draws it"); } +#[test] +fn outline_mode_warps_an_enveloped_placed_documents_crossed_box() { + let outline = |r: &mut Renderer, d: &Document| { + let opts = RenderOptions { background: Some([255, 255, 255, 255]), outline: true, ..Default::default() }; + r.render(d, 100, 100, Affine::IDENTITY, &opts).pixels + }; + // An Arc warp of the box (10, 10)–(90, 50), once holding the placed document and once holding + // its crossed box as a plain path. + let envelope = |content: Arc| { + let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true, version: 0 }; + Node::new( + NodeId(60), + NodeKind::Envelope { + content: vec![content], + kind: Box::new(kind), + fidelity: 50.0, + editing: false, + options: Default::default(), + frame: Box::new(Affine::IDENTITY), + }, + ) + }; + let mut d = doc_with("outline-envelope-1", b"loop"); + let placed = d.remove(NodeId(50)).unwrap(); + let NodeKind::PlacedDocument(p) = &placed.kind else { panic!("a placed document") }; + let crossed = p.crossed_art(&placed); + let l = d.layers[0].id; + d.insert(Some(l), 0, envelope(placed)).unwrap(); + // Exporting the document as PDF, SVG or EPS reads the file. + d.with_placed_art(); + let mut boxed = d.clone(); + boxed.remove(NodeId(60)).unwrap(); + boxed.insert(Some(l), 0, envelope(Arc::new(crossed))).unwrap(); + let mut r = Renderer::new(); + let warped = outline(&mut r, &d); + assert!(warped == outline(&mut Renderer::new(), &boxed), "the envelope warps the crossed box"); + // With Show Images in Outline Mode the same renderer warps the file's art, and the crossed box + // again without it. + d.setup.outline_images = true; + let shown = outline(&mut r, &d); + assert!(shown != warped, "the file's art is warped"); + assert!(shown == outline(&mut Renderer::new(), &d), "as a new renderer draws it"); + d.setup.outline_images = false; + assert!(outline(&mut r, &d) == warped, "the crossed box again"); +} + +#[test] +fn outline_mode_draws_each_step_of_a_blend_of_placed_documents_crossed() { + let opts = RenderOptions { background: Some([255, 255, 255, 255]), outline: true, ..Default::default() }; + let inked = |r: &Rendered, x: u32, y: u32| r.pixel(x, y)[0] < 200; + // A blend of the 40×20 file placed at (5, 5) and at (55, 75), with one step between them: its box + // is (30, 40)–(70, 60), and its diagonal from the top left passes (60, 55). The file's art is a + // rectangle the size of the box. + let mut d = Document::new(100.0, 100.0); + d.images.insert("outline-blend-1".into(), ImageBlob::new("application/json", b"blue".to_vec())); + vectorcraft_doc::placed_document::set_loader(gated_blue_page); + let ends = vec![ + Arc::new(placed_node(51, "outline-blend-1", 40.0, 20.0, Affine::translate((5.0, 5.0)))), + Arc::new(placed_node(52, "outline-blend-1", 40.0, 20.0, Affine::translate((55.0, 75.0)))), + ]; + let spec = vectorcraft_doc::live::BlendSpec { spacing: vectorcraft_doc::live::BlendSpacing::Steps(1), ..Default::default() }; + let l = d.layers[0].id; + d.insert(Some(l), 0, Node::new(NodeId(60), NodeKind::Blend { children: ends, spec: Box::new(spec) })).unwrap(); + // Exporting the document as PDF, SVG or EPS reads the file. + d.with_placed_art(); + let mut r = Renderer::new(); + let crossed = r.render(&d, 100, 100, Affine::IDENTITY, &opts); + assert!(inked(&crossed, 60, 55), "the step between the ends is crossed"); + assert!(inked(&crossed, 15, 10) && inked(&crossed, 65, 80), "and so are the ends"); + assert!(crossed.pixels == Renderer::new().render(&d, 100, 100, Affine::IDENTITY, &opts).pixels, "as a new renderer draws it"); + d.setup.outline_images = true; + let shown = r.render(&d, 100, 100, Affine::IDENTITY, &opts); + assert!(!inked(&shown, 60, 55), "with Show Images in Outline Mode the step is not crossed"); + assert!(inked(&shown, 50, 40), "and its file's art is drawn in outline"); +} + #[test] fn a_placed_document_with_a_drop_shadow_shows_its_file_once_read() { let mut d = doc("shadowed-1"); diff --git a/docs/mcp.md b/docs/mcp.md index 3f35d2b558..1c401b5e8d 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -9633,7 +9633,8 @@ art) and Align New Objects to Pixel Grid (see [Align New Objects to Pixel Grid]( `outlineImages` is Show Images in Outline Mode. While it is off, Outline mode draws a linked image's frame crossed from corner to corner, and a placed document as its box crossed the same way without its art; an embedded image shows its frame alone. Effects that change geometry, a placed document's own or its group's, reshape the crossed box -instead of the file's art. While it is on, images show their pixels in gray and +instead of the file's art, and an envelope holding a placed document distorts its crossed box. Each step of a blend +of placed documents is crossed too. While it is on, images show their pixels in gray and placed documents show their art. Pass any of these keys to change them in one undo step; `document.setUnits` stays as an alias for `units`. A file whose bleed (0 to 72 pt a side), superscript and subscript sizes (1 to 500%) and positions (-500 to 500%) or diff --git a/docs/ui-parity.md b/docs/ui-parity.md index c3e53cdb1c..84a3fca83a 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -549,7 +549,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Outline view draws on a white canvas, the artboards as their edges | done | Outline shows only the paths ([Outline mode](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/preview-artwork-as-outlines.html)). VectorCraft's own rule for the canvas: in every interface brightness and Canvas Color the whole canvas is white, pasteboard included; the artboards draw no paper (no Simulate Colored Paper or artboard color, and no paper with Hide Artboards); the artboard names and the ruler origin's crosshair are dark gray; split views and floating windows follow their own view. Tests `outline_draws_on_a_white_canvas_with_artboards_as_edges`, `outline_draws_no_colored_paper`, `a_pane_draws_its_own_views_outline`, `the_ruler_origin_crosshair_shows_on_the_outline_canvas` | | Overprint Preview draws a white canvas around the artboards, with no artboard shadows | done | VectorCraft's own rule, in Overprint Preview and in Separations Preview, which turns it on: while the artboards show, the canvas outside the artboards is white in every interface brightness and Canvas Color, and the artboards keep their paper and edges and draw no shadows. With a display profile, translucent art around the artboards is blended with the white canvas. Turning the preview off brings back the pasteboard color and the shadows. Tests `overprint_preview_draws_a_white_canvas_without_shadows`, `translucent_art_around_the_artboards_is_blended_with_overprint_previews_white_canvas`, `translucent_pixels_around_the_artboards_are_blended_with_the_white_canvas` | | Outline view: a click selects by the outlines drawn, so it reaches a path behind an image (picked on its frame, unless Show Images in Outline Mode draws its pixels) or a gradient mesh (picked on its mesh lines) | done | #6437; in Outline mode the path is selected directly ([Object selection methods and preferences](https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/object-selection-methods-and-preferences.html), Object Selection by Path Only). Type, symbol instances, blends, envelopes and placed documents are still picked within their bounds. Tests `outline_mode_picks_paths_through_images_and_meshes`, `outline_view_click_through_an_image_selects_the_path_behind` | -| Outline view draws a linked image or placed document as its box with an X inside, unless Show Images in Outline Mode is on | done | A linked file draws in Outline mode as a box with an X in it, and its contents show only after the Document Setup option Show Images in Outline Mode is turned on ([View artwork](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)). The rest are VectorCraft's own rules. A linked image's frame is crossed from corner to corner, following the corners of a turned or distorted image. An embedded image, and each piece that an envelope cuts an image into, shows its frame alone. A click selects a linked image on its frame, as before, and not on the lines. A placed document shows its box crossed and none of its art, also with raster effects such as a drop shadow and with color adjustments. Effects that change geometry, its own or its group's, reshape the crossed box instead of the file's art. With the option on, images show their pixels in gray and placed documents show their art in outline, uncrossed, and the art inside a placed document follows the option of the document it is placed in. Preview mode and output draw them as before. Tests `outline_mode_crosses_a_linked_images_frame_unless_the_setup_shows_images`, `outline_mode_crosses_a_linked_image_with_a_color_mask`, `outline_mode_does_not_cross_the_pieces_of_an_enveloped_linked_image`, `outline_mode_crosses_a_linked_image_moved_into_a_warp_piece`, `outline_mode_crosses_a_turned_or_distorted_linked_image_through_its_corners`, `outline_mode_draws_a_placed_document_as_its_box_crossed_unless_the_setup_shows_images`, `outline_mode_reshapes_the_crossed_box_of_a_placed_document_by_its_groups_effects`, `outline_mode_draws_the_crossed_box_its_effects_move_into_view_after_a_preview_frame` | +| Outline view draws a linked image or placed document as its box with an X inside, unless Show Images in Outline Mode is on | done | A linked file draws in Outline mode as a box with an X in it, and its contents show only after the Document Setup option Show Images in Outline Mode is turned on ([View artwork](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)). The rest are VectorCraft's own rules. A linked image's frame is crossed from corner to corner, following the corners of a turned or distorted image. An embedded image, and each piece that an envelope cuts an image into, shows its frame alone. A click selects a linked image on its frame, as before, and not on the lines. A placed document shows its box crossed and none of its art, also with raster effects such as a drop shadow and with color adjustments. Effects that change geometry, its own or its group's, reshape the crossed box instead of the file's art, and an envelope holding a placed document distorts its crossed box. Each step of a blend of placed documents is crossed too. With the option on, images show their pixels in gray and placed documents show their art in outline, uncrossed, and the art inside a placed document follows the option of the document it is placed in. Preview mode and output draw them as before. Tests `outline_mode_crosses_a_linked_images_frame_unless_the_setup_shows_images`, `outline_mode_crosses_a_linked_image_with_a_color_mask`, `outline_mode_does_not_cross_the_pieces_of_an_enveloped_linked_image`, `outline_mode_crosses_a_linked_image_moved_into_a_warp_piece`, `outline_mode_crosses_a_turned_or_distorted_linked_image_through_its_corners`, `outline_mode_draws_a_placed_document_as_its_box_crossed_unless_the_setup_shows_images`, `outline_mode_reshapes_the_crossed_box_of_a_placed_document_by_its_groups_effects`, `outline_mode_draws_the_crossed_box_its_effects_move_into_view_after_a_preview_frame`, `outline_mode_warps_an_enveloped_placed_documents_crossed_box`, `outline_mode_draws_each_step_of_a_blend_of_placed_documents_crossed` | | Arrange Tools add-on (VectorCraft addition): Object › Plug-ins › Arrange Tools runs Arrange in Grid… (grid by row, one row or one column; columns, H and V spacing, Center on Artboard; Preview), Swap Objects, Swap Objects and Sizes, Replace with Top Object… (Actual Size, Bounds or Bounds (Fit Proportionally); Keep Original; Scale Strokes & Effects; Preview), Set Size of Each… (Width and Height each ticked on or off, Constrain Width and Height Proportions with one side, the reference point, Scale Strokes & Effects; Preview) and Zoom to Selection, each one undo step | done | `addon.arrange.*`, `crates/engine/src/cmd/addons/arrange.rs`, `crates/ui-egui/src/addons/arrange.rs` and their tests; not a feature of the reference app, so it is not scored | | Arrange Tools add-on (VectorCraft addition): Object › Plug-ins › Arrange Tools › Group Overlapping Objects groups the selected objects whose visual bounds overlap or touch (chains included, within one layer or group), each group at its frontmost member's stacking place, one undo step | done | #4928; `addon.arrange.groupOverlapping`, `crates/engine/src/cmd/addons/arrange.rs` and its tests; not a feature of the reference app, so it is not scored | | Arrange Tools add-on (VectorCraft addition): Object › Plug-ins › Arrange Tools › Randomize Opacity… gives each selected object its own opacity at random between Minimum and Maximum (%), with a Seed that repeats it and Preview, one undo step | done | #4925; `addon.arrange.randomizeOpacity`, `crates/engine/src/cmd/addons/arrange.rs`, `crates/ui-egui/src/addons/arrange.rs` and their tests; not a feature of the reference app, so it is not scored |