Debian Codegraph @

samples/tests/spec/scripting/normalizedPathTest.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 <!-- Illustrates how a SVG Normalized Path does not have loss of precision. -->
25 <!-- -->
26 <!-- @author [email protected] -->
27 <!-- @version $Id: normalizedPathTest.svg -->
28 <!-- ====================================================================== -->
29
30 <svg id="body" width="450" height="500" viewBox="0 0 450 500"
31 xmlns="http://www.w3.org/2000/svg"
32 xmlns:xlink="http://www.w3.org/1999/xlink"
33 onload="normalizePaths();">
34 <script type="text/ecmascript">
35 function normalizePaths() {
36 var originalPath= document.getElementById("SamplePath");
37 var normalizedPath = originalPath.cloneNode(false);
38
39 var list = normalizedPath.getNormalizedPathSegList();
40 list.insertItemBefore(list.removeItem(0), 0);
41
42 document.getElementById("overlay").appendChild(normalizedPath);
43 }
44 </script>
45 <title>Normalized Path Test</title>
46
47 <g id="background" transform="translate(10,10)" style="fill:none;stroke:black;stroke-width:2">
48 <rect x="0" y ="0" width="430" height="480"/>
49 <rect x="5" y ="5" width="420" height="20" fill="gray"/>
50 <text x="10" y ="20" stroke="none" fill="yellow">Normalized Path Test</text>
51 </g>
52 <g id="canvas" style="fill:none;stroke:darkgray;stroke-width:10" transform="translate(75,60)">
53 <path id="SamplePath" d="M0,50 C0,0 50,0 50,50 S100,100 100,50 h20 l20,30 v-30
54 c0,-50 50,-50 50,0 s50,50 50,0 L 280,50 v60 h-60 v40
55 a50,50 0 1,1 -50,50 A60 80 0 0,0 150,300
56 Q125,350 100,300q-25-50 -50,0t-50,0q-40,-20 0-80T0,150
57 l-40,-10 V380 H150 a25,25 -30 0,1 50,-25 l 50,-25
58 a25,50 -30 0,1 50,-25 l 50,-25"/>
59 </g>
60 <g id="overlay" style="fill:none;stroke:lightgray;stroke-width:3" transform="translate(75,60)">
61
62 </g>
63 </svg>