You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The effect of applying a mask is as if the mask images or <i>mask sources</i> are rendered into an off-screen image which has been initialized to transparent black. The graphical object to which the mask is applied will be painted onto the background through the mask, thus completely or partially masking out parts of the graphical object.
58
+
The effect of applying a mask to a graphical object is as if the graphical object to which the mask is applied will be painted onto the background through the mask, thus completely or partially masking out parts of the graphical object.
55
59
56
60
Masks are applied using the 'mask-image' or 'mask-box-image-source' properties.
57
61
58
-
The 'mask-image' property may reference a <a>'mask element'</a>as the mask source. Alternatively, for many simple uses, the 'mask-image' property may refer directly to images to be used as mask, forgoing the need for an explicit <a>'mask element'</a> element. The 'mask' property serves as a shorthand property for 'mask-box-image', 'mask-image' and other characterizing properties.
62
+
The 'mask-image' property may reference a <a>'mask'</a> element. In this case the content of the <a>'mask'</a>element is rendered into an off-screen image which has been initialized to transparent black. This off-screen image is taken as mask image. Alternatively, for many simple uses, the 'mask-image' property may refer directly to images to be used as mask image, forgoing the need for an explicit <a>'mask'</a> element. The 'mask' property serves as a shorthand property for 'mask-box-image', 'mask-image' and other characterizing properties.
59
63
60
64
The 'mask-box-image-source' property splits a mask image into 9 pieces. The pieces may be sliced, scaled and stretched in various ways to fit the size of the <i>mask box image area</i>. The 'mask-box-image' property serves as a shorthand property for 'mask-box-image-source' and other characterizing properties.
If the element does not have an associated CSS layout box and is in the <code>http://www.w3.org/2000/svg</code> namespace, the current user coordinate system has its origin at the top-left corner of the element's nearest viewport.
97
101
</p>
98
102
</dd>
99
-
<dt><dfn>mask source</dfn></dt>
100
-
<dd>
101
-
An off-screen image which has been initialized to transparent black. The graphical object to which the mask is applied will be painted onto the background through the mask, thus completely or partially masking out parts of the graphical object.
102
-
</dd>
103
103
</dl>
104
104
105
105
Definitions of CSS properties and values in this specification are analogous to definitions in CSS Backgrounds and Borders [[!CSS3BG]]. To avoid redundancy, this specification relies on descriptions and definitions of CSS Backgrounds and Borders. The following terms in CSS Backgrounds and Borders have the following meaning in this specification:
A mask reference that is an empty image (zero width or zero height), that fails to download, is not a reference to an <a>'mask element'</a> element, is non-existent, or that cannot be displayed (e.g. because it is not in a supported image format) is ignored. It still counts as an image layer but does not mask the element.
398
398
399
-
See the section <ahref="#MaskValues">“Mask source values”</a> for how to process a <<mask-source>>.
399
+
See the section <ahref="#MaskValues">“Mask processing”</a> for how to process a mask image.
The 'mask-source-type' property indicates whether the <<mask-reference>> is treated as luminance mask or alpha mask. (See <ahref="#MaskValues">Mask Source values</a>.)
424
+
The 'mask-source-type' property indicates whether the <<mask-reference>> is treated as luminance mask or alpha mask. (See <ahref="#MaskValues">Mask processing</a>.)
If one <<box>> value is present then it sets both 'mask-origin' and 'mask-clip' to that value. If two <<box>> values are present, then the first sets 'mask-origin' and the second 'mask-clip'.
644
644
645
-
The <i>used value</i> of the properties 'mask-image', 'mask-repeat', 'mask-position', 'mask-clip', 'mask-origin' and 'mask-size' must have no effect if <<mask-reference>> references a <a>'mask element'</a> element. In this case the element defines position, sizing and clipping of the <i>mask source</i>.
645
+
The <i>used value</i> of the properties 'mask-image', 'mask-repeat', 'mask-position', 'mask-clip', 'mask-origin' and 'mask-size' must have no effect if <<mask-reference>> references a <a>'mask element'</a> element. In this case the element defines position, sizing and clipping of the mask image.
646
646
647
647
The 'mask' shorthand also resets 'mask-box-image' to its initial value. It is therefore recommended that authors use the 'mask' shorthand, rather than other shorthands or the individual properties, to override any mask settings earlier in the cascade. This will ensure that 'mask-box-image' has also been reset to allow the new styles to take effect.
The 'mask-image' property has no effect on the geometry or hit-testing of any element's CSS boxes.
656
656
657
-
<h4id="MaskValues">Mask Source values</h4>
657
+
<h4id="MaskValues">Mask processing</h4>
658
658
659
-
A mask may be interpreted using one of two different methods with regards to calculating the mask values that will be multiplied with the target alpha values.
659
+
A mask image may be interpreted using one of two different methods with regards to calculating the mask values that will be multiplied with the target alpha values.
660
660
661
-
The first and simplest method of calculating the mask values is to use the alpha channel of the mask source. In this case the mask value at a given point is simply the value of the alpha channel at that point. The color channels do not contribute to the mask value.
661
+
The first and simplest method of calculating the mask values is to use the alpha channel of the mask image. In this case the mask value at a given point is simply the value of the alpha channel at that point. The color channels do not contribute to the mask value.
662
662
663
-
The second method of calculating the mask values is to use the luminance of the mask source. In this case the mask value at a given point is computed from the color channel values and alpha channel value using the following procedure.
663
+
The second method of calculating the mask values is to use the luminance of the mask image. In this case the mask value at a given point is computed from the color channel values and alpha channel value using the following procedure.
664
664
665
665
<ol>
666
666
<li>Compute a luminance value from the color channel values.
<p>In the next example the computed value of 'mask-source-type' is <avaluefor=mask-source-type>alpha</a> and overrides the preference on the <a>'mask element'</a> element that is computed to <avaluefor=mask-type>luminance</a>. The mask source is used as an alpha mask.
840
+
<p>In the next example the computed value of 'mask-source-type' is <avaluefor=mask-source-type>alpha</a> and overrides the preference on the <a>'mask element'</a> element that is computed to <avaluefor=mask-type>luminance</a>. The mask image is used as an alpha mask.
An image that is an empty image (zero width or zero height), that fails to download, is non-existent, or that cannot be displayed (e.g. because it is not in a supported image format) is ignored. It still counts as an mask image but does not mask the element.
909
909
@@ -1158,7 +1158,7 @@ <h2 class="no-num" id="changes">Changes since last publication</h2>
<li>Initial values for 'mask-repeat', 'mask-position' and 'mask-origin' changed to ''no-repeat'', ''center'' and <avaluefor=mask-origin>border-box</a>.</li>
1161
-
<li>Multiple layers of <i>mask sources</i> were deferred to a future level of this specification.</li>
1161
+
<li>Multiple layers of mask images were deferred to a future level of this specification.</li>
1162
1162
<li>Added security model for pixel operations and fetching of masking and clipping resources.</li>
1163
1163
<li>Deferred ''child'' and select() function to next level.</li>
0 commit comments