Skip to content

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

Description

@NicTanghe

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 xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128">
  <defs>
    <mask id="circle-mask" mask-type="alpha"
      maskUnits="userSpaceOnUse" x="0" y="0" width="128" height="128">
      <circle cx="64" cy="64" r="48" fill="white" />
    </mask>
  </defs>

  <rect width="128" height="128" fill="#2563eb"
    mask="url(#circle-mask)" />
</svg>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions