| <?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 Region Test, B</title> |
| |
| <text x="225" y="50" class="title"> |
| patternRegion, x, y, width, height, viewBox |
| </text> |
| |
| <!-- ============================================================= --> |
| <!-- Test content --> |
| <!-- ============================================================= --> |
| <g id="testContent" > |
| <defs> |
| |
| <!-- ============================================== --> |
| <!-- For all the following patterns: --> |
| <!-- --> |
| <!-- patternUnits : default (objectBoundingBox) --> |
| <!-- patternContentUnits : default (userSpaceOnUse) --> |
| <!-- patternTransform: default (identity) --> |
| <!-- preserveAspectRatio: default (xMidyMid meet) --> |
| <!-- overflow : default (hidden) --> |
| <!-- --> |
| <!-- Because of the default preserveAspectRatio --> |
| <!-- value, the following patterns should be --> |
| <!-- centered in the pattern region. --> |
| <!-- ============================================== --> |
| |
| <!-- ============================================== --> |
| <!-- The pattern content fits exactly in the --> |
| <!-- pattern region. --> |
| <!-- .2 * 100 = 20 userSpaceUnits --> |
| <!-- .4 * 50 = 20 userSpaceUnits --> |
| <!-- viewBox matches the pattern content's bounds --> |
| <!-- ============================================== --> |
| <pattern id="patternExactFit" x="0" y="0" width=".2" height=".4" |
| viewBox="0 0 20 20"> |
| <use xlink:href="patternRegionA.svg#patternContent" /> |
| </pattern> |
| |
| <!-- ============================================== --> |
| <!-- The pattern content is offset along the x axis --> |
| <!-- .2 * 100 = 20 userSpaceUnits --> |
| <!-- .4 * 50 = 20 userSpaceUnits --> |
| <!-- viewBox is offset to the left. This causes the --> |
| <!-- pattern content to be translated to the right --> |
| <!-- when centered in the viewPort. --> |
| <!-- ============================================== --> |
| <pattern id="patternTranslateRegionX" |
| x="0" y="0" |
| width=".2" height=".4" |
| viewBox="-5 0 20 20" overflow="hidden"> |
| <use xlink:href="patternRegionA.svg#patternContent" /> |
| </pattern> |
| |
| <!-- ============================================== --> |
| <!-- The pattern content is offset along the y axis --> |
| <!-- .2 * 100 = 20 userSpaceUnits --> |
| <!-- .4 * 50 = 20 userSpaceUnits --> |
| <!-- viewBox is offset to the top. This causes the --> |
| <!-- pattern content to be translated to the bottom --> |
| <!-- when centered in the viewPort. --> |
| <!-- ============================================== --> |
| <pattern id="patternTranslateRegionY" |
| x="0" y="0" |
| width=".2" height=".4" |
| viewBox="0 -5 20 20"> |
| <use xlink:href="patternRegionA.svg#patternContent" /> |
| </pattern> |
| |
| <!-- ============================================== --> |
| <!-- The pattern content is offset along the both --> |
| <!-- both axis. --> |
| <!-- .2 * 100 = 20 userSpaceUnits --> |
| <!-- .4 * 50 = 20 userSpaceUnits --> |
| <!-- viewBox is offset to the top/left. This causes --> |
| <!-- the pattern content to be translated to the --> |
| <!-- bottom when centered in the viewPort. --> |
| <!-- ============================================== --> |
| <pattern id="patternTranslateRegionXY" |
| x="0" y="0" |
| width=".2" height=".4" |
| viewBox="-10 -10 20 20"> |
| <use xlink:href="patternRegionA.svg#patternContent" /> |
| </pattern> |
| |
| <!-- ============================================== --> |
| <!-- In the following tests, the --> |
| <!-- preserveAspectRatio attribute is set to none. --> |
| <!-- ============================================== --> |
| |
| <!-- ============================================== --> |
| <!-- The pattern content fits exactly in the --> |
| <!-- pattern region. --> |
| <!-- .2 * 100 = 20 userSpaceUnits --> |
| <!-- .4 * 50 = 20 userSpaceUnits --> |
| <!-- viewBox matches the pattern content's bounds --> |
| <!-- ============================================== --> |
| <pattern id="patternExactFitPANone" x="0" y="0" width=".2" height=".4" |
| viewBox="0 0 20 20" |
| preserveAspectRatio="none"> |
| <use xlink:href="patternRegionA.svg#patternContent" /> |
| </pattern> |
| |
| <!-- ============================================== --> |
| <!-- Half of the pattern content is stretched along --> |
| <!-- the x axis. --> |
| <!-- .2 * 100 = 20 userSpaceUnits --> |
| <!-- .4 * 50 = 20 userSpaceUnits --> |
| <!-- ============================================== --> |
| <pattern id="patternStretchX" |
| x="0" y="0" |
| width=".2" height=".4" |
| viewBox="5 0 10 20" |
| preserveAspectRatio="none"> |
| <use xlink:href="patternRegionA.svg#patternContent" /> |
| </pattern> |
| |
| <!-- ============================================== --> |
| <!-- Half of the pattern content is stretched along --> |
| <!-- the y axis. --> |
| <!-- ============================================== --> |
| <pattern id="patternStretchY" |
| x="0" y="0" |
| width=".2" height=".4" |
| viewBox="0 5 20 10" |
| preserveAspectRatio="none"> |
| <use xlink:href="patternRegionA.svg#patternContent" /> |
| </pattern> |
| |
| <!-- ============================================== --> |
| <!-- The pattern content is stretched along both --> |
| <!-- axis. --> |
| <!-- ============================================== --> |
| <pattern id="patternStretchXY" |
| x="0" y="0" |
| width=".2" height=".4" |
| viewBox="5 5 10 10" |
| preserveAspectRatio="none"> |
| <use xlink:href="patternRegionA.svg#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="patternRegionA.svg#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="none" /> |
| </g> |
| |
| <g transform="translate(0, 70)"> |
| <text class="legend" style="text-anchor:start" x="0" y="-5">pattern content offset to the right</text> |
| <rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionX)" stroke="black"/> |
| <rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" stroke-width="3"/> |
| <rect x="5" y="0" width="15" height="20" stroke="red" fill="none"/> |
| </g> |
| |
| <g transform="translate(0, 140)"> |
| <text class="legend" style="text-anchor:start" x="0" y="-5">pattern content offset to the bottom</text> |
| <rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionY)" stroke="black"/> |
| <rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" stroke-width="3"/> |
| <rect x="0" y="5" width="20" height="15" stroke="red" fill="none"/> |
| </g> |
| |
| <g transform="translate(0, 210)"> |
| <text class="legend" style="text-anchor:start" x="0" y="-5">pattern content offset to the bottom/right</text> |
| <rect x="0" y="0" width="100" height="50" fill="url(#patternTranslateRegionXY)" stroke="black"/> |
| <rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" stroke-width="3"/> |
| <rect x="10" y="10" width="10" height="10" stroke="red" fill="none"/> |
| </g> |
| |
| </g> |
| |
| <g transform="translate(255, 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(#patternExactFitPANone)" 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">pattern content X stretch</text> |
| <rect x="0" y="0" width="100" height="50" fill="url(#patternStretchX)" stroke="black"/> |
| <rect x="0" 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">pattern content Y stretch</text> |
| <rect x="0" y="0" width="100" height="50" fill="url(#patternStretchY)" stroke="black"/> |
| <rect x="0" y="0" 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">pattern content X/Y stretch</text> |
| <rect x="0" y="0" width="100" height="50" fill="url(#patternStretchXY)" stroke="black"/> |
| <rect x="0" y="0" width="20" height="20" stroke="white" fill-opacity=".12" /> |
| </g> |
| </g> |
| |
| </g> |
| |
| <!-- ============================================================= --> |
| <!-- Batik sample mark --> |
| <!-- ============================================================= --> |
| <use xlink:href="../batikLogo.svg#Batik_Tag_Box" /> |
| |
| </svg> |