Graphite clipping masks do not support SVG luminance masks ?
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- rust
- Área
- computer-graphics
Línea de trabajo
Empieza siguiendo la importación de máscaras SVG a través de usvg::Group::mask(), y después sigue el modo de máscara resuelto hasta el grafo de documentos de Graphite, el renderizador SVG y el renderizador Vello. Usa HameronsDocs/svg-luminance-mask-debug.svg como reproducción. Se considera terminado cuando las máscaras alfa y de luminancia, incluido el caso de luminancia predeterminado, se rendericen de forma coherente y exista cobertura de regresión para ambos renderizadores.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
Graphite’s clipping-mask rendering pipeline treats masks exclusively as alpha masks.
SVG masks can instead use luminance, where the rendered color brightness determines
visibility.
This causes imported luminance masks to render incorrectly even after support for
reading usvg::Group::mask() is implemented.
Dependency
This issue depends on adding SVG mask importing through usvg::Group::mask().
Until that importer support exists, the reproduction also fails because the entire mask
is discarded. Once mask importing is connected, this issue isolates the remaining
alpha-versus-luminance rendering failure.
Reproduction
Import HameronsDocs/svg-luminance-mask-debug.svg.
The fixture contains:
- One solid blue rectangle.
- An explicitly declared
mask-type="luminance". - An opaque white rectangle that reveals the artwork.
- An opaque black circle that creates a transparent hole.
- No gradients, transforms, strokes, clip paths, filters, or fill-rule dependencies.
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128">
<defs>
<mask id="luminance-hole" mask-type="luminance"
maskUnits="userSpaceOnUse" x="0" y="0" width="128" height="128">
<rect width="128" height="128" fill="white" />
<circle cx="64" cy="64" r="32" fill="black" />
</mask>
</defs>
<rect width="128" height="128" fill="#2563eb"
mask="url(#luminance-hole)" />
</svg>
Expected behavior
The SVG imports as a blue square with a transparent circular hole in its center.
Under luminance-mask semantics:
- White produces full visibility.
- Black produces full transparency.
- Gray or colored content produces partial visibility based on luminance and alpha.
Actual behavior
Graphite’s alpha-only mask behavior treats both the white rectangle and black circle as
fully opaque because both have alpha 1.
The resulting artwork is therefore a solid blue square without a transparent hole.
Root cause
The resolved usvg::Mask preserves its semantic mode through usvg::Mask::kind(), which
distinguishes MaskType::Luminance from MaskType::Alpha.
Graphite does not carry that distinction through its document graph or renderers:
- The SVG renderer emits generated masks with mask-type="alpha".
- The Vello renderer composites clipping masks using source alpha through SrcIn.
- Mask colors are therefore ignored when calculating visibility.
- Graphite’s internal MaskType currently distinguishes Clip from Mask, not luminance
from alpha.
Simply importing the SVG mask geometry through the existing clipping-mask mechanism is
insufficient because opaque black and opaque white produce identical alpha values.
Suggested scope
Preserve the resolved SVG mask mode and support luminance-to-alpha conversion
consistently across Graphite’s SVG and Vello renderers.
This should remain separate from the issue that connects usvg::Group::mask() to the
importer because it requires renderer and document-attribute support rather than only
importer wiring.
The SVG specification defines luminance as the initial value for elements, so
masks without an explicit mask-type must also use luminance semantics.
Reference: https://www.w3.org/TR/css-masking-1/#the-mask-type
Acceptance criteria
- The isolated fixture renders as a blue square with a transparent circular hole.
- Explicit mask-type="alpha" masks retain existing alpha behavior.
- Explicit mask-type="luminance" masks use color luminance multiplied by source alpha.
- Masks without mask-type default to luminance.
- Black, white, gray, colored, and partially transparent mask content behave correctly.
- SVG and Vello rendering produce equivalent results.
- SVG output preserves or emits the correct mask type.
- Regression tests cover both alpha and luminance masks.
- Lenguaje dominante
- Rust
- Estrellas
- 27.3k
- Forks
- 1.3k
- Merge medio
- 20 h 1 min
- PR fusionados (30 d)
- 64
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de GraphiteEditor/Graphite
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
GraphiteEditor/Graphite#4396 · 2 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
GraphiteEditor/Graphite#4311 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
GraphiteEditor/Graphite#4275 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
GraphiteEditor/Graphite#3939 · 2 comentarios · 1 reacción ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
GraphiteEditor/Graphite#4572 · 3 comentarios ·
Todos los issues de GraphiteEditor/Graphite
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
state:needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
zed-industries/zed#64680 · 2 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
RustPython/RustPython#8802 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
TheLarkInn/aipm#2390 ·