Debian Codegraph @

samples/tests/spec/scripting/transform_create1.svg

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN" "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd" >
4 <!--
5
6 Licensed to the Apache Software Foundation (ASF) under one or more
7 contributor license agreements. See the NOTICE file distributed with
8 this work for additional information regarding copyright ownership.
9 The ASF licenses this file to You under the Apache License, Version 2.0
10 (the "License"); you may not use this file except in compliance with
11 the License. You may obtain a copy of the License at
12
13 http://www.apache.org/licenses/LICENSE-2.0
14
15 Unless required by applicable law or agreed to in writing, software
16 distributed under the License is distributed on an "AS IS" BASIS,
17 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 See the License for the specific language governing permissions and
19 limitations under the License.
20
21 --><!-- ====================================================================== -->
22 <!-- Modification of a polygon attributes -->
23 <!-- -->
24 <!-- @author [email protected] -->
25 <!-- @version $Id$ -->
26 <!-- ====================================================================== -->
27 <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
28
29 <svg width="450" viewBox="0 0 450 500" height="500" id="body">
30 <title>SVGTransformable.transform &apos;onload&apos;</title>
31
32 <text x="50%" y="45" class="title">SVGTransformable.transform in &apos;onload&apos;
33 </text>
34 <script type="text/ecmascript"><![CDATA[
35 function translate(evt,x,y)
36 {
37 var elt = evt.target;
38 ma = elt.ownerDocument.documentElement.createSVGMatrix();
39 ma = ma.translate(x,y);
40 tr = elt.transform.baseVal.createSVGTransformFromMatrix(ma);
41 nb = elt.transform.baseVal.initialize(tr);
42 var text = elt.ownerDocument.getElementById('test1_text');
43 text.firstChild.appendData(" ( type = "+nb.type+")");
44 }
45 function rotate(evt,a,x,y)
46 {
47 var elt = evt.target;
48 ma = elt.ownerDocument.documentElement.createSVGMatrix();
49 ma = ma.translate(x, y);
50 ma = ma.rotate(a);
51 ma = ma.translate(-x, -y);
52 tr = elt.transform.baseVal.createSVGTransformFromMatrix(ma);
53 nb = elt.transform.baseVal.initialize(tr);
54 var text = elt.ownerDocument.getElementById('test2_text');
55 text.firstChild.appendData(" ( type = "+nb.type+")");
56 }
57 function skewX(evt,x)
58 {
59 var elt = evt.target;
60 ma = elt.ownerDocument.documentElement.createSVGMatrix();
61 ma = ma.skewX(x);
62 tr = elt.transform.baseVal.createSVGTransformFromMatrix(ma);
63 nb = elt.transform.baseVal.initialize(tr);
64 var text = elt.ownerDocument.getElementById('test3_text');
65 text.firstChild.appendData("( type = "+nb.type+")");
66 }
67 function skewY(evt,y)
68 {
69 var elt = evt.target;
70 ma = elt.ownerDocument.documentElement.createSVGMatrix();
71 ma = ma.skewY(y);
72 tr = elt.transform.baseVal.createSVGTransformFromMatrix(ma);
73 nb = elt.transform.baseVal.initialize(tr);
74 var text = elt.ownerDocument.getElementById('test4_text');
75 text.firstChild.appendData(" ( type = "+nb.type+")");
76 }
77 function scale(evt,x,y)
78 {
79 var elt = evt.target;
80 tr = elt.ownerDocument.documentElement.createSVGTransform();
81 tr.setScale(x,y);
82 nb = elt.transform.baseVal.initialize(tr);
83 var text = elt.ownerDocument.getElementById('test5_text');
84 text.firstChild.appendData(" ( type = "+nb.type+")");
85 }
86 function matrix(evt,a,b,c,d,e,f)
87 {
88 var elt = evt.target;
89 matrix = elt.ownerDocument.documentElement.createSVGMatrix();
90 matrix.a = a;
91 matrix.b = b;
92 matrix.c = c;
93 matrix.d = d;
94 matrix.e = e;
95 matrix.f = f;
96 tr = elt.ownerDocument.documentElement.createSVGTransform();
97 tr.setMatrix(matrix);
98 nb = elt.transform.baseVal.initialize(tr);
99 var text = elt.ownerDocument.getElementById('test6_text');
100 text.firstChild.appendData(" ( type = "+nb.type+")");
101 }
102 ]]></script>
103 <g id="test-content" transform="matrix(1.0 0.0 0.0 1.0 -148.27586 -91.37931)">
104
105 <!-- onload="translate(evt)" -->
106 <text x="180" y="160" font-size="11">translate</text>
107 <rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4"
108 transform="translate(10,30)"/>
109 <rect x="175" y="175" width="50" height="50" id="test1" style="fill:gold; stroke:orange; stroke-width:4"
110 onload="translate(evt,10,30)"/>
111 <text x="160" font-size="9" y="290" id="test1_text">
112 transform
113 </text>
114
115 <g transform="translate(150,0)" >
116 <!-- onload="rotate(evt)" -->
117 <text x="180" y="160" font-size="11" >rotate</text>
118 <rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4"
119 transform="rotate(45,200,230)"/>
120 <rect x="175" y="175" width="50" height="50" id="test1" style="fill:gold; stroke:orange; stroke-width:4"
121 onload="rotate(evt,45,200,230)"/>
122 <text x="160" font-size="9" y="290" id="test2_text">
123 transform
124 </text>
125 </g>
126
127 <g transform="translate(300,0)" >
128 <!-- onload="skewX(evt)" -->
129 <text x="180" y="160" font-size="11" >skewX</text>
130 <rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4"
131 transform="skewX(10)"/>
132 <rect x="175" y="175" width="50" height="50" id="test1" style="fill:gold; stroke:orange; stroke-width:4"
133 onload="skewX(evt,10)"/>
134 <text x="160" font-size="9" y="290" id="test3_text">
135 transform
136 </text>
137 </g>
138
139 <g transform="translate(0,150)" >
140 <!-- onload="skewY(evt)" -->
141 <text x="180" y="160" font-size="11" >skewY</text>
142 <rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4"
143 transform="skewY(5)"/>
144 <rect x="175" y="175" width="50" height="50" id="test1" style="fill:gold; stroke:orange; stroke-width:4"
145 onload="skewY(evt,5)"/>
146
147 <text x="160" font-size="9" y="290" id="test4_text">
148 transform
149 </text>
150 </g>
151
152 <g transform="translate(150,150)" >
153 <!-- onload="scale(evt)" -->
154 <text x="180" y="160" font-size="11" >scale</text>
155 <rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4"
156 transform="scale(0.9,1.1)"/>
157 <rect x="175" y="175" width="50" height="50" id="test1" style="fill:gold; stroke:orange; stroke-width:4"
158 onload="scale(evt,0.9,1.1)"/>
159
160 <text x="160" font-size="9" y="290" id="test5_text">
161 transform
162 </text>
163 </g>
164
165 <g transform="translate(300,150)" >
166 <!-- onload="matrix(evt)" -->
167 <text x="180" y="160" font-size="11" >matrix</text>
168 <rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4"
169 transform="matrix(0.4,0.9,-0.9,0.4,328,-46)"/>
170 <rect x="175" y="175" width="50" height="50" id="test1" style="fill:gold; stroke:orange; stroke-width:4"
171 onload="matrix(evt,0.4,0.9,-0.9,0.4,328,-46)"/>
172
173 <text x="160" font-size="9" y="290" id="test6_text">
174 transform
175 </text>
176 </g>
177
178
179 </g>
180 </svg>