| 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 |
<!-- This test file checks that the various combinations of units and viewbox --> |
| 25 |
<!-- work in Batik for patternRegions --> |
| 26 |
<!-- --> |
| 27 |
<!-- @author [email protected] --> |
| 28 |
<!-- @version $Id$ --> |
| 29 |
<!-- ========================================================================= --> |
| 30 |
|
| 31 |
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?> |
| 32 |
|
| 33 |
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body" width="450" height="500" viewBox="0 0 450 500"> |
| 34 |
<title>Pattern Tests</title> |
| 35 |
|
| 36 |
<text x="225" y="50" class="title"> |
| 37 |
patternUnits / patternContentUnits |
| 38 |
</text> |
| 39 |
<text x="225" y="75" class="title"> |
| 40 |
pattern viewBox |
| 41 |
</text> |
| 42 |
|
| 43 |
<!-- ============================================================= --> |
| 44 |
<!-- Test content --> |
| 45 |
<!-- ============================================================= --> |
| 46 |
<g id="testContent" style="font-size:10"> |
| 47 |
<defs> |
| 48 |
<!-- ============================================== --> |
| 49 |
<!-- patternUnits : default (objectBoundingBox) --> |
| 50 |
<!-- patternContentUnits : default (userSpaceOnUse) --> |
| 51 |
<!-- viewBox : default (none) --> |
| 52 |
<!-- ============================================== --> |
| 53 |
<pattern id="pattern1" x="0" y="0" width=".75" height="50%"> |
| 54 |
<circle cx="10" cy="10" r="10" style="fill:red" /> |
| 55 |
<rect x="10" y="10" width="15" height="15" style="fill:green"/> |
| 56 |
</pattern> |
| 57 |
|
| 58 |
<!-- ============================================== --> |
| 59 |
<!-- patternUnits : objectBoundingBox --> |
| 60 |
<!-- patternContentUnits : default (userSpaceOnUse) --> |
| 61 |
<!-- viewBox : default (none) --> |
| 62 |
<!-- ============================================== --> |
| 63 |
<pattern id="pattern2" patternUnits="objectBoundingBox" x="0" y="0" width=".75" height="50%"> |
| 64 |
<circle cx="10" cy="10" r="10" style="fill:red" /> |
| 65 |
<rect x="10" y="10" width="15" height="15" style="fill:green"/> |
| 66 |
</pattern> |
| 67 |
|
| 68 |
<!-- ============================================== --> |
| 69 |
<!-- patternUnits : userSpaceOnUse --> |
| 70 |
<!-- patternContentUnits : default (userSpaceOnUse) --> |
| 71 |
<!-- viewBox : default (none) --> |
| 72 |
<!-- ============================================== --> |
| 73 |
<pattern id="pattern3" |
| 74 |
patternUnits="userSpaceOnUse" |
| 75 |
x="0" y="0" width="30" height="15" overflow="visible"> |
| 76 |
<circle cx="10" cy="10" r="10" style="fill:red" /> |
| 77 |
<rect x="10" y="10" width="15" height="15" style="fill:green"/> |
| 78 |
</pattern> |
| 79 |
|
| 80 |
<!-- ============================================== --> |
| 81 |
<!-- patternUnits : default (objectBoundingBox) --> |
| 82 |
<!-- patternContentUnits : objectBoundingBox --> |
| 83 |
<!-- viewBox : default (none) --> |
| 84 |
<!-- ============================================== --> |
| 85 |
<pattern id="pattern4" |
| 86 |
patternContentUnits="objectBoundingBox" |
| 87 |
x="0" y="0" width=".75" height=".5" overflow="visible"> |
| 88 |
<circle cx="0.0556%" cy=".33333333" r=".25" style="fill:red" /> |
| 89 |
<rect x=".25" y=".33333333" width="0.375" height=".5" style="fill:green"/> |
| 90 |
</pattern> |
| 91 |
|
| 92 |
<!-- ============================================== --> |
| 93 |
<!-- patternUnits : objectBoundingBox --> |
| 94 |
<!-- patternContentUnits : objectBoundingBox --> |
| 95 |
<!-- viewBox : default (none) --> |
| 96 |
<!-- ============================================== --> |
| 97 |
<pattern id="pattern5" |
| 98 |
patternUnits="objectBoundingBox" |
| 99 |
patternContentUnits="objectBoundingBox" |
| 100 |
x="0" y="0" width=".75" height=".5"> |
| 101 |
<circle cx=".25" cy=".33333333" r=".25" style="fill:red" /> |
| 102 |
<rect x=".25" y=".33333333" width="0.375" height=".5" style="fill:green"/> |
| 103 |
</pattern> |
| 104 |
|
| 105 |
<!-- ============================================== --> |
| 106 |
<!-- patternUnits : userSpaceOnUse --> |
| 107 |
<!-- patternContentUnits : objectBoundingBox --> |
| 108 |
<!-- viewBox : default (none) --> |
| 109 |
<!-- ============================================== --> |
| 110 |
<pattern id="pattern6" |
| 111 |
patternUnits="userSpaceOnUse" |
| 112 |
patternContentUnits="objectBoundingBox" |
| 113 |
x="0" y="0" width="30" height="15"> |
| 114 |
<circle cx=".25" cy=".33333333" r=".25" style="fill:red" /> |
| 115 |
<rect x=".25" y=".33333333" width="0.375" height=".5" style="fill:green"/> |
| 116 |
</pattern> |
| 117 |
|
| 118 |
<!-- ============================================== --> |
| 119 |
<!-- patternUnits : userSpaceOnUse --> |
| 120 |
<!-- patternContentUnits : objectBoundingBox --> |
| 121 |
<!-- viewBox : set --> |
| 122 |
<!-- Note patternContentUnits is ignored if viewBox --> |
| 123 |
<!-- is set. --> |
| 124 |
<!-- ============================================== --> |
| 125 |
<pattern id="pattern7" |
| 126 |
patternUnits="userSpaceOnUse" |
| 127 |
patternContentUnits="objectBoundingBox" |
| 128 |
x="0" y="0" width="30" height="15" |
| 129 |
viewBox="10 10 40 30" preserveAspectRatio="none"> |
| 130 |
<circle cx="20" cy="20" r="20" style="fill:red" /> |
| 131 |
</pattern> |
| 132 |
|
| 133 |
<!-- ============================================== --> |
| 134 |
<!-- patternUnits : userSpaceOnUse --> |
| 135 |
<!-- patternContentUnits : objectBoundingBox --> |
| 136 |
<!-- viewBox : set --> |
| 137 |
<!-- Note patternContentUnits is ignored if viewBox --> |
| 138 |
<!-- is set. --> |
| 139 |
<!-- ============================================== --> |
| 140 |
<pattern id="pattern8" |
| 141 |
patternUnits="userSpaceOnUse" |
| 142 |
patternContentUnits="objectBoundingBox" |
| 143 |
x="0" y="0" width="30" height="15" |
| 144 |
viewBox="10 10 40 30" preserveAspectRatio="xMinYMin meet"> |
| 145 |
<circle cx="20" cy="20" r="20" style="fill:red" /> |
| 146 |
</pattern> |
| 147 |
|
| 148 |
<radialGradient id="redToYellow" > |
| 149 |
<stop offset="0" stop-color="red" /> |
| 150 |
<stop offset="1" stop-color="yellow" /> |
| 151 |
</radialGradient> |
| 152 |
|
| 153 |
<!-- ============================================== --> |
| 154 |
<!-- patternUnits : userSpaceOnUse --> |
| 155 |
<!-- patternContentUnits : userSpaceOnUse --> |
| 156 |
<!-- viewBox : set --> |
| 157 |
<!-- Note patternContentUnits is ignored if viewBox --> |
| 158 |
<!-- is set. --> |
| 159 |
<!-- ============================================== --> |
| 160 |
<pattern id="pattern9" |
| 161 |
patternUnits="userSpaceOnUse" |
| 162 |
patternContentUnits="objectBoundingBox" overflow="visible" |
| 163 |
x="0" y="0" width="30" height="15" viewBox="10 10 40 40" preserveAspectRatio="xMinYMin slice"> |
| 164 |
<circle cx="20" cy="20" r="40" style="fill:url(#redToYellow)" /> |
| 165 |
</pattern> |
| 166 |
|
| 167 |
</defs> |
| 168 |
|
| 169 |
<g transform="translate(-5, 100)"> |
| 170 |
|
| 171 |
<g id="p1" transform="translate(20, 20)"> |
| 172 |
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern1); stroke:black;"/> |
| 173 |
<text y="-2">#pattern1</text> |
| 174 |
<g transform="translate(50, 9)"> |
| 175 |
<text x="0" y="0">patternUnits=default</text> |
| 176 |
<text x="0" y="10">contentUnits=default</text> |
| 177 |
<text x="0" y="20">no viewbox</text> |
| 178 |
</g> |
| 179 |
</g> |
| 180 |
|
| 181 |
<g id="p2" transform="translate(20, 70)"> |
| 182 |
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern2); stroke:black;"/> |
| 183 |
<text y="-2">#pattern2</text> |
| 184 |
<g transform="translate(50, 9)"> |
| 185 |
<text x="0" y="0">patternUnits=objectBoundingBox</text> |
| 186 |
<text x="0" y="10">contentUnits=default</text> |
| 187 |
</g> |
| 188 |
</g> |
| 189 |
|
| 190 |
<g id="p3" transform="translate(20, 120)"> |
| 191 |
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern3); stroke:black;"/> |
| 192 |
<text y="-2">#pattern3</text> |
| 193 |
<g transform="translate(50, 9)"> |
| 194 |
<text>patternUnits=userSpaceOnUse</text> |
| 195 |
<text y="10">contentUnits=default</text> |
| 196 |
<text y="20">overflow=visible</text> |
| 197 |
</g> |
| 198 |
</g> |
| 199 |
|
| 200 |
<g id="p4" transform="translate(20, 170)"> |
| 201 |
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern4); stroke:black;"/> |
| 202 |
<text y="-2">#pattern4</text> |
| 203 |
<g transform="translate(50, 9)"> |
| 204 |
<text>patternUnits=default</text> |
| 205 |
<text y="10">contentUnits=objectBoundingBox</text> |
| 206 |
<text y="20">overflow=visible</text> |
| 207 |
</g> |
| 208 |
</g> |
| 209 |
|
| 210 |
<g id="p5" transform="translate(20, 220)"> |
| 211 |
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern5); stroke:black;"/> |
| 212 |
<text y="-2">#pattern5</text> |
| 213 |
<g transform="translate(50, 9)"> |
| 214 |
<text>patternUnits=objectBoundingBox</text> |
| 215 |
<text y="10">contentUnits=objectBoundingBox</text> |
| 216 |
</g> |
| 217 |
</g> |
| 218 |
|
| 219 |
<g id="p6" transform="translate(20, 270)"> |
| 220 |
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern6); stroke:black;"/> |
| 221 |
<text y="-2">#pattern6</text> |
| 222 |
<g transform="translate(50, 9)"> |
| 223 |
<text>patternUnits=userSpaceOnUse</text> |
| 224 |
<text y="10">contentUnits=objectBoundingBox</text> |
| 225 |
</g> |
| 226 |
</g> |
| 227 |
|
| 228 |
<g id="p7" transform="translate(225, 20)"> |
| 229 |
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern7); stroke:black;"/> |
| 230 |
<text y="-2">#pattern7</text> |
| 231 |
<g transform="translate(50, 9)"> |
| 232 |
<text>patternUnits=userSpaceOnUse</text> |
| 233 |
<text y="10">contentUnits=objectBoundingBox</text> |
| 234 |
<text y="20">viewBox preserveAspectRatio=none</text> |
| 235 |
</g> |
| 236 |
</g> |
| 237 |
|
| 238 |
<g id="p8" transform="translate(225, 70)"> |
| 239 |
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern8); stroke:black;"/> |
| 240 |
<text y="-2" >#pattern8</text> |
| 241 |
<g transform="translate(50, 9)"> |
| 242 |
<text>same as pattern#7 with</text> |
| 243 |
<text y="10">preserveAspectRatio=xMinYmin meet</text> |
| 244 |
</g> |
| 245 |
</g> |
| 246 |
|
| 247 |
<g id="p9" transform="translate(225, 120)"> |
| 248 |
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern9); stroke:black;"/> |
| 249 |
<text y="-2" >#pattern9</text> |
| 250 |
<g transform="translate(50, 9)"> |
| 251 |
<text y="0">preserveAspectRatio=xMinYmin slice</text> |
| 252 |
<text y="10">overflow=visible</text> |
| 253 |
</g> |
| 254 |
</g> |
| 255 |
|
| 256 |
</g> |
| 257 |
</g> |
| 258 |
<!-- ============================================================= --> |
| 259 |
<!-- Batik sample mark --> |
| 260 |
<!-- ============================================================= --> |
| 261 |
<use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" /> |
| 262 |
|
| 263 |
</svg> |