File: paintType.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 (142 lines) | stat: -rw-r--r-- 5,789 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
<?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 paintType DOM interface                                        -->
<!--                                                                        -->
<!-- @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="doTest()"
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink">

   <title>Test of paintType DOM interface</title>

   <text x="50%" y="45" class="title">Test of paintType DOM interface</text>

   <script type="text/ecmascript">
      var svgNamespaceURI = "http://www.w3.org/2000/svg";
      var UNKNOWN               = 0;
      var RGBCOLOR              = 1;
      var RGBCOLOR_ICCCOLOR     = 2;
      var NONE                  = 101;
      var CURRENTCOLOR          = 102;
      var URI_NONE              = 103;
      var URI_CURRENTCOLOR      = 104;
      var URI_RGBCOLOR          = 105;
      var URI_RGBCOLOR_ICCCOLOR = 106;
      var URI                   = 107;

      function getType(id, attr) {
        var e = document.getElementById(id);
        var pa = e.getPresentationAttribute(attr);
        var pt = pa.paintType;
        var txt;
        if      (pt == UNKNOWN)               txt="UNKNOWN";
        else if (pt == RGBCOLOR)              txt="RGBCOLOR";
        else if (pt == RGBCOLOR_ICCCOLOR)     txt="RGBCOLOR_ICCCOLOR";
        else if (pt == NONE)                  txt="NONE";
        else if (pt == CURRENTCOLOR)          txt="CURRENTCOLOR";
        else if (pt == URI_NONE)              txt="URI_NONE";
        else if (pt == URI_CURRENTCOLOR)      txt="URI_CURRENTCOLOR";
        else if (pt == URI_RGBCOLOR)          txt="URI_RGBCOLOR";
        else if (pt == URI_RGBCOLOR_ICCCOLOR) txt="URI_RGBCOLOR_ICCCOLOR";
        else if (pt == URI)                   txt="URI";
        else                                  txt="Unknown paint type";

        e = document.getElementById("text."+id);
        e.appendChild(document.createTextNode(txt));
      }

      function doTest() {
         getType("r1", "fill");
         getType("r2", "fill");
         getType("r3", "fill");
         getType("r4", "fill");
         getType("r5", "fill");
         getType("r6", "fill");
         getType("r7", "fill");
         getType("r8", "fill");
         getType("r9", "fill");
         getType("r10", "fill");
         getType("r11", "fill");
         getType("r12", "fill");
      }
   </script>

   <linearGradient id="lg" spreadMethod="repeat">
      <stop offset="0" stop-color="gold" />
      <stop offset="1" stop-color="crimson" />
   </linearGradient>

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

   <g color="green" text-anchor="middle">
      <rect id="r1" x="30"  y="80" height="75" width="75" fill="#F00"/>
      <rect id="r2" x="135" y="80" height="75" width="75" fill="gold"/>
      <rect id="r3" x="240" y="80" height="75" width="75" fill="currentColor"/>
      <rect id="r4" x="345" y="80" height="75" width="75" fill="url(#lg)"/>

      <text id="text.r1" x="67.5"  y="170"/>
      <text id="text.r2" x="172.5" y="185"/>
      <text id="text.r3" x="277.5" y="170"/>
      <text id="text.r4" x="382.5" y="185"/>


      <rect id="r5" x="30"  y="195" height="75" width="75" 
            fill="none" stroke="black"/>
      <rect id="r6" x="135" y="195" height="75" width="75" 
            fill="gold icc-color(changeColorAuto, 0.702, 0.2745, 0.098)"/>
      <rect id="r7" x="240" y="195" height="75" width="75" 
            fill="url(#lg) none"/>
      <rect id="r8" x="345" y="195" height="75" width="75" 
            fill="url(#lg) gold"/>

      <text id="text.r5" x="67.5"  y="290"/>
      <text id="text.r6" x="172.5" y="305"/>
      <text id="text.r7" x="277.5" y="290"/>
      <text id="text.r8" x="382.5" y="305"/>


      <rect id="r9" x="30"  y="320" height="75" width="75" 
            fill="url(#lg) currentColor"/>
      <rect id="r10" x="135" y="320" height="75" width="75" 
       fill="url(#lg) gold icc-color(changeColorAuto, 0.702, 0.2745, 0.098)"/>
      <rect id="r11" x="240" y="320" height="75" width="75" 
            fill="url(#no_such_uri) gold"/>
      <rect id="r12" x="345" y="320" height="75" width="75" 
            fill="url(#no_such_uri) currentColor"/>

      <text id="text.r9" x="67.5"  y="415"/>
      <text id="text.r10" x="172.5" y="430"/>
      <text id="text.r11" x="277.5" y="415"/>
      <text id="text.r12" x="382.5" y="430"/>

   </g>
</svg>