| 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.getTransform() 'onload'</title> |
| 31 |
|
| 32 |
<text x="50%" y="45" class="title">SVGTransformable.getTransform() in 'onload' |
| 33 |
</text> |
| 34 |
<script type="text/ecmascript"><![CDATA[ |
| 35 |
function translate(evt,x,y) |
| 36 |
{ |
| 37 |
var elt = evt.target; |
| 38 |
tr = elt.getOwnerDocument().getDocumentElement().createSVGTransform(); |
| 39 |
tr.setTranslate(x,y); |
| 40 |
nb = elt.getTransform().getBaseVal().initialize(tr); |
| 41 |
var text = elt.getOwnerDocument().getElementById('test1_text'); |
| 42 |
text.getFirstChild().appendData(" ( type = "+nb.getType()+")"); |
| 43 |
} |
| 44 |
function rotate(evt,a,x,y) |
| 45 |
{ |
| 46 |
var elt = evt.target; |
| 47 |
tr = elt.getOwnerDocument().getDocumentElement().createSVGTransform(); |
| 48 |
tr.setRotate(a,x,y); |
| 49 |
nb = elt.getTransform().getBaseVal().initialize(tr); |
| 50 |
var text = elt.getOwnerDocument().getElementById('test2_text'); |
| 51 |
text.getFirstChild().appendData(" ( type = "+nb.getType()+")"); |
| 52 |
} |
| 53 |
function skewX(evt,x) |
| 54 |
{ |
| 55 |
var elt = evt.target; |
| 56 |
tr = elt.getOwnerDocument().getDocumentElement().createSVGTransform(); |
| 57 |
tr.setSkewX(x); |
| 58 |
nb = elt.getTransform().getBaseVal().initialize(tr); |
| 59 |
var text = elt.getOwnerDocument().getElementById('test3_text'); |
| 60 |
text.getFirstChild().appendData("( type = "+nb.getType()+")"); |
| 61 |
} |
| 62 |
function skewY(evt,y) |
| 63 |
{ |
| 64 |
var elt = evt.target; |
| 65 |
tr = elt.getOwnerDocument().getDocumentElement().createSVGTransform(); |
| 66 |
tr.setSkewY(y); |
| 67 |
nb = elt.getTransform().getBaseVal().initialize(tr); |
| 68 |
var text = elt.getOwnerDocument().getElementById('test4_text'); |
| 69 |
text.getFirstChild().appendData(" ( type = "+nb.getType()+")"); |
| 70 |
} |
| 71 |
function scale(evt,x,y) |
| 72 |
{ |
| 73 |
var elt = evt.target; |
| 74 |
tr = elt.getOwnerDocument().getDocumentElement().createSVGTransform(); |
| 75 |
tr.setScale(x,y); |
| 76 |
nb = elt.getTransform().getBaseVal().initialize(tr); |
| 77 |
var text = elt.getOwnerDocument().getElementById('test5_text'); |
| 78 |
text.getFirstChild().appendData(" ( type = "+nb.getType()+")"); |
| 79 |
} |
| 80 |
function matrix(evt,a,b,c,d,e,f) |
| 81 |
{ |
| 82 |
var elt = evt.target; |
| 83 |
matrix = elt.getOwnerDocument().getDocumentElement().createSVGMatrix(); |
| 84 |
matrix.setA(a); |
| 85 |
matrix.setB(b); |
| 86 |
matrix.setC(c); |
| 87 |
matrix.setD(d); |
| 88 |
matrix.setE(e); |
| 89 |
matrix.setF(f); |
| 90 |
tr = elt.getOwnerDocument().getDocumentElement().createSVGTransform(); |
| 91 |
tr.setMatrix(matrix); |
| 92 |
nb = elt.getTransform().getBaseVal().initialize(tr); |
| 93 |
var text = elt.getOwnerDocument().getElementById('test6_text'); |
| 94 |
text.getFirstChild().appendData(" ( type = "+nb.getType()+")"); |
| 95 |
} |
| 96 |
]]></script> |
| 97 |
<g id="test-content" transform="matrix(1.0 0.0 0.0 1.0 -148.27586 -91.37931)"> |
| 98 |
|
| 99 |
<!-- onload="translate(evt)" --> |
| 100 |
<text x="180" y="160" font-size="11">translate</text> |
| 101 |
<rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4" |
| 102 |
transform="translate(10,30)"/> |
| 103 |
<rect x="175" y="175" width="50" height="50" id="test1" style="fill:gold; stroke:orange; stroke-width:4" |
| 104 |
onload="translate(evt,10,30)"/> |
| 105 |
<text x="160" font-size="9" y="290" id="test1_text"> |
| 106 |
transform |
| 107 |
</text> |
| 108 |
|
| 109 |
<g transform="translate(150,0)" > |
| 110 |
<!-- onload="rotate(evt)" --> |
| 111 |
<text x="180" y="160" font-size="11" >rotate</text> |
| 112 |
<rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4" |
| 113 |
transform="rotate(45,200,230)"/> |
| 114 |
<rect x="175" y="175" width="50" height="50" id="test2" style="fill:gold; stroke:orange; stroke-width:4" |
| 115 |
onload="rotate(evt,45,200,230)"/> |
| 116 |
<text x="160" font-size="9" y="290" id="test2_text"> |
| 117 |
transform |
| 118 |
</text> |
| 119 |
</g> |
| 120 |
|
| 121 |
<g transform="translate(300,0)" > |
| 122 |
<!-- onload="skewX(evt)" --> |
| 123 |
<text x="180" y="160" font-size="11" >skewX</text> |
| 124 |
<rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4" |
| 125 |
transform="skewX(10)"/> |
| 126 |
<rect x="175" y="175" width="50" height="50" id="test3" style="fill:gold; stroke:orange; stroke-width:4" |
| 127 |
onload="skewX(evt,10)"/> |
| 128 |
<text x="160" font-size="9" y="290" id="test3_text"> |
| 129 |
transform |
| 130 |
</text> |
| 131 |
</g> |
| 132 |
|
| 133 |
<g transform="translate(0,150)" > |
| 134 |
<!-- onload="skewY(evt)" --> |
| 135 |
<text x="180" y="160" font-size="11" >skewY</text> |
| 136 |
<rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4" |
| 137 |
transform="skewY(5)"/> |
| 138 |
<rect x="175" y="175" width="50" height="50" id="test4" style="fill:gold; stroke:orange; stroke-width:4" |
| 139 |
onload="skewY(evt,5)"/> |
| 140 |
|
| 141 |
<text x="160" font-size="9" y="290" id="test4_text"> |
| 142 |
transform |
| 143 |
</text> |
| 144 |
</g> |
| 145 |
|
| 146 |
<g transform="translate(150,150)" > |
| 147 |
<!-- onload="scale(evt)" --> |
| 148 |
<text x="180" y="160" font-size="11" >scale</text> |
| 149 |
<rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4" |
| 150 |
transform="scale(0.9,1.1)"/> |
| 151 |
<rect x="175" y="175" width="50" height="50" id="test5" style="fill:gold; stroke:orange; stroke-width:4" |
| 152 |
onload="scale(evt,0.9,1.1)"/> |
| 153 |
|
| 154 |
<text x="160" font-size="9" y="290" id="test5_text"> |
| 155 |
transform |
| 156 |
</text> |
| 157 |
</g> |
| 158 |
|
| 159 |
<g transform="translate(300,150)" > |
| 160 |
<!-- onload="matrix(evt)" --> |
| 161 |
<text x="180" y="160" font-size="11" >matrix</text> |
| 162 |
<rect x="175" y="175" width="50" height="50" style="opacity:0.5;fill:#eee; stroke:#aaa; stroke-width:4" |
| 163 |
transform="matrix(0.4,0.9,-0.9,0.4,328,-46)"/> |
| 164 |
<rect x="175" y="175" width="50" height="50" id="test6" style="fill:gold; stroke:orange; stroke-width:4" |
| 165 |
onload="matrix(evt,0.4,0.9,-0.9,0.4,328,-46)"/> |
| 166 |
|
| 167 |
<text x="160" font-size="9" y="290" id="test6_text"> |
| 168 |
transform |
| 169 |
</text> |
| 170 |
</g> |
| 171 |
|
| 172 |
|
| 173 |
</g> |
| 174 |
</svg> |