Repository navigation
Conversation
…amp point 0 to 100 The version 7 .ai writer wrote the %_Bs color stops of every gradient from ramp point 100 down to 0. The Adobe Illustrator File Format Specification version 7.0 lists a linear gradient's stops in that order (section 1.4.3). Its radial definition, "White & Purple Radial", lists them from 10 to 100 (section 3.5.2). As reported on storytold#2807, the reference app reads both stops of storytold#2687's radial gradient, written from 100 down to 0, at ramp point 100 and draws the circle in #1b2a6b. It reads a radial gradient with three stops written that way in reverse order. The writer now lists a radial gradient's stops from the first to the last. Each stop is written with its own midpoint to the next stop, and section 3.5.2 says the last stop's midpoint is ignored. Linear gradients are unchanged.
Contributor
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Fixes #2687. This follows up #2807.
On
main, saving #2687's SVG as a version 7.ai(--ai-version 7) writes the%_Bscolor stops of both gradientsfrom ramp point 100 down to 0. On #2807, @alongtheblue-sketch
reported that the reference app reads
both stops of the radial gradient written that way at ramp point 100 and draws the circle in #1b2a6b. It reads a
radial gradient with three stops written the same way in reverse order. The same file with the radial stops listed
from 0 to 100 drew as the SVG does, with or without
Bh.The Adobe Illustrator File Format Specification version 7.0
(PDF) lists a linear gradient's stops from 100 to 0
(§1.4.3, p. 10). Its radial definition, "White & Purple Radial" (§3.5.2, p. 42), lists them from 10 to 100.
The writer now lists a radial gradient's stops from the first to the last. Each stop is written with its own midpoint
to the next stop, and §3.5.2 says the last stop's midpoint is ignored. Linear gradients are unchanged. This branch was
not checked in the reference app.
How it was tested
legacy_ai::tests::radial_gradient_stops_are_listed_from_the_first(crates/eps) writes a radial and a lineargradient with three stops and checks each
%_Bsline's color, midpoint and ramp point in order. It reads the fileback and checks both gradients' stops.
tests_legacy_ai::a_radial_gradient_lists_its_stops_from_the_first(crates/engine) saves convert --ai-version 7: radial gradient fill draws as a flat colour in Illustrator 2026 #2687's SVG withfile.saveCopyas a version 7 file and checks the order of both definitions' stops.With the writer's stops reversed for every gradient again, both tests fail at the radial definition.
On Windows 11 (x86-64) with rustc 1.99.0, on top of
mainat bc1ae08:CRAFT_FONTS_DIR=<craft-fonts checkout> cargo xtask cipasses its 10 steps: 8,572 tests passed, 0 failed, 13 ignored.git merge-treereports no conflicts withmainat bc1ae08 or with #2326 and #2672, which also changecrates/eps/src/legacy_ai.rs. #2804 also changes that file, and that file merges cleanly with it.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm).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.Summary by CodeRabbit