Debian Codegraph @

test_non_regression/svg/mask01.svg

raw
1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
3 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4 <svg width="8cm" height="3cm" viewBox="0 0 800 300" version="1.1"
5 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
6 <desc>Example mask01 - blue text masked with gradient against red background
7 </desc>
8 <defs>
9 <linearGradient id="Gradient" gradientUnits="userSpaceOnUse"
10 x1="0" y1="0" x2="800" y2="0">
11 <stop offset="0" stop-color="white" stop-opacity="0" />
12 <stop offset="1" stop-color="white" stop-opacity="1" />
13 </linearGradient>
14 <mask id="Mask" maskUnits="userSpaceOnUse"
15 x="0" y="0" width="800" height="300">
16 <rect x="0" y="0" width="800" height="300" fill="url(#Gradient)" />
17 </mask>
18 <text id="Text" x="400" y="200"
19 font-family="Liberation Sans" font-size="100" text-anchor="middle" >
20 Masked text
21 </text>
22 </defs>
23
24 <!-- Draw a pale red rectangle in the background -->
25 <rect x="0" y="0" width="800" height="300" fill="#FF8080" />
26
27 <!-- Draw the text string twice. First, filled blue, with the mask applied.
28 Second, outlined in black without the mask. -->
29 <use xlink:href="#Text" fill="blue" mask="url(#Mask)" />
30 <use xlink:href="#Text" fill="none" stroke="black" stroke-width="2" />
31 </svg>
32