| 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, B</title> |
| 35 |
|
| 36 |
<text x="225" y="50" class="title"> |
| 37 |
patternRegion, x, y, width, height, viewBox |
| 38 |
</text> |
| 39 |
|
| 40 |
<!-- ============================================================= --> |
| 41 |
<!-- Test content --> |
| 42 |
<!-- ============================================================= --> |
| 43 |
<g id="testContent" > |
| 44 |
<defs> |
| 45 |
|
| 46 |
<!-- ============================================== --> |
| 47 |
<!-- For all the following patterns: --> |
| 48 |
<!-- --> |
| 49 |
<!-- patternUnits : default (objectBoundingBox) --> |
| 50 |
<!-- patternContentUnits : default (userSpaceOnUse) --> |
| 51 |
<!-- patternTransform: default (identity) --> |
| 52 |
<!-- preserveAspectRatio: default (xMidyMid meet) --> |
| 53 |
<!-- overflow : default (hidden) --> |
| 54 |
<!-- --> |
| 55 |
<!-- Because of the default preserveAspectRatio --> |
| 56 |
<!-- value, the following patterns should be --> |
| 57 |
<!-- centered in the pattern region. --> |
| 58 |
<!-- ============================================== --> |
| 59 |
|
| 60 |
<!-- ============================================== --> |
| 61 |
<!-- The pattern content fits exactly in the --> |
| 62 |
<!-- pattern region. --> |
| 63 |
<!-- .2 * 100 = 20 userSpaceUnits --> |
| 64 |
<!-- .4 * 50 = 20 userSpaceUnits --> |
| 65 |
<!-- viewBox matches the pattern content's bounds --> |
| 66 |
<!-- ============================================== --> |
| 67 |
<pattern id="patternExactFit" x="0" y="0" width=".2" height=".4" |
| 68 |
viewBox="0 0 20 20"> |
| 69 |
<use xlink:href="patternRegionA.svg#patternContent" /> |
| 70 |
</pattern> |
| 71 |
|
| 72 |
<!-- ============================================== --> |
| 73 |
<!-- The pattern content is offset along the x axis --> |
| 74 |
<!-- .2 * 100 = 20 userSpaceUnits --> |
| 75 |
<!-- .4 * 50 = 20 userSpaceUnits --> |
| 76 |
<!-- viewBox is offset to the left. This causes the --> |
| 77 |
<!-- pattern content to be translated to the right --> |
| 78 |
<!-- when centered in the viewPort. --> |
| 79 |
<!-- ============================================== --> |
| 80 |
<pattern id="patternTranslateRegionX" |
| 81 |
x="0" y="0" |
| 82 |
width=".2" height=".4" |
| 83 |
viewBox="-5 0 20 20" overflow="hidden"> |
| 84 |
<use xlink:href="patternRegionA.svg#patternContent" /> |
| 85 |
</pattern> |
| 86 |
|
| 87 |
<!-- ============================================== --> |
| 88 |
<!-- The pattern content is offset along the y axis --> |
| 89 |
<!-- .2 * 100 = 20 userSpaceUnits --> |
| 90 |
<!-- .4 * 50 = 20 userSpaceUnits --> |
| 91 |
<!-- viewBox is offset to the top. This causes the --> |
| 92 |
<!-- pattern content to be translated to the bottom --> |
| 93 |
<!-- when centered in the viewPort. --> |
| 94 |
<!-- ============================================== --> |
| 95 |
<pattern id="patternTranslateRegionY" |
| 96 |
x="0" y="0" |
| 97 |
width=".2" height=".4" |
| 98 |
viewBox="0 -5 20 20"> |
| 99 |
<use xlink:href="patternRegionA.svg#patternContent" /> |
| 100 |
</pattern> |
| 101 |
|
| 102 |
<!-- ============================================== --> |
| 103 |
<!-- The pattern content is offset along the both --> |
| 104 |
<!-- both axis. --> |
| 105 |
<!-- .2 * 100 = 20 userSpaceUnits --> |
| 106 |
<!-- .4 * 50 = 20 userSpaceUnits --> |
| 107 |
<!-- viewBox is offset to the top/left. This causes --> |
| 108 |
<!-- the pattern content to be translated to the --> |
| 109 |
<!-- bottom when centered in the viewPort. --> |
| 110 |
<!-- ============================================== --> |
| 111 |
<pattern id="patternTranslateRegionXY" |
| 112 |
x="0" y="0" |
| 113 |
width=".2" height=".4" |
| 114 |
viewBox="-10 -10 20 20"> |
| 115 |
<use xlink:href="patternRegionA.svg#patternContent" /> |
| 116 |
</pattern> |
| 117 |
|
| 118 |
<!-- ============================================== --> |
| 119 |
<!-- In the following tests, the --> |
| 120 |
<!-- preserveAspectRatio attribute is set to none. --> |
| 121 |
<!-- ============================================== --> |
| 122 |
|
| 123 |
<!-- ============================================== --> |
| 124 |
<!-- The pattern content fits exactly in the --> |
| 125 |
<!-- pattern region. --> |
| 126 |
<!-- .2 * 100 = 20 userSpaceUnits --> |
| 127 |
<!-- .4 * 50 = 20 userSpaceUnits --> |
| 128 |
<!-- viewBox matches the pattern content's bounds --> |
| 129 |
<!-- ============================================== --> |
| 130 |
<pattern id="patternExactFitPANone" x="0" y="0" width=".2" height=".4" |
| 131 |
viewBox="0 0 20 20" |
| 132 |
preserveAspectRatio="none"> |
| 133 |
<use xlink:href="patternRegionA.svg#patternContent" /> |
| 134 |
</pattern> |
| 135 |
|
| 136 |
<!-- ============================================== --> |
| 137 |
<!-- Half of the pattern content is stretched along --> |
| 138 |
<!-- the x axis. --> |
| 139 |
<!-- .2 * 100 = 20 userSpaceUnits --> |
| 140 |
<!-- .4 * 50 = 20 userSpaceUnits --> |
| 141 |
<!-- ============================================== --> |
| 142 |
<pattern id="patternStretchX" |
| 143 |
x="0" y="0" |
| 144 |
width=".2" height=".4" |
| 145 |
viewBox="5 0 10 20" |
| 146 |
preserveAspectRatio="none"> |
| 147 |
<use xlink:href="patternRegionA.svg#patternContent" /> |
| 148 |
</pattern> |
| 149 |
|
| 150 |
<!-- ============================================== --> |
| 151 |
<!-- Half of the pattern content is stretched along --> |
| 152 |
<!-- the y axis. --> |
| 153 |
<!-- ============================================== --> |
| 154 |
<pattern id="patternStretchY" |
| 155 |
x="0" y="0" |
| 156 |
width=".2" height=".4" |
| 157 |
viewBox="0 5 20 10" |
| 158 |
preserveAspectRatio="none"> |
| 159 |
<use xlink:href="patternRegionA.svg#patternContent" /> |
| 160 |
</pattern> |
| 161 |
|
| 162 |
<!-- ============================================== --> |
| 163 |
<!-- The pattern content is stretched along both --> |
| 164 |
<!-- axis. --> |
| 165 |
<!-- ============================================== --> |
| 166 |
<pattern id="patternStretchXY" |
| 167 |
x="0" y="0" |
| 168 |
width=".2" height=".4" |
| 169 |
viewBox="5 5 10 10" |
| 170 |
preserveAspectRatio="none"> |
| 171 |
<use xlink:href="patternRegionA.svg#patternContent" /> |
| 172 |
</pattern> |
| 173 |
|
| 174 |
</defs> |
| 175 |
|
| 176 |
<g transform="translate(30, 90)" > |
| 177 |
<text class="legend" style="text-anchor:start" x="0" y="-5">Pattern (4 times actual size)</text> |
| 178 |
<use xlink:href="patternRegionA.svg#patternContent" transform="scale(4, 4)" /> |
| 179 |
</g> |
| 180 |
|
| 181 |
<g transform="translate(30, 200)"> |
| 182 |
|
| 183 |
<g> |
| 184 |
<text class="legend" style="text-anchor:start" x="0" y="-5">Exact Fit in patternRegion</text> |
| 185 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternExactFit)" stroke="black"/> |
| 186 |
<rect x="0" y="0" width="20" height="20" stroke="white" fill="none" /> |
| 187 |
</g> |
| 188 |
|
| 189 |
<g transform="translate(0, 70)"> |
| 190 |
<text class="legend" style="text-anchor:start" x="0" y="-5">pattern content offset to the right</text> |
| 191 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionX)" stroke="black"/> |
| 192 |
<rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" stroke-width="3"/> |
| 193 |
<rect x="5" y="0" width="15" height="20" stroke="red" fill="none"/> |
| 194 |
</g> |
| 195 |
|
| 196 |
<g transform="translate(0, 140)"> |
| 197 |
<text class="legend" style="text-anchor:start" x="0" y="-5">pattern content offset to the bottom</text> |
| 198 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionY)" stroke="black"/> |
| 199 |
<rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" stroke-width="3"/> |
| 200 |
<rect x="0" y="5" width="20" height="15" stroke="red" fill="none"/> |
| 201 |
</g> |
| 202 |
|
| 203 |
<g transform="translate(0, 210)"> |
| 204 |
<text class="legend" style="text-anchor:start" x="0" y="-5">pattern content offset to the bottom/right</text> |
| 205 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionXY)" stroke="black"/> |
| 206 |
<rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" stroke-width="3"/> |
| 207 |
<rect x="10" y="10" width="10" height="10" stroke="red" fill="none"/> |
| 208 |
</g> |
| 209 |
|
| 210 |
</g> |
| 211 |
|
| 212 |
<g transform="translate(255, 200)"> |
| 213 |
<g> |
| 214 |
<text class="legend" style="text-anchor:start" x="0" y="-5">Exact Fit in patternRegion</text> |
| 215 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternExactFitPANone)" stroke="black"/> |
| 216 |
<rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" /> |
| 217 |
</g> |
| 218 |
|
| 219 |
<g transform="translate(0, 70)"> |
| 220 |
<text class="legend" style="text-anchor:start" x="0" y="-5">pattern content X stretch</text> |
| 221 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternStretchX)" stroke="black"/> |
| 222 |
<rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" /> |
| 223 |
</g> |
| 224 |
|
| 225 |
<g transform="translate(0, 140)"> |
| 226 |
<text class="legend" style="text-anchor:start" x="0" y="-5">pattern content Y stretch</text> |
| 227 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternStretchY)" stroke="black"/> |
| 228 |
<rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" /> |
| 229 |
</g> |
| 230 |
|
| 231 |
<g transform="translate(0, 210)"> |
| 232 |
<text class="legend" style="text-anchor:start" x="0" y="-5">pattern content X/Y stretch</text> |
| 233 |
<rect x="0" y="0" width="100" height="50" fill="url(#patternStretchXY)" stroke="black"/> |
| 234 |
<rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" /> |
| 235 |
</g> |
| 236 |
</g> |
| 237 |
|
| 238 |
</g> |
| 239 |
|
| 240 |
<!-- ============================================================= --> |
| 241 |
<!-- Batik sample mark --> |
| 242 |
<!-- ============================================================= --> |
| 243 |
<use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" /> |
| 244 |
|
| 245 |
</svg> |