Repository navigation
M3: Flatten Transparency engine (M3.91) - #35
Merged
Merged
Conversation
…e art that looks the same
object.flattenTransparency {preset?|options, ids?} splits the targets into groups of overlapping
objects. Groups with transparency become atomic regions (faces of the arrangement of every fill,
outlined stroke and clipping path) filled with the colour the renderer composites there: blend
modes, group opacity, isolated and non-isolated groups, knockout groups and knockout shapes, over
white or (Preserve Alpha) over nothing. Regions reached by gradients, patterns, images, opacity
masks or raster effects are rendered into one image per group, under the regions, clipped to
them with Clip Complex Regions. The raster/vector balance rasterizes whole groups past its region
budget (all at 0). Options and presets live in FlattenOptions; single visible paints keep their
colour and overprint; text and strokes can be outlined everywhere. One undo step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 4, 2026
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.
Part of M3 (Paint & appearance). The Flatten Transparency engine: transparent art becomes opaque art that looks the same, as Illustrator's Object ▸ Flatten Transparency does. The dialog, presets manager and Flattener Preview panel come in the next PR.
object.flattenTransparency {preset?, …options, options?, ids?} → {ids, rasterized, vector, options}.cmd/flatten.rsfollows the renderer's model: isolated and non-isolated groups, knockout and knockout shape, clip groups, all throughcolor::blend::composite.preserveAlpha.clipComplexRegions.preserveOverprints: false.FlattenOptionswith built-in presetshigh,medium(default) andlow. One undo step.docs/mcp.mdhas a "Flatten Transparency" section.Known limits:
Checks
Rebased onto
cc51495(#32).cargo xtask cipasses all 7 steps (fmt, clippy, test, assets, brands, layers, wasm): 1,588 tests, 0 failed.tests_flatten.rshas 12 tests:🤖 Generated with Claude Code