blob: 0db19cdd08d1bd6bbb8b1c60e4ee0559901cccf4 [file] [log] [blame]
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
<!-- ========================================================================= -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software License -->
<!-- version 1.1, a copy of which has been included with this distribution in -->
<!-- the LICENSE file. -->
<!-- ========================================================================= -->
<!-- ========================================================================= -->
<!-- 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="test.css" ?>
<svg id="body" width="450" height="500" viewBox="0 0 450 500">
<title>Pattern Tests</title>
<text x="225" y="50" class="title">
patternUnits / patternContentUnits
</text>
<text x="225" y="75" class="title">
pattern viewBox
</text>
<!-- ============================================================= -->
<!-- Test content -->
<!-- ============================================================= -->
<g id="testContent" style="font-size:10">
<defs>
<!-- ============================================== -->
<!-- patternUnits : default (objectBoundingBox) -->
<!-- patternContentUnits : default (userSpaceOnUse) -->
<!-- viewBox : default (none) -->
<!-- ============================================== -->
<pattern id="pattern1" x="0" y="0" width=".75" height="50%">
<circle cx="10" cy="10" r="10" style="fill:red" />
<rect x="10" y="10" width="15" height="15" style="fill:green"/>
</pattern>
<!-- ============================================== -->
<!-- patternUnits : objectBoundingBox -->
<!-- patternContentUnits : default (userSpaceOnUse) -->
<!-- viewBox : default (none) -->
<!-- ============================================== -->
<pattern id="pattern2" patternUnits="objectBoundingBox" x="0" y="0" width=".75" height=".5">
<circle cx="10" cy="10" r="10" style="fill:red" />
<rect x="10" y="10" width="15" height="15" style="fill:green"/>
</pattern>
<!-- ============================================== -->
<!-- patternUnits : userSpaceOnUse -->
<!-- patternContentUnits : default (userSpaceOnUse) -->
<!-- viewBox : default (none) -->
<!-- ============================================== -->
<pattern id="pattern3"
patternUnits="userSpaceOnUse"
x="0" y="0" width="30" height="15" overflow="visible">
<circle cx="10" cy="10" r="10" style="fill:red" />
<rect x="2.22222%" y="10" width="15" height="3%" style="fill:green"/>
</pattern>
<!-- ============================================== -->
<!-- patternUnits : default (objectBoundingBox) -->
<!-- patternContentUnits : objectBoundingBox -->
<!-- viewBox : default (none) -->
<!-- ============================================== -->
<pattern id="pattern4"
patternContentUnits="objectBoundingBox"
x="0" y="0" width=".75" height=".5" overflow="visible">
<circle cx="25%" cy=".33333333" r=".25" style="fill:red" />
<rect x=".25" y=".33333333" width="0.375" height=".5" style="fill:green"/>
</pattern>
<!-- ============================================== -->
<!-- patternUnits : objectBoundingBox -->
<!-- patternContentUnits : objectBoundingBox -->
<!-- viewBox : default (none) -->
<!-- ============================================== -->
<pattern id="pattern5"
patternUnits="objectBoundingBox"
patternContentUnits="objectBoundingBox"
x="0" y="0" width=".75" height=".5">
<circle cx=".25" cy=".33333333" r=".25" style="fill:red" />
<rect x=".25" y=".33333333" width="0.375" height=".5" style="fill:green"/>
</pattern>
<!-- ============================================== -->
<!-- patternUnits : userSpaceOnUse -->
<!-- patternContentUnits : objectBoundingBox -->
<!-- viewBox : default (none) -->
<!-- ============================================== -->
<pattern id="pattern6"
patternUnits="userSpaceOnUse"
patternContentUnits="objectBoundingBox"
x="0" y="0" width="30" height="15">
<circle cx=".25" cy=".33333333" r=".25" style="fill:red" />
<rect x=".25" y=".33333333" width="0.375" height=".5" style="fill:green"/>
</pattern>
<!-- ============================================== -->
<!-- patternUnits : userSpaceOnUse -->
<!-- patternContentUnits : userSpaceOnUse -->
<!-- viewBox : set -->
<!-- ============================================== -->
<pattern id="pattern7"
patternUnits="userSpaceOnUse"
patternContentUnits="objectBoundingBox"
x="0" y="0" width="30" height="15" viewBox="10 10 40 40" preserveAspectRatio="none">
<circle cx="30" cy="30" r="20" style="fill:red" />
</pattern>
<!-- ============================================== -->
<!-- patternUnits : userSpaceOnUse -->
<!-- patternContentUnits : userSpaceOnUse -->
<!-- viewBox : set -->
<!-- ============================================== -->
<pattern id="pattern8"
patternUnits="userSpaceOnUse"
patternContentUnits="objectBoundingBox"
x="0" y="0" width="30" height="15" viewBox="10 10 40 40" preserveAspectRatio="xMinYMin meet">
<circle cx="30" cy="30" r="20" style="fill:red" />
</pattern>
<linearGradient id="redToYellow" x1="30" y1="5" x2="30" y2="55" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="red" />
<stop offset=".5" stop-color="yellow" />
</linearGradient>
<!-- ============================================== -->
<!-- patternUnits : userSpaceOnUse -->
<!-- patternContentUnits : userSpaceOnUse -->
<!-- viewBox : set -->
<!-- ============================================== -->
<pattern id="pattern9"
patternUnits="userSpaceOnUse"
patternContentUnits="objectBoundingBox" overflow="visible"
x="0" y="0" width="30" height="15" viewBox="10 10 40 40" preserveAspectRatio="xMinYMin slice">
<circle cx="30" cy="30" r="25" style="fill:url(#redToYellow)" />
</pattern>
</defs>
<g transform="translate(-5, 100)">
<g id="p1" transform="translate(20, 20)">
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern1); stroke:black;"/>
<text y="-2">#pattern1</text>
<g transform="translate(50, 9)">
<text x="0" y="0">patternUnits=default</text>
<text x="0" y="10">contentUnits=default</text>
<text x="0" y="20">no viewbox</text>
</g>
</g>
<g id="p2" transform="translate(20, 70)">
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern2); stroke:black;"/>
<text y="-2">#pattern2</text>
<g transform="translate(50, 9)">
<text x="0" y="0">patternUnits=objectBoundingBox</text>
<text x="0" y="10">contentUnits=default</text>
</g>
</g>
<g id="p3" transform="translate(20, 120)">
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern3); stroke:black;"/>
<text y="-2">#pattern3</text>
<g transform="translate(50, 9)">
<text>patternUnits=userSpaceOnUse</text>
<text y="10">contentUnits=default</text>
<text y="20">overflow=visible</text>
</g>
</g>
<g id="p4" transform="translate(20, 170)">
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern4); stroke:black;"/>
<text y="-2">#pattern4</text>
<g transform="translate(50, 9)">
<text>patternUnits=default</text>
<text y="10">contentUnits=objectBoundingBox</text>
<text y="20">overflow=visible</text>
</g>
</g>
<g id="p5" transform="translate(20, 220)">
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern5); stroke:black;"/>
<text y="-2">#pattern5</text>
<g transform="translate(50, 9)">
<text>patternUnits=objectBoundingBox</text>
<text y="10">contentUnits=objectBoundingBox</text>
</g>
</g>
<g id="p6" transform="translate(20, 270)">
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern6); stroke:black;"/>
<text y="-2">#pattern6</text>
<g transform="translate(50, 9)">
<text>patternUnits=userSpaceOnUse</text>
<text y="10">contentUnits=objectBoundingBox</text>
</g>
</g>
<g id="p7" transform="translate(225, 20)">
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern7); stroke:black;"/>
<text y="-2">#pattern7</text>
<g transform="translate(50, 9)">
<text>patternUnits=userSpaceOnUse</text>
<text y="10">contentUnits=objectBoundingBox</text>
<text y="20">viewBox preserveAspectRatio=none</text>
</g>
</g>
<g id="p8" transform="translate(225, 70)">
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern8); stroke:black;"/>
<text y="-2" >#pattern8</text>
<g transform="translate(50, 9)">
<text>same as pattern#7 with</text>
<text y="10">preserveAspectRatio=xMinYmin meet</text>
</g>
</g>
<g id="p9" transform="translate(225, 120)">
<rect x="0" y="0" width="40" height="30" style="fill:url(#pattern9); stroke:black;"/>
<text y="-2" >#pattern9</text>
<g transform="translate(50, 9)">
<text y="0">preserveAspectRatio=xMinYmin slice</text>
<text y="10">overflow=visible</text>
</g>
</g>
</g>
</g>
<!-- ============================================================= -->
<!-- Batik sample mark -->
<!-- ============================================================= -->
<use xlink:href="../batikLogo.svg#Batik_Tag_Box" />
</svg>