Repository navigation
.ai import: the live envelope and warped type check sees white art (#6412) - #6413
Conversation
…torytold#6412) The check that keeps a live envelope or warped type only where it draws as the art saved with it renders each on its own, over nothing, and compared the pixels as seen on white. White art over nothing looks like nothing on white, so white contents that drew somewhere else passed and opened live in the wrong place. Pixels now also differ when they look different seen on black, so such art keeps its saved art, as colored art does. Opaque colored art is compared as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Merged, thanks @jmverges! It passed its CI checks. |
What and why
Fixes #6412.
When a
.aiopens from its editing data, a live envelope, or type under a Warp effect, stays live only where VectorCraft draws it like the art saved with it (differingincrates/eps/src/import/ai/envelope.rs, throughend_envelopeandWarpedType::settle). Both sides are rendered on their own, over nothing, and the pixels were compared as seen on white (differ,differ_in_colour). White art over nothing looks like nothing on white, so white contents that VectorCraft drew somewhere else passed the check and opened live in the wrong place. I hit it with white warped type on banners in our own garment files (used locally, not attached).How
compare::differ_on_black: two pixels differ when their lightness seen on black differs (the render is premultiplied, so a pixel's RGB is its color on black).differingcounts a pixel as different when it differs on white, in color, or on black. It is the only caller; the page comparison is unchanged.For opaque art, lightness on black equals lightness on white, so colored art is compared exactly as before. White art now gets what black art always got. One consequence: a thin white line drawn a fraction of a pixel off its saved art now keeps the saved art, as a black one already did. The second
differingcall, which feeds the page-check budget (spent), also counts white differences now; that can only keep saved art more often, never change how a file opens.Docs:
docs/file-format-parity.md(status line and revision history).How it was tested
crates/eps/src/import/ai/tests.rs, written from scratch:a_white_envelope_that_doesnt_come_out_as_drawn_keeps_its_drawn_art:an_envelope_that_doesnt_come_out_as_drawn_keeps_its_drawn_artin white. Onmainthe envelope opens live with no note.white_warped_type_that_draws_elsewhere_comes_in_as_its_look: white type under an arc warp, with the built-in test font. It stays type when its look matches and comes in as its look when the look is bent the other way.Both fail with
differ_on_blackleft out.What I ran:
cargo xtask ciwith Rust 1.99.1 on Linux x86_64, run one by one: fmt, clippy, test, doctests, no-bundled-fonts, pdf-deps, assets, brands, cursors, layers, wasm and i18n-report pass. That ran before I added the warped type test; after it I re-ran fmt, clippy and thevectorcraft-epstests. As in PDF import: image masks open colorized by the color they are painted in (#6313) #6321, I skipped one test that fails on my machine whatever the change:vectorcraft-text'stests::harakat::coloured_harakat_keep_kashida, which picks the Arial installed here..aifiles, measured together with a separate prototype for [Bug Report] [VectorCraft] Envelope Distort #3179 and told apart by file: this change alters 5 files, where 7 white warped text objects now come in as their saved art. In each, the live warp onmainwas off its saved art: in two clearly (white type off its banner), a few points in the others. No file changed whether it opens from its layers or its PDF part.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm), apart from the one machine-specificvectorcraft-texttest above.unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!outside tests, and no unchecked indexing on data from files, parameters ormessages. Errors are returned as
Resultand shown to the user(why and how).
ASSETS.md(no new assets).Summary by CodeRabbit
Bug Fixes
Tests