Skip to content

.ai import: the live envelope and warped type check sees white art (#6412) - #6413

Merged
bflatastic merged 1 commit into
storytold:mainfrom
jmverges:fix/envelope-check-white-art
Nov 10, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
jmverges:fix/envelope-check-white-art

Conversation

@jmverges

@jmverges jmverges commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Fixes #6412.

When a .ai opens 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 (differing in crates/eps/src/import/ai/envelope.rs, through end_envelope and WarpedType::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).
  • differing counts 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 differing call, 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_art in white. On main the 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_black left out.

What I ran:

  • Every step of cargo xtask ci with 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 the vectorcraft-eps tests. 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's tests::harakat::coloured_harakat_keep_kashida, which picks the Arial installed here.
  • Locally, on 224 of our own .ai files, 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 on main was 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 ci passes (fmt, clippy, tests, assets, brands, layers, wasm), apart from the one machine-specific vectorcraft-text test above.
  • No panics in shipped code: no unwrap(), expect(), panic!, unreachable!, todo! or
    unimplemented! outside tests, and no unchecked indexing on data from files, parameters or
    messages. Errors are returned as Result and shown to the user
    (why and how).
  • Clean-room: nothing copied from Adobe products or GPL/AGPL code (AGENTS.md). The users' files were only read locally.
  • Every new asset has a row in ASSETS.md (no new assets).

Summary by CodeRabbit

  • Bug Fixes

    • Improved comparisons of live envelopes and warped text against saved artwork, including white artwork. Differences that were previously missed can now be detected, helping preserve the correct drawn appearance.
  • Tests

    • Added regression coverage for white artwork in envelopes and warped text, including cases where matching or differing bends affect whether live text is retained.

…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>
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The .ai importer now checks live and saved artwork for pixel differences on both white and black backgrounds. Regression tests cover white envelopes and warped text.

Changes: White artwork comparison

Layer / File(s) Summary
Black-background pixel comparison
crates/eps/src/import/native/compare.rs
differ_on_black reports a difference when the pixel values differ and their Rec. 601 lightness values differ by more than SAME_PIXEL (48).
Live artwork comparison and regression coverage
crates/eps/src/import/ai/envelope.rs, crates/eps/src/import/ai/tests.rs, docs/file-format-parity.md
The envelope comparison includes black-background differences. Regression tests check white envelope artwork and warped text. The parity document records the comparison change.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: dotcoocoo, aiongg

Merge Risk: Minimal · up to 3b1b5

White artwork is checked against its saved appearance without changing opaque-colour comparisons. No merge-blocking risk was identified.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly summarizes the main change: the .ai import check now detects white art in live envelopes and warped type.
Description check Passed The description covers what changed, why it changed, how it was tested, and the required checklist. It also reports the skipped machine-specific test and the timing of CI runs.
Linked Issues check Passed Issue #6412 requires white art that renders differently under a live envelope or warped type to keep its saved appearance. envelope.rs now counts differ_on_black alongside the white and colour com…
Out of Scope Changes check Passed The reported changes in compare.rs, envelope.rs, the AI import tests, and docs/file-format-parity.md support issue #6412. The comparison change is used for the live-envelope and warped-type impo…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

Issue #6412 requires white art that renders differently under a live envelope or warped type to keep its saved appearance. envelope.rs now counts differ_on_black alongside the white and colour comparisons in differing. The black comparison detects lightness differences in premultiplied pixels. The PR summary reports regression tests for both white envelopes and white warped type.

Full details: Out of Scope Changes check

Explanation

The reported changes in compare.rs, envelope.rs, the AI import tests, and docs/file-format-parity.md support issue #6412. The comparison change is used for the live-envelope and warped-type import check. No unrelated changes are identified in the supplied change summary.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files. (2 skipped: 1 unsupported, 1 too large.)

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8400af1 and 3b1b5c7.

Files selected for processing: 4

  • crates/eps/src/import/ai/envelope.rs
  • crates/eps/src/import/ai/tests.rs
  • crates/eps/src/import/native/compare.rs
  • docs/file-format-parity.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@bflatastic
bflatastic merged commit 3290350 into storytold:main Nov 10, 2026
7 checks passed
@bflatastic

Copy link
Copy Markdown
Member

Merged, thanks @jmverges! It passed its CI checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.ai import: the check that keeps a live envelope or warped type can't see white art, so white art that draws elsewhere opens live

2 participants