Skip to content

Ignore masks with a zero width or height - #455

Open
DSeaStar wants to merge 1 commit into
Kozea:mainfrom
DSeaStar:ignore-zero-size-masks
Open

Ignore masks with a zero width or height#455
DSeaStar wants to merge 1 commit into
Kozea:mainfrom
DSeaStar:ignore-zero-size-masks

Conversation

@DSeaStar

Copy link
Copy Markdown

Fixes #440.

A mask whose width or height is 0 made paint_mask build an SVGSurface for an empty canvas, which raises ValueError: The SVG size is undefined. That is what happens with SVGs such as the Wikimedia limpet diagram in the issue: they include unused masks (and similar defs) sized to 0.

draw_pattern already treats a zero-size pattern as a no-op. Do the same for masks, and fall back to painting the group when the mask is skipped so the element is still drawn.

SVGSurface rejects a 0x0 canvas, so a mask whose width or height is 0
raised ValueError instead of being treated as a no-op. Skip those masks
the same way zero-size patterns are already skipped.
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.

Exception "The SVG size is undefined" raised using svg2png

1 participant