GraphiteEditor / GraphiteEditor/Graphite

Graphite reads clip_path but ignores usvg::Group::mask()

Open
#4,340 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
27.2k
Forks
1.3k
Avg merge
20h 5m
Merged PRs (30d)
57

Description

## Description

Graphite’s SVG importer reads resolved clip paths from `usvg::Group::clip_path()`, but
it never reads resolved masks from `usvg::Group::mask()`.

When `usvg` parses an element with `mask="url(#mask-id)"`, it places the resolved mask
on a generated `usvg::Group`. Graphite recursively imports that group’s visible
children while silently discarding its mask. Consequently, the unmasked source artwork
is imported.

## Reproduction

Import `HameronsDocs/usvg-group-mask-import-debug.svg`.

The fixture deliberately contains only:

- One solid blue rectangle.
- One circular SVG mask.
- `mask-type="alpha"` to exclude luminance-mask behavior from this issue.
- No gradients, transforms, strokes, clip paths, filters, or fill-rule dependencies.

Image

```svg

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by importing HameronsDocs/usvg-group-mask-import-debug.svg and trace the SVG importer’s handling of usvg::Group::clip_path() alongside usvg::Group::mask(). Done means the circular alpha mask is preserved so the blue rectangle is clipped to the circle rather than importing the unmasked artwork.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.