Repository navigation
Preserve mask definition nodes during painting - #457
Open
AfonsoZhang wants to merge 1 commit into
Open
AfonsoZhang wants to merge 1 commit into
AfonsoZhang wants to merge 1 commit into
Conversation
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.
A
<mask>declared after the element that references it can be painted as ordinary content, covering the intended image. For example, this SVG should be red but currently renders white:parse_all_defsstores the original node.paint_maskthen changes that shared node's tag togand replaces its geometry while preparing the mask surface. If normal document traversal reaches the definition afterwards, it no longer recognizes an invisiblemaskand draws its children. This was encountered when converting D2-generated SVG, but the reproducer does not depend on D2.Copy the mask node before changing its tag and attributes. Add pixel-level regression tests for a mask before the reference, after the reference, and inside
defs. The all-white mask avoids conflating this issue with alpha-versus-luminance support (#149).Validation against main
3b7a250c9e955db9c3cdf525d5b5027a9a396201:after), 2 passed.flake8andisort --checkpassed for both changed files.SVG 1.1 specifies that mask definitions do not render directly: https://www.w3.org/TR/SVG11/masking.html#MaskElement