File: relativeURI.svg

package info (click to toggle)
batik 1.18%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 28,972 kB
  • sloc: java: 192,233; xml: 19,449; javascript: 1,276; sh: 85; makefile: 5
file content (228 lines) | stat: -rw-r--r-- 8,342 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">

<!--

   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

-->
<!-- ====================================================================== -->
<!-- Test of getting/setting current Scale and Translate.                   -->
<!--                                                                        -->
<!-- @author deweese@apache.org                                             -->
<!-- @version $Id$ -->
<!-- ====================================================================== -->

<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>  

<svg id="body" width="450" height="500" viewBox="0 0 450 500"
     onload="init()"
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink">

    <title>Test of CSS with relative URIs</title>
    <text class="title" x="50%" y="50">Test of CSS with relative URIs</text>


<script type="text/ecmascript"><![CDATA[
var root = document.getRootElement();

var t0 = document.getElementById('t0');
var t1 = document.getElementById('t1');
var t2 = document.getElementById('t2');
var t3 = document.getElementById('t3');
var t4 = document.getElementById('t4');
var t5 = document.getElementById('t5');
var t6 = document.getElementById('t6');
var t7 = document.getElementById('t7');
var t8 = document.getElementById('t8');
var t9 = document.getElementById('t9');
var t10 = document.getElementById('t10');
var t11 = document.getElementById('t11');
var t12 = document.getElementById('t12');
var t13 = document.getElementById('t13');
var t14 = document.getElementById('t14');

var docURL = document.getURL();

function unifyURL(str) {
  var start = str.indexOf(docURL);
  if (start == -1) return str;
  var before = str.substring(0, start);
  var after  = str.substring(start+docURL.length);
  return before + "<doc>" + after;
}

function init() {
  var view = document.getDefaultView();

  var elem = document.getElementById('xxx');
  var cssStyle = elem.getStyle();
  var computedStyle = view.getComputedStyle(elem, "");
  
  cssStyle.setProperty("fill", "url(#grad)","");
  var localStr = cssStyle.getPropertyValue("fill");
  var absStr = computedStyle.getPropertyValue("fill");
  t1.firstChild.nodeValue = unifyURL(localStr);
  t2.firstChild.nodeValue = unifyURL(absStr);

  cssStyle.setProperty("cursor", "url(#cur),crosshair","");
  localStr = cssStyle.getPropertyValue("cursor");
  absStr = computedStyle.getPropertyCSSValue("cursor");
  absStr = absStr.item(0).getCssText();
  t3.firstChild.nodeValue = unifyURL(localStr);
  t4.firstChild.nodeValue = unifyURL(absStr);

  cssStyle.setProperty("clip-path", "url(#clip)","");
  localStr = cssStyle.getPropertyValue("clip-path");
  absStr = computedStyle.getPropertyValue("clip-path");
  t5.firstChild.nodeValue = unifyURL(localStr);
  t6.firstChild.nodeValue = unifyURL(absStr);

  cssStyle.setProperty("color-profile", "url(#prof)","");
  localStr = cssStyle.getPropertyValue("color-profile");
  absStr = computedStyle.getPropertyValue("color-profile");
  t7.firstChild.nodeValue = unifyURL(localStr);
  t8.firstChild.nodeValue = unifyURL(absStr);

  cssStyle.setProperty("filter", "url(#filt)","");
  localStr = cssStyle.getPropertyValue("filter");
  absStr = computedStyle.getPropertyValue("filter");
  t9.firstChild.nodeValue  = unifyURL(localStr);
  t10.firstChild.nodeValue = unifyURL(absStr);

  elem = document.getElementById('yyy');
  var cssStyle = elem.getStyle();
  computedStyle = view.getComputedStyle(elem, "");

  cssStyle.setProperty("marker-start", "url(#mark)","");
  localStr = cssStyle.getPropertyValue("marker-start");
  absStr = computedStyle.getPropertyValue("marker-start");
  t11.firstChild.nodeValue = unifyURL(localStr);
  t12.firstChild.nodeValue = unifyURL(absStr);

  cssStyle.setProperty("mask", "url(#mask)","");
  localStr = cssStyle.getPropertyValue("mask");
  absStr = computedStyle.getPropertyValue("mask");
  t13.firstChild.nodeValue = unifyURL(localStr);
  t14.firstChild.nodeValue = unifyURL(absStr);
}

function regardStart() {
  inRegard = true;
}
]]></script>

<!-- cursor, src, clip-path, color-profile, filter, marker, mask -->

  <radialGradient id="grad">
    <stop offset="0" stop-color="gold" />
    <stop offset="1" stop-color="crimson" />
  </radialGradient>
  
  <cursor id="cur" x="16" y="16" 
    xlink:href="../../resources/images/hotSpotCenter.png"/>

  <clipPath id="clip" clipPathUnits="objectBoundingBox">
    <circle cx=".25"  cy=".5" r=".4"/>
    <circle cx=".75"  cy=".5" r=".4"/>
  </clipPath>

  <color-profile id="prof" name="changeColorAuto" 
    rendering-intent="auto"
    xlink:href="../../resources/icc/changeColor.icm"/>

  <filter id="filt" primitiveUnits="objectBoundingBox"
    filterUnits="objectBoundingBox"
    x="0" y="0" width="200%" height="200%">
    <feOffset x="0%" y="0%" width="50%" height="50%"/>
    <feTile /> 
  </filter>

  <marker id="mark" markerWidth="48" markerHeight="32" 
    viewBox="-10 -3 13 6" orient="auto" refX="0" refY="0"
    markerUnits="strokeWidth">
    <g stroke="none" fill="gold">
      <circle r="3" />
      <rect x="-1" y="0" width="2" height="7" />
      <path d="M -3 6 l 6 0 l -3 3 z" />
    </g>
  </marker>

  <mask id="mask">
    <g transform="translate(275, 400)">
      <circle cx="-25" cy="-10" r="25" fill="#ff0000" />
      <circle cx="25" cy="-10" r="25" fill="#00ff00" />
      <circle cx="-25" cy="10" r="25" fill="#0000ff" />
      <circle cx="25" cy="10" r="25" fill="#ffffff" />
    </g>
  </mask>

  <g transform="translate(30, 75)">
    <g stroke="black" >
      <rect x="120" y="15" width="210" height="30" fill="white"/>
      <rect x="20" y="45" width="310" height="30" fill="lightgrey"/>
      <rect x="20" y="75" width="310" height="30" fill="white"/>
      <rect x="20" y="105" width="310" height="30" fill="lightgrey"/>
      <rect x="20" y="135" width="310" height="30" fill="white"/>
      <rect x="20" y="165" width="310" height="30" fill="lightgrey"/>
      <rect x="20" y="195" width="310" height="30" fill="white"/>
      <rect x="20" y="225" width="310" height="30" fill="lightgrey"/>
      <line x1="225" y1="15" x2="225" y2="255"/>
      <line x1="120" y1="15" x2="120" y2="255"/>
    </g>
    <g text-anchor="middle">
      <text x="175" y="35">Style</text>
      <text x="275" y="35">Computed</text>

      <text x="75" y="65">fill</text>
      <text id="t1" x="175" y="65"> </text>
      <text id="t2" x="275" y="65"> </text>

      <text x="75" y="95">cursor</text>
      <text id="t3" x="175" y="95"> </text>
      <text id="t4" x="275" y="95"> </text>

      <text x="75" y="125">clip-path</text>
      <text id="t5" x="175" y="125"> </text>
      <text id="t6" x="275" y="126"> </text>

      <text x="75" y="155">color-profile</text>
      <text id="t7" x="175" y="155"> </text>
      <text id="t8" x="275" y="155"> </text>

      <text x="75" y="185">filter</text>
      <text id="t9" x="175" y="185"> </text>
      <text id="t10" x="275" y="185"> </text>

      <text x="75" y="215">marker</text>
      <text id="t11" x="175" y="215"> </text>
      <text id="t12" x="275" y="215"> </text>

      <text x="75" y="245">mask</text>
      <text id="t13" x="175" y="245"> </text>
      <text id="t14" x="275" y="245"> </text>
    </g>
  </g>
  <rect id="xxx" x="75" y="375" width="100" height="50"
    style="fill:blue"/>

  <path id="yyy" d="M225 375 h 100 v 50 h -100 z"
    marker-end="url(#mark)"
    style="fill:crimson" stroke="black" stroke-width="1"/>

</svg>