Debian Codegraph @

samples/tests/spec/structure/svgImageViewBox.svg

raw
1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
3 "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
5 <!--
6
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
13
14 http://www.apache.org/licenses/LICENSE-2.0
15
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
21
22 -->
23 <!-- ========================================================================= -->
24 <!-- This example validates the handling of viewBox and preserveAspectRatio -->
25 <!-- for <image> elements. -->
26 <!-- -->
27 <!-- @author [email protected] -->
28 <!-- @version $Id$ -->
29 <!-- ========================================================================= -->
30 <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
31
32 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body" width="450" height="500" viewBox="0 0 450 500">
33 <title>&lt;image&gt; and viewBox &amp; preserveAspectRatio</title>
34
35 <style type="text/css"><![CDATA[
36 .label { text-anchor: middle; }
37 .oddRow { fill:white; stroke:black; }
38 .evenRow { fill:#eeeeee; stroke:black; }
39 ]]></style>
40
41 <g id="content">
42
43 <text class="title" x="50%" y="30">viewBox &amp; preserveAspectRatio</text>
44 <text class="title" x="50%" y="50">on svg &lt;image&gt;</text>
45
46 <g id="table" class="label" transform="translate(80, 60)">
47 <rect width="110" height="20" class="oddRow" />
48 <text x="55" y="15">meet</text>
49 <rect width="110" height="20" class="oddRow" transform="translate(110,0)"/>
50 <text x="55" y="15" transform="translate(110, 0)">slice</text>
51 <rect width="110" height="20" class="oddRow" transform="translate(220,0)"/>
52 <text x="55" y="15" transform="translate(220, 0)">unspecified</text>
53
54 <g id="yMXX">
55 <rect x="-20" y="20" width="20" height="40" class="oddRow" />
56 <text x="-5" y="40" transform="rotate(-90,-5,40)">yMin</text>
57
58 <g transform="translate(0,40)">
59 <rect x="-20" y="20" width="20" height="40" class="evenRow" />
60 <text x="-5" y="40" transform="rotate(-90,-5,40)">yMid</text>
61 </g>
62
63 <g transform="translate(0,80)">
64 <rect x="-20" y="20" width="20" height="40" class="oddRow" />
65 <text x="-5" y="40" transform="rotate(-90,-5,40)">yMax</text>
66 </g>
67 </g>
68
69
70 <g transform="translate(0,120)">
71 <rect x="-20" y="20" width="20" height="40" class="oddRow" />
72 <text x="-5" y="40" transform="rotate(-90,-5,40)">yMin</text>
73
74 <g transform="translate(0,40)">
75 <rect x="-20" y="20" width="20" height="40" class="evenRow" />
76 <text x="-5" y="40" transform="rotate(-90,-5,40)">yMid</text>
77 </g>
78
79 <g transform="translate(0,80)">
80 <rect x="-20" y="20" width="20" height="40" class="oddRow" />
81 <text x="-5" y="40" transform="rotate(-90,-5,40)">yMax</text>
82 </g>
83 </g>
84
85 <g transform="translate(0,240)">
86 <rect x="-20" y="20" width="20" height="40" class="oddRow" />
87 <text x="-5" y="40" transform="rotate(-90,-5,40)">yMin</text>
88
89 <g transform="translate(0,40)">
90 <rect x="-20" y="20" width="20" height="40" class="evenRow" />
91 <text x="-5" y="40" transform="rotate(-90,-5,40)">yMid</text>
92 </g>
93
94 <g transform="translate(0,80)">
95 <rect x="-20" y="20" width="20" height="40" class="oddRow" />
96 <text x="-5" y="40" transform="rotate(-90,-5,40)">yMax</text>
97 </g>
98 </g>
99
100 <rect x="-40" y="20" width="20" height="120" class="evenRow" />
101 <text x="-25" y="80" transform="rotate(-90,-25,80)">xMin</text>
102
103 <g transform="translate(0,120)">
104 <rect x="-40" y="20" width="20" height="120" class="oddRow" />
105 <text x="-25" y="80" transform="rotate(-90,-25,80)">xMid</text>
106 </g>
107
108 <g transform="translate(0,240)">
109 <rect x="-40" y="20" width="20" height="120" class="evenRow" />
110 <text x="-25" y="80" transform="rotate(-90,-25,80)">xMax</text>
111 </g>
112
113 <defs>
114 <g id="row">
115 <rect width="110" height="40" transform="translate(0 ,20)"/>
116 <rect width="110" height="40" transform="translate(110,20)"/>
117 <rect width="110" height="40" transform="translate(220,20)"/>
118 </g>
119 </defs>
120
121 <g id="evenRowBlock">
122 <use xlink:href="#row" class="evenRow" transform="translate(0,0)"/>
123 <use xlink:href="#row" class="oddRow" transform="translate(0,40)"/>
124 <use xlink:href="#row" class="evenRow" transform="translate(0,80)"/>
125 </g>
126
127 <g id="oddRowBlock" transform="translate(0,120)">
128 <use xlink:href="#row" class="oddRow" transform="translate(0,0)"/>
129 <use xlink:href="#row" class="evenRow" transform="translate(0,40)"/>
130 <use xlink:href="#row" class="oddRow" transform="translate(0,80)"/>
131 </g>
132
133 <use xlink:href="#evenRowBlock" transform="translate(0,240)"/>
134
135 <rect x="-40" y="380" width="40" height="40" fill="white" stroke="black" />
136 <text x="-15" y="400" transform="rotate(-90, -15, 400)">none</text>
137 <use xlink:href="#row" class="oddRow" transform="translate(0,360)" />
138
139 <line x1="55" y1="20" x2="55" y2="420" stroke="black" />
140 <line x1="165" y1="20" x2="165" y2="420" stroke="black" />
141 <line x1="275" y1="20" x2="275" y2="420" stroke="black" />
142 </g>
143
144 <g id="testCases" transform="translate(80, 80)">
145 <defs>
146 <rect id="hViewBox" x="5" y="5" width="45" height="30" stroke="red" fill="none"/>
147 <rect id="vViewBox" x="70" y="5" width="25" height="30" stroke="red" fill="none"/>
148 <g id="smilley">
149 <g transform="translate(-15,-15)" >
150 <rect x="5" y="5" width="20" height="20" fill="black" />
151 <!-- <circle cx="10" cy="25" r="4" fill="crimson" />
152 <circle cx="20" cy="25" r="4" fill="crimson" /> -->
153 <circle cx="15" cy="15" r="10" fill="yellow"/>
154 <circle cx="12" cy="12" r="1.5" fill="black"/>
155 <circle cx="17" cy="12" r="1.5" fill="black"/>
156 <path d="M 10 19 A 8 8 0 0 0 20 19" stroke="black" stroke-width="1" fill="none"/>
157 </g>
158 </g>
159 </defs>
160
161 <!-- xMinYXXX XXX -->
162 <g>
163 <!-- ... YMin XXX -->
164 <g>
165 <g>
166 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMin meet" x="5" y="5" width="45" height="30" />
167 <use xlink:href="#hViewBox" />
168
169 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMin meet" x="70" y="5" width="25" height="30" />
170 <use xlink:href="#vViewBox" />
171 </g>
172
173 <g transform="translate(110, 0)">
174 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMin slice" x="5" y="5" width="45" height="30" />
175 <use xlink:href="#hViewBox" />
176
177 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMin slice" x="70" y="5" width="25" height="30" />
178 <use xlink:href="#vViewBox" />
179 </g>
180
181 <g transform="translate(220, 0)">
182 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMin" x="5" y="5" width="45" height="30" />
183 <use xlink:href="#hViewBox" />
184
185 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMin" x="70" y="5" width="25" height="30" />
186 <use xlink:href="#vViewBox" />
187 </g>
188 </g>
189
190 <!-- ... YMid XXX -->
191 <g transform="translate(0, 40)">
192 <g>
193 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMid meet" x="5" y="5" width="45" height="30" />
194 <use xlink:href="#hViewBox" />
195
196 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMid meet" x="70" y="5" width="25" height="30" />
197 <use xlink:href="#vViewBox" />
198 </g>
199
200 <g transform="translate(110, 0)">
201 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMid slice" x="5" y="5" width="45" height="30" />
202 <use xlink:href="#hViewBox" />
203
204 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMid slice" x="70" y="5" width="25" height="30" />
205 <use xlink:href="#vViewBox" />
206 </g>
207
208 <g transform="translate(220, 0)">
209 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMid" x="5" y="5" width="45" height="30" />
210 <use xlink:href="#hViewBox" />
211
212 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMid" x="70" y="5" width="25" height="30" />
213 <use xlink:href="#vViewBox" />
214 </g>
215 </g>
216
217 <!-- ... YMax XXX -->
218 <g transform="translate(0, 80)">
219 <g>
220 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMax meet" x="5" y="5" width="45" height="30" />
221 <use xlink:href="#hViewBox" />
222
223 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMax meet" x="70" y="5" width="25" height="30" />
224 <use xlink:href="#vViewBox" />
225 </g>
226
227 <g transform="translate(110, 0)">
228 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMax slice" x="5" y="5" width="45" height="30" />
229 <use xlink:href="#hViewBox" />
230
231 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMax slice" x="70" y="5" width="25" height="30" />
232 <use xlink:href="#vViewBox" />
233 </g>
234
235 <g transform="translate(220, 0)">
236 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMax" x="5" y="5" width="45" height="30" />
237 <use xlink:href="#hViewBox" />
238
239 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMinYMax" x="70" y="5" width="25" height="30" />
240 <use xlink:href="#vViewBox" />
241 </g>
242 </g>
243 </g>
244
245
246 <!-- xMidYXXX XXX -->
247 <g transform="translate(0, 120)">
248 <!-- ... YMin XXX -->
249 <g>
250 <g>
251 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMin meet" x="5" y="5" width="45" height="30" />
252 <use xlink:href="#hViewBox" />
253
254 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMin meet" x="70" y="5" width="25" height="30" />
255 <use xlink:href="#vViewBox" />
256 </g>
257
258 <g transform="translate(110, 0)">
259 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMin slice" x="5" y="5" width="45" height="30" />
260 <use xlink:href="#hViewBox" />
261
262 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMin slice" x="70" y="5" width="25" height="30" />
263 <use xlink:href="#vViewBox" />
264 </g>
265
266 <g transform="translate(220, 0)">
267 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMin" x="5" y="5" width="45" height="30" />
268 <use xlink:href="#hViewBox" />
269
270 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMin" x="70" y="5" width="25" height="30" />
271 <use xlink:href="#vViewBox" />
272 </g>
273 </g>
274
275 <!-- ... YMid XXX -->
276 <g transform="translate(0, 40)">
277 <g>
278 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMid meet" x="5" y="5" width="45" height="30" />
279 <use xlink:href="#hViewBox" />
280
281 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMid meet" x="70" y="5" width="25" height="30" />
282 <use xlink:href="#vViewBox" />
283 </g>
284
285 <g transform="translate(110, 0)">
286 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMid slice" x="5" y="5" width="45" height="30" />
287 <use xlink:href="#hViewBox" />
288
289 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMid slice" x="70" y="5" width="25" height="30" />
290 <use xlink:href="#vViewBox" />
291 </g>
292
293 <g transform="translate(220, 0)">
294 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMid" x="5" y="5" width="45" height="30" />
295 <use xlink:href="#hViewBox" />
296
297 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMid" x="70" y="5" width="25" height="30" />
298 <use xlink:href="#vViewBox" />
299 </g>
300 </g>
301
302 <!-- ... YMax XXX -->
303 <g transform="translate(0, 80)">
304 <g>
305 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMax meet" x="5" y="5" width="45" height="30" />
306 <use xlink:href="#hViewBox" />
307
308 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMax meet" x="70" y="5" width="25" height="30" />
309 <use xlink:href="#vViewBox" />
310 </g>
311
312 <g transform="translate(110, 0)">
313 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMax slice" x="5" y="5" width="45" height="30" />
314 <use xlink:href="#hViewBox" />
315
316 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMax slice" x="70" y="5" width="25" height="30" />
317 <use xlink:href="#vViewBox" />
318 </g>
319
320 <g transform="translate(220, 0)">
321 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMax" x="5" y="5" width="45" height="30" />
322 <use xlink:href="#hViewBox" />
323
324 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMidYMax" x="70" y="5" width="25" height="30" />
325 <use xlink:href="#vViewBox" />
326 </g>
327 </g>
328 </g>
329
330 <!-- xMaxYXXX XXX -->
331 <g transform="translate(0, 240)">
332 <!-- ... YMin XXX -->
333 <g>
334 <g>
335 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMin meet" x="5" y="5" width="45" height="30" />
336 <use xlink:href="#hViewBox" />
337
338 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMin meet" x="70" y="5" width="25" height="30" />
339 <use xlink:href="#vViewBox" />
340 </g>
341
342 <g transform="translate(110, 0)">
343 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMin slice" x="5" y="5" width="45" height="30" />
344 <use xlink:href="#hViewBox" />
345
346 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMin slice" x="70" y="5" width="25" height="30" />
347 <use xlink:href="#vViewBox" />
348 </g>
349
350 <g transform="translate(220, 0)">
351 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMin" x="5" y="5" width="45" height="30" />
352 <use xlink:href="#hViewBox" />
353
354 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMin" x="70" y="5" width="25" height="30" />
355 <use xlink:href="#vViewBox" />
356 </g>
357 </g>
358
359 <!-- ... YMid XXX -->
360 <g transform="translate(0, 40)">
361 <g>
362 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMid meet" x="5" y="5" width="45" height="30" />
363 <use xlink:href="#hViewBox" />
364
365 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMid meet" x="70" y="5" width="25" height="30" />
366 <use xlink:href="#vViewBox" />
367 </g>
368
369 <g transform="translate(110, 0)">
370 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMid slice" x="5" y="5" width="45" height="30" />
371 <use xlink:href="#hViewBox" />
372
373 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMid slice" x="70" y="5" width="25" height="30" />
374 <use xlink:href="#vViewBox" />
375 </g>
376
377 <g transform="translate(220, 0)">
378 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMid" x="5" y="5" width="45" height="30" />
379 <use xlink:href="#hViewBox" />
380
381 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMid" x="70" y="5" width="25" height="30" />
382 <use xlink:href="#vViewBox" />
383 </g>
384 </g>
385
386 <!-- ... YMax XXX -->
387 <g transform="translate(0, 80)">
388 <g>
389 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMax meet" x="5" y="5" width="45" height="30" />
390 <use xlink:href="#hViewBox" />
391
392 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMax meet" x="70" y="5" width="25" height="30" />
393 <use xlink:href="#vViewBox" />
394 </g>
395
396 <g transform="translate(110, 0)">
397 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMax slice" x="5" y="5" width="45" height="30" />
398 <use xlink:href="#hViewBox" />
399
400 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMax slice" x="70" y="5" width="25" height="30" />
401 <use xlink:href="#vViewBox" />
402 </g>
403
404 <g transform="translate(220, 0)">
405 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMax" x="5" y="5" width="45" height="30" />
406 <use xlink:href="#hViewBox" />
407
408 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="xMaxYMax" x="70" y="5" width="25" height="30" />
409 <use xlink:href="#vViewBox" />
410 </g>
411 </g>
412 </g>
413
414
415 <!-- none XXX -->
416 <g transform="translate(0,360)">
417 <g>
418 <g>
419 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="none meet" x="5" y="5" width="45" height="30" />
420 <use xlink:href="#hViewBox" />
421
422 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="none meet" x="70" y="5" width="25" height="30" />
423 <use xlink:href="#vViewBox" />
424 </g>
425
426 <g transform="translate(110, 0)">
427 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="none slice" x="5" y="5" width="45" height="30" />
428 <use xlink:href="#hViewBox" />
429
430 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="none slice" x="70" y="5" width="25" height="30" />
431 <use xlink:href="#vViewBox" />
432 </g>
433
434 <g transform="translate(220, 0)">
435 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="none" x="5" y="5" width="45" height="30" />
436 <use xlink:href="#hViewBox" />
437
438 <image xlink:href="../../resources/images/svg2.svg" preserveAspectRatio="none" x="70" y="5" width="25" height="30" />
439 <use xlink:href="#vViewBox" />
440 </g>
441 </g>
442
443 </g>
444
445
446
447 </g>
448
449 </g><!-- "content" -->
450
451 <!-- ============================================================= -->
452 <!-- Batik sample mark -->
453 <!-- ============================================================= -->
454 <use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" />
455
456 </svg>