| 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 |
<!-- Test of paintType DOM interface --> |
| 25 |
<!-- --> |
| 26 |
<!-- @author [email protected] --> |
| 27 |
<!-- @version $Id$ --> |
| 28 |
<!-- ====================================================================== --> |
| 29 |
|
| 30 |
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> |
| 31 |
|
| 32 |
<svg id="body" width="450" height="500" viewBox="0 0 450 500" |
| 33 |
onload="doTest()" |
| 34 |
xmlns="http://www.w3.org/2000/svg" |
| 35 |
xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 36 |
|
| 37 |
<title>Test of paintType DOM interface</title> |
| 38 |
|
| 39 |
<text x="50%" y="45" class="title">Test of paintType DOM interface</text> |
| 40 |
|
| 41 |
<script type="text/ecmascript"> |
| 42 |
var svgNamespaceURI = "http://www.w3.org/2000/svg"; |
| 43 |
var UNKNOWN = 0; |
| 44 |
var RGBCOLOR = 1; |
| 45 |
var RGBCOLOR_ICCCOLOR = 2; |
| 46 |
var NONE = 101; |
| 47 |
var CURRENTCOLOR = 102; |
| 48 |
var URI_NONE = 103; |
| 49 |
var URI_CURRENTCOLOR = 104; |
| 50 |
var URI_RGBCOLOR = 105; |
| 51 |
var URI_RGBCOLOR_ICCCOLOR = 106; |
| 52 |
var URI = 107; |
| 53 |
|
| 54 |
function getType(id, attr) { |
| 55 |
var e = document.getElementById(id); |
| 56 |
var pa = e.getPresentationAttribute(attr); |
| 57 |
var pt = pa.paintType; |
| 58 |
var txt; |
| 59 |
if (pt == UNKNOWN) txt="UNKNOWN"; |
| 60 |
else if (pt == RGBCOLOR) txt="RGBCOLOR"; |
| 61 |
else if (pt == RGBCOLOR_ICCCOLOR) txt="RGBCOLOR_ICCCOLOR"; |
| 62 |
else if (pt == NONE) txt="NONE"; |
| 63 |
else if (pt == CURRENTCOLOR) txt="CURRENTCOLOR"; |
| 64 |
else if (pt == URI_NONE) txt="URI_NONE"; |
| 65 |
else if (pt == URI_CURRENTCOLOR) txt="URI_CURRENTCOLOR"; |
| 66 |
else if (pt == URI_RGBCOLOR) txt="URI_RGBCOLOR"; |
| 67 |
else if (pt == URI_RGBCOLOR_ICCCOLOR) txt="URI_RGBCOLOR_ICCCOLOR"; |
| 68 |
else if (pt == URI) txt="URI"; |
| 69 |
else txt="Unknown paint type"; |
| 70 |
|
| 71 |
e = document.getElementById("text."+id); |
| 72 |
e.appendChild(document.createTextNode(txt)); |
| 73 |
} |
| 74 |
|
| 75 |
function doTest() { |
| 76 |
getType("r1", "fill"); |
| 77 |
getType("r2", "fill"); |
| 78 |
getType("r3", "fill"); |
| 79 |
getType("r4", "fill"); |
| 80 |
getType("r5", "fill"); |
| 81 |
getType("r6", "fill"); |
| 82 |
getType("r7", "fill"); |
| 83 |
getType("r8", "fill"); |
| 84 |
getType("r9", "fill"); |
| 85 |
getType("r10", "fill"); |
| 86 |
getType("r11", "fill"); |
| 87 |
getType("r12", "fill"); |
| 88 |
} |
| 89 |
</script> |
| 90 |
|
| 91 |
<linearGradient id="lg" spreadMethod="repeat"> |
| 92 |
<stop offset="0" stop-color="gold" /> |
| 93 |
<stop offset="1" stop-color="crimson" /> |
| 94 |
</linearGradient> |
| 95 |
|
| 96 |
<color-profile name="changeColorAuto" |
| 97 |
rendering-intent="auto" |
| 98 |
xlink:href="../../resources/icc/changeColor.icm"/> |
| 99 |
|
| 100 |
<g color="green" text-anchor="middle"> |
| 101 |
<rect id="r1" x="30" y="80" height="75" width="75" fill="#F00"/> |
| 102 |
<rect id="r2" x="135" y="80" height="75" width="75" fill="gold"/> |
| 103 |
<rect id="r3" x="240" y="80" height="75" width="75" fill="currentColor"/> |
| 104 |
<rect id="r4" x="345" y="80" height="75" width="75" fill="url(#lg)"/> |
| 105 |
|
| 106 |
<text id="text.r1" x="67.5" y="170"/> |
| 107 |
<text id="text.r2" x="172.5" y="185"/> |
| 108 |
<text id="text.r3" x="277.5" y="170"/> |
| 109 |
<text id="text.r4" x="382.5" y="185"/> |
| 110 |
|
| 111 |
|
| 112 |
<rect id="r5" x="30" y="195" height="75" width="75" |
| 113 |
fill="none" stroke="black"/> |
| 114 |
<rect id="r6" x="135" y="195" height="75" width="75" |
| 115 |
fill="gold icc-color(changeColorAuto, 0.702, 0.2745, 0.098)"/> |
| 116 |
<rect id="r7" x="240" y="195" height="75" width="75" |
| 117 |
fill="url(#lg) none"/> |
| 118 |
<rect id="r8" x="345" y="195" height="75" width="75" |
| 119 |
fill="url(#lg) gold"/> |
| 120 |
|
| 121 |
<text id="text.r5" x="67.5" y="290"/> |
| 122 |
<text id="text.r6" x="172.5" y="305"/> |
| 123 |
<text id="text.r7" x="277.5" y="290"/> |
| 124 |
<text id="text.r8" x="382.5" y="305"/> |
| 125 |
|
| 126 |
|
| 127 |
<rect id="r9" x="30" y="320" height="75" width="75" |
| 128 |
fill="url(#lg) currentColor"/> |
| 129 |
<rect id="r10" x="135" y="320" height="75" width="75" |
| 130 |
fill="url(#lg) gold icc-color(changeColorAuto, 0.702, 0.2745, 0.098)"/> |
| 131 |
<rect id="r11" x="240" y="320" height="75" width="75" |
| 132 |
fill="url(#no_such_uri) gold"/> |
| 133 |
<rect id="r12" x="345" y="320" height="75" width="75" |
| 134 |
fill="url(#no_such_uri) currentColor"/> |
| 135 |
|
| 136 |
<text id="text.r9" x="67.5" y="415"/> |
| 137 |
<text id="text.r10" x="172.5" y="430"/> |
| 138 |
<text id="text.r11" x="277.5" y="415"/> |
| 139 |
<text id="text.r12" x="382.5" y="430"/> |
| 140 |
|
| 141 |
</g> |
| 142 |
</svg> |