Repository navigation
.ai import: images, meshes, blends and styled objects keep the knockout shape flag - #5978
Conversation
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
An `Xy` whose shape operand is set now reaches an image (embedded or linked) and a gradient mesh when it is written before the object, and a mesh or blend when it is written after the object's end. A live blend takes the flag from its drawn steps. Before, the reader dropped the flag on these objects, so an image saved with Opacity & Mask Define Knockout Shape lost it on reopening, with no warning. A styled object takes the flag written on its drawn look. For a text object, the flag goes to the object when the look draws only its type, and otherwise to the group that holds the look and the type. An opaque look that draws more than the type and sets the flag now goes into that group as well.
Clipping paths in a compound path that holds a drawn look become one compound path. It took the paths' shared stroke, opacity and blend mode but dropped the knockout shape flag. It now has the flag when every clipping path has it.
5089dc9 to
ccdccb1
Compare
|
Merged, thanks @dotCooCoo! Images, meshes, blends and styled objects now keep the knockout shape flag on |
What and why
Part of #637.
When it opened an
.aifile's editing data, the reader dropped the Opacity & Mask Define Knockout Shape flag on several kinds of object. An image saved with the flag on (embedded or linked) came back without it, and no warning was shown. The same thing happened to gradient meshes, blends, styled objects whose flag is written on their drawn look, text objects with a look, and a compound path made of several clipping paths.The writer writes the flag as the
shapeoperand ofXy(crates/eps/src/ai_editing/writer.rs:75), set before an image atcrates/eps/src/ai_editing/writer/images.rs:118. The reader now keeps that operand:Xywritten before it.Xywritten right after its end. When thatXyis the layer's, the reader puts the object's own flag back, as it already did for opacity and blend mode. A live blend takes the flag from its drawn steps.Changes in how existing files open: images, meshes, blends, styled objects and these compound clipping paths that carry the flag now keep it, so inside a knockout group they knock out by their shape instead of by their opacity. An opaque text look that draws more than the type and sets the flag now goes into a group with the type, which holds the flag.
How it was tested
New tests in
vectorcraft-eps:ai_editing::tests::an_images_knockout_shape_comes_back: an embedded and a linked image with the flag are written and read back with it; the image between them and the layer do not take it.import::ai::tests::a_gradient_mesh_keeps_its_knockout_shape: anXybefore a mesh and after its end, as one mesh and as a group of patches, and anXythat is the layer's.import::ai::tests::a_blend_keeps_its_knockout_shape: a live blend, its drawn steps, anXybefore the record, and anXythat is the layer's.import::ai::tests::a_text_objects_look_gives_it_the_knockout_shape: a look that draws only the type, and a look that draws more, transparent and opaque.import::ai::tests::the_compound_of_clipping_paths_keeps_their_knockout_shape: the flag on every clipping path, on none, on one only, and with opacities that differ.import::ai::tests::a_styled_object_keeps_the_transparency_written_on_its_looknow also checks the flag.Each new test fails on
mainat36ef34dfdd.Commands run on
5089dc91eb:cargo fmt --all -- --checkcargo clippy -p vectorcraft-eps --all-targets -- -D warningscargo test -p vectorcraft-eps: 983 tests, 0 failedcargo test -p vectorcraft-engine --lib -- ai: 478 tests, 0 failedcargo test -p vectorcraft-engine --test import_fuzz: 190 tests, 0 failedcargo xtask brands,cargo xtask layers(28 crates),cargo xtask assets(334 files)cargo xtask cipassed in this pull request's CI run on5089dc91eb: https://github.com/storytold/vectorcraft/actions/runs/42295756949/job/128160427908Checklist
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