mask

  • Revision slug: SVG/Element/mask
  • Revision title: mask
  • Revision id: 91597
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

{{ SVGRefElem() }}

In SVG, you can specify that any other graphics object or {{ SVGElement("g") }} element can be used as an alpha mask for compositing the current object into the background. A mask is defined with the mask element. A mask is used/referenced using the mask property.

Usage context

Categories Container element
Permitted content Any number of the following elements, in any order:
Animation elements »
Descriptive elements »
Shape elements »
Structural elements »
Gradient elements »
{{ SVGElement("a") }}, {{ SVGElement("altGlyphDef") }}, {{ SVGElement("clipPath") }}, {{ SVGElement("color-profile") }}, {{ SVGElement("cursor") }}, {{ SVGElement("filter") }}, {{ SVGElement("font") }}, {{ SVGElement("font-face") }}, {{ SVGElement("foreignObject") }}, {{ SVGElement("image") }}, {{ SVGElement("marker") }}, {{ SVGElement("mask") }}, {{ SVGElement("pattern") }}, {{ SVGElement("script") }}, {{ SVGElement("style") }}, {{ SVGElement("switch") }}, {{ SVGElement("text") }}, {{ SVGElement("view") }}
Normative document SVG 1.1 (2nd Edition)

Example

Source code Output result
{{ embed_text("mask.svg", "xml") }} {{ EmbedSVG("mask.svg",200,80) }}

Attributes

Global attributes

Specific attributes

  • {{ SVGAttr("maskUnits") }}
  • {{ SVGAttr("maskContentUnits") }}
  • {{ SVGAttr("x") }}
  • {{ SVGAttr("y") }}
  • {{ SVGAttr("width") }}
  • {{ SVGAttr("height") }}

DOM Interface

This element implements the SVGMaskElement interface.

Related

  • {{ SVGElement("clipPath") }}

Revision Source

<p>{{ SVGRefElem() }}</p>
<p>In SVG, you can specify that any other graphics object or {{ SVGElement("g") }} element can be used as an alpha mask for compositing the current object into the background. A mask is defined with the <code>mask</code> element. A mask is used/referenced using the <code>mask</code> property.</p>
<h2>Usage context</h2>
<table class="standard-table"> <tbody> <tr> <th scope="row">Categories</th> <td>Container element</td> </tr> <tr> <th scope="row">Permitted content</th> <td>Any number of the following elements, in any order:<br> <a href="/en/SVG/Element#Animation" title="en/SVG/Attribute#Animation">Animation elements</a> »<br> <a href="/en/SVG/Element#Descriptive" title="en/SVG/Attribute#Descriptive">Descriptive elements</a> »<br> <a href="/en/SVG/Element#Shape" title="en/SVG/Attribute#Shape">Shape elements</a> »<br> <a href="/en/SVG/Element#Structural" title="en/SVG/Attribute#Structural">Structural elements</a> »<br> <a href="/en/SVG/Element#Gradient" title="en/SVG/Attribute#Gradient">Gradient elements</a> »<br> {{ SVGElement("a") }}, {{ SVGElement("altGlyphDef") }}, {{ SVGElement("clipPath") }}, {{ SVGElement("color-profile") }}, {{ SVGElement("cursor") }}, {{ SVGElement("filter") }}, {{ SVGElement("font") }}, {{ SVGElement("font-face") }}, {{ SVGElement("foreignObject") }}, {{ SVGElement("image") }}, {{ SVGElement("marker") }}, {{ SVGElement("mask") }}, {{ SVGElement("pattern") }}, {{ SVGElement("script") }}, {{ SVGElement("style") }}, {{ SVGElement("switch") }}, {{ SVGElement("text") }}, {{ SVGElement("view") }}</td> </tr> <tr> <th scope="row">Normative document</th> <td><a class="external" href="http://www.w3.org/TR/SVG/masking.html#Masking" title="http://www.w3.org/TR/SVG/masking.html#Masking">SVG 1.1 (2nd Edition)</a></td> </tr> </tbody>
</table><h2>Example</h2>
<table class="standard-table"> <tbody> <tr> <th scope="col">Source code</th> <th scope="col">Output result</th> </tr> <tr> <td>{{ embed_text("mask.svg", "xml") }}</td> <td>{{ EmbedSVG("mask.svg",200,80) }}</td> </tr> </tbody>
</table>
<h2>Attributes</h2>
<h3>Global attributes</h3>
<ul> <li><a href="/en/SVG/Attribute#ConditionalProccessing" title="en/SVG/Attribute#ConditionalProccessing">Conditional processing attributes</a> »</li> <li><a href="/en/SVG/Attribute#Core" title="en/SVG/Attribute#Core">Core attributes</a> »</li> <li><a href="/en/SVG/Attribute#Presentation" title="en/SVG/Attribute#Presentation">Presentation attributes</a> »</li> <li>{{ SVGAttr("class") }}</li> <li>{{ SVGAttr("style") }}</li> <li>{{ SVGAttr("externalResourcesRequired") }}</li>
</ul>
<h3>Specific attributes</h3>
<ul> <li>{{ SVGAttr("maskUnits") }}</li> <li>{{ SVGAttr("maskContentUnits") }}</li> <li>{{ SVGAttr("x") }}</li> <li>{{ SVGAttr("y") }}</li> <li>{{ SVGAttr("width") }}</li> <li>{{ SVGAttr("height") }}</li>
</ul><h2>DOM Interface</h2>
<p>This element implements the <code><a href="/en/DOM/SVGMaskElement" title="en/DOM/SVGMaskElement">SVGMaskElement</a></code> interface.</p>
<h2>Related</h2>
<ul> <li>{{ SVGElement("clipPath") }}</li>
</ul>
Revert to this revision