| 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 Region Test, A</title> |
| 35 |
|
| 36 |
<text x="225" y="50" class="title"> |
| 37 |
patternRegion, x, y, width, height |
| 38 |
</text> |
| 39 |
|
| 40 |
<!-- ============================================================= --> |
| 41 |
<!-- Test content --> |
| 42 |
<!-- ============================================================= --> |
| 43 |
<g id="testContent" > |
| 44 |
<defs> |
| 45 |
|
| 46 |
<!-- ============================================== --> |
| 47 |
<!-- The patterns in this test is always the same, --> |
| 48 |
<!-- and the various values for the patternRegion --> |
| 49 |
<!-- select different areas for that pattern. --> |
| 50 |
<!-- ============================================== --> |
| 51 |
<g id="patternContent" stroke="none" opacity="1"> |
| 52 |
<rect x="0" y="0" width="20" height="20" fill="black" /> |
| 53 |
|
| 54 |
<g fill="crimson"> |
| 55 |
<rect width="5" height="5" /> |
| 56 |
<rect x="5" y="5" width="5" height="5" /> |
| 57 |
</g> |
| 58 |
<g fill="yellow" transform="translate(10, 0)"> |
| 59 |
<rect width="5" height="5" /> |
| 60 |
<rect x="5" y="5" width="5" height="5" /> |
| 61 |
</g> |
| 62 |
<g fill="white" transform="translate(0, 10)"> |
| 63 |
<rect width="5" height="5" /> |
| 64 |
<rect x="5" y="5" width="5" height="5" /> |
| 65 |
</g> |
| 66 |
<g fill="rgb(100, 100, 255)" transform="translate(10, 10)"> |
| 67 |
<rect width="5" height="5" /> |
| 68 |
<rect x="5" y="5" width="5" height="5" /> |
| 69 |
</g> |
| 70 |
</g> |
| 71 |
|
| 72 |
|
| 73 |
<!-- ============================================== --> |
| 74 |
<!-- For all the following patterns: --> |
| 75 |
<!-- --> |
| 76 |
<!-- patternUnits : default (objectBoundingBox) --> |
| 77 |
<!-- patternContentUnits : default (userSpaceOnUse) --> |
| 78 |
<!-- patternTransform: default (identity) --> |
| 79 |
<!-- viewBox : default (none) --> |
| 80 |
<!-- preserveAspectRatio: default --> |
| 81 |
<!-- overflow : default (hidden) --> |
| 82 |
<!-- ============================================== --> |
| 83 |
|
| 84 |
<!-- ============================================== --> |
| 85 |
<!-- The pattern content fits exactly in the --> |
| 86 |
<!-- pattern region. --> |
| 87 |
<!-- .2 * 100 = 20 userSpaceUnits --> |
| 88 |
<!-- .4 * 50 = 20 userSpaceUnits --> |
| 89 |
<!-- ============================================== --> |
| 90 |
<pattern id="patternExactFit" x="0" y="0" width=".2" height=".4"> |
| 91 |
<use xlink:href="#patternContent" /> |
| 92 |
</pattern> |
| 93 |
|
| 94 |
<!-- ============================================== --> |
| 95 |
<!-- The pattern content is offset along the x axis --> |
| 96 |
<!-- .2 * 100 = 20 userSpaceUnits --> |
| 97 |
<!-- .4 * 50 = 20 userSpaceUnits --> |
| 98 |
<!-- ============================================== --> |
| 99 |
<pattern id="patternTranslateRegionX" |
| 100 |
x="-.05" y="0" |
| 101 |
width=".2" height=".4" > |
| 102 |
<use xlink:href="#patternContent" /> |
| 103 |
</pattern> |
| 104 |
|
| 105 |
<!-- ============================================== --> |
| 106 |
<!-- The pattern content is offset along the y axis --> |
| 107 |
<!-- .2 * 100 = 20 userSpaceUnits --> |
| 108 |
<!-- .4 * 50 = 20 userSpaceUnits --> |
| 109 |
<!-- ============================================== --> |
| 110 |
<pattern id="patternTranslateRegionY" |
| 111 |
x="0" y="-.1" |
| 112 |
width=".2" height=".4" > |
| 113 |
<use xlink:href="#patternContent" /> |
| 114 |
</pattern> |
| 115 |
|
| 116 |
<!-- ============================================== --> |
| 117 |
<!-- The pattern content is offset along the both --> |
| 118 |
<!-- both axis. --> |
| 119 |
<!-- .2 * 100 = 20 userSpaceUnits --> |
| 120 |
<!-- .4 * 50 = 20 userSpaceUnits --> |
| 121 |
<!-- ============================================== --> |
| 122 |
<pattern id="patternTranslateRegionXY" |
| 123 |
x=".1" y=".2" |
| 124 |
width=".2" height=".4" > |
| 125 |
<use xlink:href="#patternContent" /> |
| 126 |
</pattern> |
| 127 |
|
| 128 |
<!-- ============================================== --> |
| 129 |
<!-- The pattern content width smaller width than --> |
| 130 |
<!-- pattern region. --> |
| 131 |
<!-- .4 * 100 = 40 userSpaceUnits --> |
| 132 |
<!-- .4 * 50 = 20 userSpaceUnits --> |
| 133 |
<!-- ============================================== --> |
| 134 |
<pattern id="patternWiderRegion" |
| 135 |
x="0" y="0" |
| 136 |
width=".4" height=".4" > |
| 137 |
<use xlink:href="#patternContent" /> |
| 138 |
</pattern> |
| 139 |
|
| 140 |
<!-- ============================================== --> |
| 141 |
<!-- The pattern content height smaller than --> |
| 142 |
<!-- pattern region. --> |
| 143 |
<!-- .2 * 100 = 20 userSpaceUnits --> |
| 144 |
<!-- .8 * 50 = 40 userSpaceUnits --> |
| 145 |
<!-- ============================================== --> |
| 146 |
<pattern id="patternHigherRegion" |
| 147 |
x="0" y="0" |
| 148 |
width=".2" height=".8" > |
| 149 |
<use xlink:href="#patternContent" /> |
| 150 |
</pattern> |
| 151 |
|
| 152 |
<!-- ============================================== --> |
| 153 |
<!-- The pattern content width and height smaller --> |
| 154 |
<!-- than pattern region. --> |
| 155 |
<!-- .4 * 100 = 40 userSpaceUnits --> |
| 156 |
<!-- .8 * 50 = 40 userSpaceUnits --> |
| 157 |
<!-- ============================================== --> |
| 158 |
<pattern id="patternWiderHigherRegion" |
| 159 |
x="0" y="0" |
| 160 |
width=".4" height=".8" > |
| 161 |
<use xlink:href="#patternContent" /> |
| 162 |
</pattern> |
| 163 |
|
| 164 |
</defs> |
| 165 |
|
| 166 |
<g transform="translate(30, 90)" > |
| 167 |
<text class="legend" style="text-anchor:start" x="0" y="-5">Pattern (4 times actual size)</text> |
| 168 |
<use xlink:href="#patternContent" transform="scale(4, 4)" /> |
| 169 |
</g> |
| 170 |
|
| 171 |
<g transform="translate(30, 200)"> |
| 172 |
|
| 173 |
<g> |
| 174 |
<text class="legend" style="text-anchor:start" x="0" y="-5">Exact Fit in patternRegion</text> |
| 175 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternExactFit)" stroke="black"/> |
| 176 |
<rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" /> |
| 177 |
</g> |
| 178 |
|
| 179 |
<g transform="translate(0, 70)"> |
| 180 |
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion offset to the left</text> |
| 181 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionX)" stroke="black"/> |
| 182 |
<rect x="-5" y="0" width="20" height="20" stroke="white" fill-opacity=".12"/> |
| 183 |
</g> |
| 184 |
|
| 185 |
<g transform="translate(0, 140)"> |
| 186 |
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion offset to the top</text> |
| 187 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionY)" stroke="black"/> |
| 188 |
<rect x="0" y="-5" width="20" height="20" stroke="white" fill-opacity=".12" /> |
| 189 |
</g> |
| 190 |
|
| 191 |
<g transform="translate(0, 210)"> |
| 192 |
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion offset to the top/left</text> |
| 193 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionXY)" stroke="black"/> |
| 194 |
<rect x="10" y="10" width="20" height="20" stroke="white" fill-opacity=".12" /> |
| 195 |
</g> |
| 196 |
|
| 197 |
</g> |
| 198 |
|
| 199 |
<g transform="translate(255, 200)"> |
| 200 |
|
| 201 |
<g> |
| 202 |
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion wider than content</text> |
| 203 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternWiderRegion)" stroke="black"/> |
| 204 |
<rect x="0" y="0" width="40" height="20" stroke="white" fill-opacity=".12" /> |
| 205 |
</g> |
| 206 |
|
| 207 |
<g transform="translate(0, 70)"> |
| 208 |
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion higher than content</text> |
| 209 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternHigherRegion)" stroke="black"/> |
| 210 |
<rect x="0" y="0" width="20" height="40" stroke="white" fill-opacity=".12" /> |
| 211 |
</g> |
| 212 |
|
| 213 |
<g transform="translate(0, 140)"> |
| 214 |
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion higher than content</text> |
| 215 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternWiderHigherRegion)" stroke="black"/> |
| 216 |
<rect x="0" y="0" width="40" height="40" stroke="white" fill-opacity=".12" /> |
| 217 |
</g> |
| 218 |
</g> |
| 219 |
|
| 220 |
</g> |
| 221 |
|
| 222 |
<!-- ============================================================= --> |
| 223 |
<!-- Batik sample mark --> |
| 224 |
<!-- ============================================================= --> |
| 225 |
<use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" /> |
| 226 |
|
| 227 |
</svg> |