Debian Codegraph @

test_non_regression/fail/filter/feComposite.svg

raw
1 <?xml version="1.0"?>
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="330" height="195" viewBox="0 0 1100 650" version="1.1"
5 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
6 <title>Example feComposite - Examples of feComposite operations</title>
7 <desc>Four rows of six pairs of overlapping triangles depicting
8 the six different feComposite operators under different
9 opacity values and different clearing of the background.</desc>
10 <defs>
11 <desc>Define two sets of six filters for each of the six compositing operators.
12 The first set wipes out the background image by flooding with opaque white.
13 The second set does not wipe out the background, with the result
14 that the background sometimes shines through and is other cases
15 is blended into itself (i.e., "double-counting").</desc>
16 <filter id="overFlood" filterUnits="objectBoundingBox" x="-5%" y="-5%" width="110%" height="110%">
17 <feFlood flood-color="#ffffff" flood-opacity="1" result="flood"/>
18 <feComposite in="SourceGraphic" in2="BackgroundImage" operator="over" result="comp"/>
19 <feMerge> <feMergeNode in="flood"/> <feMergeNode in="comp"/> </feMerge>
20 </filter>
21 <filter id="inFlood" filterUnits="objectBoundingBox" x="-5%" y="-5%" width="110%" height="110%">
22 <feFlood flood-color="#ffffff" flood-opacity="1" result="flood"/>
23 <feComposite in="SourceGraphic" in2="BackgroundImage" operator="in" result="comp"/>
24 <feMerge> <feMergeNode in="flood"/> <feMergeNode in="comp"/> </feMerge>
25 </filter>
26 <filter id="outFlood" filterUnits="objectBoundingBox" x="-5%" y="-5%" width="110%" height="110%">
27 <feFlood flood-color="#ffffff" flood-opacity="1" result="flood"/>
28 <feComposite in="SourceGraphic" in2="BackgroundImage" operator="out" result="comp"/>
29 <feMerge> <feMergeNode in="flood"/> <feMergeNode in="comp"/> </feMerge>
30 </filter>
31 <filter id="atopFlood" filterUnits="objectBoundingBox" x="-5%" y="-5%" width="110%" height="110%">
32 <feFlood flood-color="#ffffff" flood-opacity="1" result="flood"/>
33 <feComposite in="SourceGraphic" in2="BackgroundImage" operator="atop" result="comp"/>
34 <feMerge> <feMergeNode in="flood"/> <feMergeNode in="comp"/> </feMerge>
35 </filter>
36 <filter id="xorFlood" filterUnits="objectBoundingBox" x="-5%" y="-5%" width="110%" height="110%">
37 <feFlood flood-color="#ffffff" flood-opacity="1" result="flood"/>
38 <feComposite in="SourceGraphic" in2="BackgroundImage" operator="xor" result="comp"/>
39 <feMerge> <feMergeNode in="flood"/> <feMergeNode in="comp"/> </feMerge>
40 </filter>
41 <filter id="arithmeticFlood" filterUnits="objectBoundingBox"
42 x="-5%" y="-5%" width="110%" height="110%">
43 <feFlood flood-color="#ffffff" flood-opacity="1" result="flood"/>
44 <feComposite in="SourceGraphic" in2="BackgroundImage" result="comp"
45 operator="arithmetic" k1=".5" k2=".5" k3=".5" k4=".5"/>
46 <feMerge> <feMergeNode in="flood"/> <feMergeNode in="comp"/> </feMerge>
47 </filter>
48 <filter id="overNoFlood" filterUnits="objectBoundingBox" x="-5%" y="-5%" width="110%" height="110%">
49 <feComposite in="SourceGraphic" in2="BackgroundImage" operator="over" result="comp"/>
50 </filter>
51 <filter id="inNoFlood" filterUnits="objectBoundingBox" x="-5%" y="-5%" width="110%" height="110%">
52 <feComposite in="SourceGraphic" in2="BackgroundImage" operator="in" result="comp"/>
53 </filter>
54 <filter id="outNoFlood" filterUnits="objectBoundingBox" x="-5%" y="-5%" width="110%" height="110%">
55 <feComposite in="SourceGraphic" in2="BackgroundImage" operator="out" result="comp"/>
56 </filter>
57 <filter id="atopNoFlood" filterUnits="objectBoundingBox" x="-5%" y="-5%" width="110%" height="110%">
58 <feComposite in="SourceGraphic" in2="BackgroundImage" operator="atop" result="comp"/>
59 </filter>
60 <filter id="xorNoFlood" filterUnits="objectBoundingBox" x="-5%" y="-5%" width="110%" height="110%">
61 <feComposite in="SourceGraphic" in2="BackgroundImage" operator="xor" result="comp"/>
62 </filter>
63 <filter id="arithmeticNoFlood" filterUnits="objectBoundingBox"
64 x="-5%" y="-5%" width="110%" height="110%">
65 <feComposite in="SourceGraphic" in2="BackgroundImage" result="comp"
66 operator="arithmetic" k1=".5" k2=".5" k3=".5" k4=".5"/>
67 </filter>
68 <path id="Blue100" d="M 0 0 L 100 0 L 100 100 z" fill="#00ffff" />
69 <path id="Red100" d="M 0 0 L 0 100 L 100 0 z" fill="#ff00ff" />
70 <path id="Blue50" d="M 0 125 L 100 125 L 100 225 z" fill="#00ffff" fill-opacity=".5" />
71 <path id="Red50" d="M 0 125 L 0 225 L 100 125 z" fill="#ff00ff" fill-opacity=".5" />
72 <g id="TwoBlueTriangles">
73 <use xlink:href="#Blue100"/>
74 <use xlink:href="#Blue50"/>
75 </g>
76 <g id="BlueTriangles">
77 <use transform="translate(275,25)" xlink:href="#TwoBlueTriangles"/>
78 <use transform="translate(400,25)" xlink:href="#TwoBlueTriangles"/>
79 <use transform="translate(525,25)" xlink:href="#TwoBlueTriangles"/>
80 <use transform="translate(650,25)" xlink:href="#TwoBlueTriangles"/>
81 <use transform="translate(775,25)" xlink:href="#TwoBlueTriangles"/>
82 <use transform="translate(900,25)" xlink:href="#TwoBlueTriangles"/>
83 </g>
84 </defs>
85
86 <rect fill="none" stroke="blue" x="1" y="1" width="1098" height="648"/>
87 <g font-family="Verdana" font-size="40" shape-rendering="crispEdges">
88 <desc>Render the examples using the filters that draw on top of
89 an opaque white surface, thus obliterating the background.</desc>
90 <g enable-background="new">
91 <text x="15" y="75">opacity 1.0</text>
92 <text x="15" y="115" font-size="27">(with feFlood)</text>
93 <text x="15" y="200">opacity 0.5</text>
94 <text x="15" y="240" font-size="27">(with feFlood)</text>
95 <use xlink:href="#BlueTriangles"/>
96 <g transform="translate(275,25)">
97 <use xlink:href="#Red100" filter="url(#overFlood)" />
98 <use xlink:href="#Red50" filter="url(#overFlood)" />
99 <text x="5" y="275">over</text>
100 </g>
101 <g transform="translate(400,25)">
102 <use xlink:href="#Red100" filter="url(#inFlood)" />
103 <use xlink:href="#Red50" filter="url(#inFlood)" />
104 <text x="35" y="275">in</text>
105 </g>
106 <g transform="translate(525,25)">
107 <use xlink:href="#Red100" filter="url(#outFlood)" />
108 <use xlink:href="#Red50" filter="url(#outFlood)" />
109 <text x="15" y="275">out</text>
110 </g>
111 <g transform="translate(650,25)">
112 <use xlink:href="#Red100" filter="url(#atopFlood)" />
113 <use xlink:href="#Red50" filter="url(#atopFlood)" />
114 <text x="10" y="275">atop</text>
115 </g>
116 <g transform="translate(775,25)">
117 <use xlink:href="#Red100" filter="url(#xorFlood)" />
118 <use xlink:href="#Red50" filter="url(#xorFlood)" />
119 <text x="15" y="275">xor</text>
120 </g>
121 <g transform="translate(900,25)">
122 <use xlink:href="#Red100" filter="url(#arithmeticFlood)" />
123 <use xlink:href="#Red50" filter="url(#arithmeticFlood)" />
124 <text x="-25" y="275">arithmetic</text>
125 </g>
126 </g>
127 <g transform="translate(0,325)" enable-background="new">
128 <desc>Render the examples using the filters that do not obliterate
129 the background, thus sometimes causing the background to continue
130 to appear in some cases, and in other cases the background
131 image blends into itself ("double-counting").</desc>
132 <text x="15" y="75">opacity 1.0</text>
133 <text x="15" y="115" font-size="27">(without feFlood)</text>
134 <text x="15" y="200">opacity 0.5</text>
135 <text x="15" y="240" font-size="27">(without feFlood)</text>
136 <use xlink:href="#BlueTriangles"/>
137 <g transform="translate(275,25)">
138 <use xlink:href="#Red100" filter="url(#overNoFlood)" />
139 <use xlink:href="#Red50" filter="url(#overNoFlood)" />
140 <text x="5" y="275">over</text>
141 </g>
142 <g transform="translate(400,25)">
143 <use xlink:href="#Red100" filter="url(#inNoFlood)" />
144 <use xlink:href="#Red50" filter="url(#inNoFlood)" />
145 <text x="35" y="275">in</text>
146 </g>
147 <g transform="translate(525,25)">
148 <use xlink:href="#Red100" filter="url(#outNoFlood)" />
149 <use xlink:href="#Red50" filter="url(#outNoFlood)" />
150 <text x="15" y="275">out</text>
151 </g>
152 <g transform="translate(650,25)">
153 <use xlink:href="#Red100" filter="url(#atopNoFlood)" />
154 <use xlink:href="#Red50" filter="url(#atopNoFlood)" />
155 <text x="10" y="275">atop</text>
156 </g>
157 <g transform="translate(775,25)">
158 <use xlink:href="#Red100" filter="url(#xorNoFlood)" />
159 <use xlink:href="#Red50" filter="url(#xorNoFlood)" />
160 <text x="15" y="275">xor</text>
161 </g>
162 <g transform="translate(900,25)">
163 <use xlink:href="#Red100" filter="url(#arithmeticNoFlood)" />
164 <use xlink:href="#Red50" filter="url(#arithmeticNoFlood)" />
165 <text x="-25" y="275">arithmetic</text>
166 </g>
167 </g>
168 </g>
169 </svg>
170