| 1 |
<svg version="1.1" baseProfile="basic" id="svg-root" |
| 2 |
width="100%" height="100%" viewBox="0 0 480 360" |
| 3 |
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 4 |
<!--======================================================================--> |
| 5 |
<!--= SVG 1.1 2nd Edition Test Case =--> |
| 6 |
<!--======================================================================--> |
| 7 |
<!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =--> |
| 8 |
<!--= Institute of Technology, European Research Consortium for =--> |
| 9 |
<!--= Informatics and Mathematics (ERCIM), Keio University). =--> |
| 10 |
<!--= All Rights Reserved. =--> |
| 11 |
<!--= See http://www.w3.org/Consortium/Legal/. =--> |
| 12 |
<!--======================================================================--> |
| 13 |
<d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/" |
| 14 |
template-version="1.4" reviewer="SVGWG" author="Haroon Sheikh" status="accepted" |
| 15 |
version="$Revision: 1.8 $" testname="$RCSfile: masking-mask-01-b.svg,v $"> |
| 16 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/masking.html#Masking"> |
| 17 |
<p> |
| 18 |
Test to see if the masking features using the mask element and mask |
| 19 |
property are available. |
| 20 |
</p> |
| 21 |
<p> |
| 22 |
A red rectangle is displayed in the background to help view the result |
| 23 |
of transparency and masking. |
| 24 |
</p> |
| 25 |
<p> |
| 26 |
From top to bottom, the tests are as follows. |
| 27 |
</p> |
| 28 |
<p> |
| 29 |
In the top test, a linear gradient is used inside the mask to change the opacity |
| 30 |
of the rectangle from 1.0 (at the top) to 0.5 (at the bottom). |
| 31 |
</p> |
| 32 |
<p> |
| 33 |
In the second test, a simple 50% opaque rectangle is used as a mask. |
| 34 |
</p> |
| 35 |
<p> |
| 36 |
In the third test, no mask is used, but a rectangle is shown with 50% opacity. |
| 37 |
The second and third test should look the same. |
| 38 |
</p> |
| 39 |
<p> |
| 40 |
Lastly, a string of text has a mask applied to it. The mask only covers a partial |
| 41 |
area of the text, so the text should only be half visible. Also the mask consists |
| 42 |
of 4 rectangles with various levels of opacity. |
| 43 |
</p> |
| 44 |
</d:testDescription> |
| 45 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 46 |
<p> |
| 47 |
Run the test. No interaction required. |
| 48 |
</p> |
| 49 |
</d:operatorScript> |
| 50 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 51 |
<p> |
| 52 |
The rendered picture should match the reference image, except |
| 53 |
variations are possible in the labelling text (per CSS2 rules). |
| 54 |
</p> |
| 55 |
</d:passCriteria> |
| 56 |
</d:SVGTestCase> |
| 57 |
<title id="test-title">$RCSfile: masking-mask-01-b.svg,v $</title> |
| 58 |
<defs> |
| 59 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 60 |
<font-face-src> |
| 61 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 62 |
</font-face-src> |
| 63 |
</font-face> |
| 64 |
</defs> |
| 65 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 66 |
<style type="text/css"> |
| 67 |
@font-face { |
| 68 |
font-family: larabie-anglepoise; |
| 69 |
src: url(woffs/anglepoi.woff) format("woff"); |
| 70 |
} |
| 71 |
</style> |
| 72 |
<defs> |
| 73 |
<font horiz-adv-x="313"> |
| 74 |
<!-- Converted from Larabie Anglepoise by Batik ttf2svg --> |
| 75 |
<font-face font-family="larabie-anglepoise" units-per-em="1000" panose-1="0 0 4 0 0 0 0 0 0 0" ascent="703" descent="-300" alphabetic="0"/> |
| 76 |
<missing-glyph horiz-adv-x="500" d="M63 0V700H438V0H63ZM125 63H375V638H125V63Z"/> |
| 77 |
<glyph unicode="S" glyph-name="S" horiz-adv-x="385" d="M371 1H29V144H264Q264 151 264 166Q265 180 265 188Q265 212 249 212H132Q83 212 55 247Q29 279 29 329V566H335V422H136V375Q136 360 144 356Q148 355 168 355H279Q327 355 352 309Q371 273 371 221V1Z"/> |
| 78 |
<glyph unicode="V" glyph-name="V" horiz-adv-x="351" d="M365 563L183 -33L0 563H101L183 296L270 563H365Z"/> |
| 79 |
<glyph unicode="G" glyph-name="G" horiz-adv-x="367" d="M355 1H18V564H355V420H125V144H248V211H156V355H355V1Z"/> |
| 80 |
<hkern g1="V" g2="G" k="-40"/> |
| 81 |
</font> |
| 82 |
</defs> |
| 83 |
<g font-family="SVGFreeSansASCII,sans-serif"> |
| 84 |
<text font-size="14" x="10" y="20">Test for mask support</text> |
| 85 |
<!-- Draw a red rectangle in the background --> |
| 86 |
<rect x="10" y="30" width="100" height="260" fill="red"/> |
| 87 |
<!-- Apply a gradient ramp based opacity --> |
| 88 |
<mask id="mask1" maskUnits="userSpaceOnUse" x="60" y="50" width="100" height="60" color-interpolation="linearRGB"> |
| 89 |
<defs> |
| 90 |
<linearGradient gradientUnits="userSpaceOnUse" id="Grad1" x1="60" y1="50" x2="60" y2="120"> |
| 91 |
<stop stop-color="white" stop-opacity="1" offset="0"/> |
| 92 |
<stop stop-color="white" stop-opacity="0.5" offset="1"/> |
| 93 |
</linearGradient> |
| 94 |
</defs> |
| 95 |
<rect x="60" y="50" width="100" height="60" fill="url(#Grad1)"/> |
| 96 |
</mask> |
| 97 |
<rect x="60" y="50" width="100" height="60" fill="lime" mask="url(#mask1)"/> |
| 98 |
<text font-size="12" x="200" y="65">Mask with linear gradient from</text> |
| 99 |
<text font-size="12" x="200" y="80">opacity=1 to opactity=0.5</text> |
| 100 |
<!-- Simulate a uniform opacity using a mask --> |
| 101 |
<mask id="mask2" maskUnits="userSpaceOnUse" x="60" y="120" width="100" height="30" color-interpolation="linearRGB"> |
| 102 |
<rect x="60" y="120" width="100" height="30" fill-opacity="0.5" fill="white"/> |
| 103 |
</mask> |
| 104 |
<rect x="60" y="120" width="100" height="30" fill="lime" mask="url(#mask2)"/> |
| 105 |
<text font-size="12" x="200" y="135">Mask with uniform opacity of 0.5</text> |
| 106 |
<!-- Apply a uniform opacity --> |
| 107 |
<rect x="60" y="160" width="100" height="30" fill="lime" fill-opacity="0.5"/> |
| 108 |
<text font-size="12" x="200" y="175">Rectangle with uniform opacity of 0.5</text> |
| 109 |
<!-- Apply a mask to text --> |
| 110 |
<mask id="mask3" maskUnits="userSpaceOnUse" x="60" y="200" width="200" height="100" color-interpolation="linearRGB"> |
| 111 |
<rect x="60" y="200" width="200" height="25" fill="white" fill-opacity="0.5"/> |
| 112 |
<rect x="60" y="225" width="200" height="25" fill="white" fill-opacity="0.2"/> |
| 113 |
<rect x="60" y="250" width="200" height="25" fill="white" fill-opacity="1"/> |
| 114 |
<rect x="60" y="275" width="200" height="25" fill="white" fill-opacity="0.7"/> |
| 115 |
</mask> |
| 116 |
<text x="60" y="280" font-family="anglepoise" font-size="110" fill="lime" mask="url(#mask3)">SVG</text> |
| 117 |
<text font-size="12" x="200" y="225">Text with mask containing rectangles</text> |
| 118 |
<text font-size="12" x="200" y="240">of various opacities</text> |
| 119 |
</g> |
| 120 |
</g> |
| 121 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 122 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.8 $</text> |
| 123 |
</g> |
| 124 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> |
| 125 |
<!-- comment out this watermark once the test is approved --> |
| 126 |
<!--<g id="draft-watermark"> |
| 127 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 128 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 129 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 130 |
</g>--> |
| 131 |
</svg> |