Proposals/Alpha mask

From SVG
Jump to: navigation, search

This is a proposal for ISSUE-2401. It is often unintuitive that masks use the luminance of each mask pixel and the alpha to compute the actual alpha mask used. This often results in confusion when very simple masks seem like they should work:

  <rect width="100" height="100"/>

Since the luminance of the black rectangle is 0, the mask masks out every pixel completely.

Rather than introducing a new property alpha-mask, as mentioned in the issue, I propose we just add a type="" attribute to <mask> that can take the following values:

  • luminance
  • alpha

where "luminance" (the lacuna value) means do the same thing as the spec currently requires, and "alpha" means to take just the alpha values from the mask image to be the alpha mask.