OLD | NEW |
1 <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> | 1 <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> |
2 <defs> | 2 <defs> |
3 <filter id="satfull"> | 3 <filter id="satfull"> |
4 <feColorMatrix type="saturate" values="1" /> | 4 <feColorMatrix type="saturate" values="1" /> |
5 </filter> | 5 </filter> |
6 | 6 |
| 7 <!-- Display default parameters when values is not present. --> |
7 <filter id="matnull"> | 8 <filter id="matnull"> |
8 <feColorMatrix type="matrix" /> | 9 <feColorMatrix type="matrix" /> |
9 </filter> | 10 </filter> |
10 <filter id="satnull"> | 11 <filter id="satnull"> |
11 <feColorMatrix type="saturate" /> | 12 <feColorMatrix type="saturate" /> |
12 </filter> | 13 </filter> |
13 <filter id="huenull"> | 14 <filter id="huenull"> |
14 <feColorMatrix type="hueRotate" /> | 15 <feColorMatrix type="hueRotate" /> |
15 </filter> | 16 </filter> |
16 | 17 |
17 <filter id="matbad"> | 18 <!-- Display default parameters when there are too many/few values. --> |
18 <feColorMatrix type="matrix" values="1 1 1" /> | 19 <filter id="mattoofew"> |
| 20 <feColorMatrix type="matrix" values="1 0.5 1" /> |
19 </filter> | 21 </filter> |
20 <filter id="satbad"> | 22 <filter id="mattoomany"> |
21 <feColorMatrix type="saturate" values="1 1 1" /> | 23 <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1" /> |
22 </filter> | 24 </filter> |
23 <filter id="huebad"> | 25 <filter id="sattoomany"> |
24 <feColorMatrix type="hueRotate" values="1 1 1" /> | 26 <feColorMatrix type="saturate" values="0.5 1 1" /> |
| 27 </filter> |
| 28 <filter id="huetoomany"> |
| 29 <feColorMatrix type="hueRotate" values="240 1 1" /> |
25 </filter> | 30 </filter> |
26 | 31 |
| 32 <!-- The saturation argument is clamped to [0, 1]. --> |
27 <filter id="satrange"> | 33 <filter id="satrange"> |
28 <feColorMatrix type="saturate" values="1 1" /> | 34 <feColorMatrix type="saturate" values="42" /> |
29 </filter> | 35 </filter> |
| 36 <!-- For type=huerotate, values[0] is an angle and thus have wrapping behavi
or. --> |
30 <filter id="huerange"> | 37 <filter id="huerange"> |
31 <feColorMatrix type="hueRotate" values="720" /> | 38 <feColorMatrix type="hueRotate" values="720" /> |
32 </filter> | 39 </filter> |
| 40 </defs> |
33 | 41 |
34 </defs> | 42 <rect width="300" height="300" fill="red" /> |
35 <g font-size="24" fill="black"> | 43 <rect y="0" width="100" height="100" fill="lime" filter="url(#matnull)"/> |
36 <!-- Backround for tests. Green is success and red is failure --> | 44 <rect y="0" x="100" width="100" height="100" fill="lime" filter="url(#mattoofe
w)"/> |
37 <rect y="0" x="0" width="400" height="400" fill="lime" style="filter:url(#sa
tfull)" /> | 45 <rect y="0" x="200" width="100" height="100" fill="lime" filter="url(#mattooma
ny)"/> |
38 <rect y="2" x="2" width="196" height="396" fill="red" /> | 46 <rect y="100" width="100" height="100" fill="lime" filter="url(#satnull)"/> |
39 | 47 <rect y="100" x="100" width="100" height="100" fill="lime" filter="url(#sattoo
many)"/> |
40 <!-- Display default parameters when values is not present --> | 48 <rect y="100" x="200" width="100" height="100" fill="lime" filter="url(#satran
ge)"/> |
41 <text y="40" x="10" >Should be default</text> | 49 <rect y="200" width="100" height="100" fill="lime" filter="url(#huenull)"/> |
42 <text y="70" x="10" >matrix.</text> | 50 <rect y="200" x="100" width="100" height="100" fill="lime" filter="url(#huetoo
many)"/> |
43 <rect y="0" x="0" width="200" height="104" fill="lime" style="filter:url(#ma
tnull)" /> | 51 <rect y="200" x="200" width="100" height="100" fill="lime" filter="url(#hueran
ge)"/> |
44 <text y="140" x="10" >Should be default</text> | |
45 <text y="170" x="10" >saturate.</text> | |
46 <rect y="100" x="0" width="200" height="104" fill="lime" style="filter:url(#
satnull)" /> | |
47 <text y="240" x="10" >Should be default</text> | |
48 <text y="270" x="10" >hueRotate.</text> | |
49 <rect y="200" x="0" width="200" height="104" fill="lime" style="filter:url(#
huenull)" /> | |
50 <text y="340" x="10">Should be valid</text> | |
51 <text y="370" x="10">hueRotate.</text> | |
52 <rect y="300" x="0" width="200" height="99" fill="lime" style="filter:url(#h
uerange)" /> | |
53 | |
54 <!-- Do not render element if values is invalid --> | |
55 <rect y="2" x="202" width="196" height="96" fill="red" style="filter:url(#ma
tbad)" /> | |
56 <text y="40" x="210" style="filter:url(#matbad)">Invalid matrix</text> | |
57 <text y="70" x="210" style="filter:url(#matbad)">values attribute.</text> | |
58 <rect y="102" x="202" width="196" height="96" fill="red" style="filter:url(#
huebad)" /> | |
59 <text y="140" x="210" style="filter:url(#huebad)">Invalid saturate</text> | |
60 <text y="170" x="210" style="filter:url(#huebad)">values attribute.</text> | |
61 <rect y="202" x="202" width="196" height="96" fill="red" style="filter:url(#
satbad)" /> | |
62 <text y="240" x="210" style="filter:url(#satbad)">Invalid hueRotate</text> | |
63 <text y="270" x="210" style="filter:url(#satbad)">values attribute.</text> | |
64 <rect y="302" x="202" width="196" height="96" fill="red" style="filter:url(#
satrange)" /> | |
65 <text y="340" x="210" style="filter:url(#satrange)">Saturate must </text> | |
66 <text y="370" x="210" style="filter:url(#satrange)">have one value.</text> | |
67 </g> | |
68 </svg> | 52 </svg> |
OLD | NEW |