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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
|
<?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.
-->
<!-- ========================================================================= -->
<!-- This test file checks that the various combinations of units and viewbox -->
<!-- work in Batik for patternRegions -->
<!-- -->
<!-- @author vhardy@eng.sun.com -->
<!-- @version $Id$ -->
<!-- ========================================================================= -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
<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">
<title>Pattern Region Test, A</title>
<text x="225" y="50" class="title">
patternRegion, x, y, width, height
</text>
<!-- ============================================================= -->
<!-- Test content -->
<!-- ============================================================= -->
<g id="testContent" >
<defs>
<!-- ============================================== -->
<!-- The patterns in this test is always the same, -->
<!-- and the various values for the patternRegion -->
<!-- select different areas for that pattern. -->
<!-- ============================================== -->
<g id="patternContent" stroke="none" opacity="1">
<rect x="0" y="0" width="20" height="20" fill="black" />
<g fill="crimson">
<rect width="5" height="5" />
<rect x="5" y="5" width="5" height="5" />
</g>
<g fill="yellow" transform="translate(10, 0)">
<rect width="5" height="5" />
<rect x="5" y="5" width="5" height="5" />
</g>
<g fill="white" transform="translate(0, 10)">
<rect width="5" height="5" />
<rect x="5" y="5" width="5" height="5" />
</g>
<g fill="rgb(100, 100, 255)" transform="translate(10, 10)">
<rect width="5" height="5" />
<rect x="5" y="5" width="5" height="5" />
</g>
</g>
<!-- ============================================== -->
<!-- For all the following patterns: -->
<!-- -->
<!-- patternUnits : default (objectBoundingBox) -->
<!-- patternContentUnits : default (userSpaceOnUse) -->
<!-- patternTransform: default (identity) -->
<!-- viewBox : default (none) -->
<!-- preserveAspectRatio: default -->
<!-- overflow : default (hidden) -->
<!-- ============================================== -->
<!-- ============================================== -->
<!-- The pattern content fits exactly in the -->
<!-- pattern region. -->
<!-- .2 * 100 = 20 userSpaceUnits -->
<!-- .4 * 50 = 20 userSpaceUnits -->
<!-- ============================================== -->
<pattern id="patternExactFit" x="0" y="0" width=".2" height=".4">
<use xlink:href="#patternContent" />
</pattern>
<!-- ============================================== -->
<!-- The pattern content is offset along the x axis -->
<!-- .2 * 100 = 20 userSpaceUnits -->
<!-- .4 * 50 = 20 userSpaceUnits -->
<!-- ============================================== -->
<pattern id="patternTranslateRegionX"
x="-.05" y="0"
width=".2" height=".4" >
<use xlink:href="#patternContent" />
</pattern>
<!-- ============================================== -->
<!-- The pattern content is offset along the y axis -->
<!-- .2 * 100 = 20 userSpaceUnits -->
<!-- .4 * 50 = 20 userSpaceUnits -->
<!-- ============================================== -->
<pattern id="patternTranslateRegionY"
x="0" y="-.1"
width=".2" height=".4" >
<use xlink:href="#patternContent" />
</pattern>
<!-- ============================================== -->
<!-- The pattern content is offset along the both -->
<!-- both axis. -->
<!-- .2 * 100 = 20 userSpaceUnits -->
<!-- .4 * 50 = 20 userSpaceUnits -->
<!-- ============================================== -->
<pattern id="patternTranslateRegionXY"
x=".1" y=".2"
width=".2" height=".4" >
<use xlink:href="#patternContent" />
</pattern>
<!-- ============================================== -->
<!-- The pattern content width smaller width than -->
<!-- pattern region. -->
<!-- .4 * 100 = 40 userSpaceUnits -->
<!-- .4 * 50 = 20 userSpaceUnits -->
<!-- ============================================== -->
<pattern id="patternWiderRegion"
x="0" y="0"
width=".4" height=".4" >
<use xlink:href="#patternContent" />
</pattern>
<!-- ============================================== -->
<!-- The pattern content height smaller than -->
<!-- pattern region. -->
<!-- .2 * 100 = 20 userSpaceUnits -->
<!-- .8 * 50 = 40 userSpaceUnits -->
<!-- ============================================== -->
<pattern id="patternHigherRegion"
x="0" y="0"
width=".2" height=".8" >
<use xlink:href="#patternContent" />
</pattern>
<!-- ============================================== -->
<!-- The pattern content width and height smaller -->
<!-- than pattern region. -->
<!-- .4 * 100 = 40 userSpaceUnits -->
<!-- .8 * 50 = 40 userSpaceUnits -->
<!-- ============================================== -->
<pattern id="patternWiderHigherRegion"
x="0" y="0"
width=".4" height=".8" >
<use xlink:href="#patternContent" />
</pattern>
</defs>
<g transform="translate(30, 90)" >
<text class="legend" style="text-anchor:start" x="0" y="-5">Pattern (4 times actual size)</text>
<use xlink:href="#patternContent" transform="scale(4, 4)" />
</g>
<g transform="translate(30, 200)">
<g>
<text class="legend" style="text-anchor:start" x="0" y="-5">Exact Fit in patternRegion</text>
<rect x="0" y="0" width="100" height="50" fill="url(#patternExactFit)" stroke="black"/>
<rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" />
</g>
<g transform="translate(0, 70)">
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion offset to the left</text>
<rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionX)" stroke="black"/>
<rect x="-5" y="0" width="20" height="20" stroke="white" fill-opacity=".12"/>
</g>
<g transform="translate(0, 140)">
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion offset to the top</text>
<rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionY)" stroke="black"/>
<rect x="0" y="-5" width="20" height="20" stroke="white" fill-opacity=".12" />
</g>
<g transform="translate(0, 210)">
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion offset to the top/left</text>
<rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionXY)" stroke="black"/>
<rect x="10" y="10" width="20" height="20" stroke="white" fill-opacity=".12" />
</g>
</g>
<g transform="translate(255, 200)">
<g>
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion wider than content</text>
<rect x="0" y="0" width="100" height="50" fill="url(#patternWiderRegion)" stroke="black"/>
<rect x="0" y="0" width="40" height="20" stroke="white" fill-opacity=".12" />
</g>
<g transform="translate(0, 70)">
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion higher than content</text>
<rect x="0" y="0" width="100" height="50" fill="url(#patternHigherRegion)" stroke="black"/>
<rect x="0" y="0" width="20" height="40" stroke="white" fill-opacity=".12" />
</g>
<g transform="translate(0, 140)">
<text class="legend" style="text-anchor:start" x="0" y="-5">patternRegion higher than content</text>
<rect x="0" y="0" width="100" height="50" fill="url(#patternWiderHigherRegion)" stroke="black"/>
<rect x="0" y="0" width="40" height="40" stroke="white" fill-opacity=".12" />
</g>
</g>
</g>
<!-- ============================================================= -->
<!-- Batik sample mark -->
<!-- ============================================================= -->
<use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" />
</svg>
|