vhardy      01/08/16 07:54:29

  Added:       samples/tests symbolViewBox.svg
  Log:
  Added test on viewBox/preserveAspectRatio handling on symbol.
  
  Revision  Changes    Path
  1.1                  xml-batik/samples/tests/symbolViewBox.svg
  
  Index: symbolViewBox.svg
  ===================================================================
  <?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 example validates the handling of viewBox and preserveAspectRatio    -->
  <!-- for <symbol> elements.                                                    -->
  <!--                                                                           -->
  <!-- @author [EMAIL PROTECTED]                                                 -->
  <!-- @version $Id: symbolViewBox.svg,v 1.1 2001/08/16 14:54:29 vhardy Exp $   -->
  <!-- ========================================================================= -->
  <?xml-stylesheet type="text/css" href="test.css" ?>  
  
  <svg id="body" width="450" height="500" viewBox="0 0 450 500">
  <title>&lt;symbol&gt; and viewBox &amp; preserveAspectRatio</title>
  
      <style type="text/css"><![CDATA[
          .label { text-anchor: middle; }
          .oddRow { fill:white; stroke:black; }
          .evenRow { fill:#eeeeee; stroke:black; }
      ]]></style>
  
      <g id="content">
  
          <text class="title" x="50%" y="40">viewBox &amp; preserveAspectRatio on 
&lt;symbol&gt;</text>
  
          <g id="table" class="label" transform="translate(80, 60)">
              <rect         width="110" height="20" class="oddRow" />
              <text x="55" y="15">meet</text>
              <rect width="110" height="20" class="oddRow" 
transform="translate(110,0)"/>
              <text x="55" y="15" transform="translate(110, 0)">slice</text>
              <rect width="110" height="20" class="oddRow" 
transform="translate(220,0)"/>
              <text x="55" y="15" transform="translate(220, 0)">unspecified</text>
  
              <g id="yMXX">
                  <rect x="-20" y="20" width="20" height="40" class="oddRow" />
                  <text x="-5" y="40" transform="rotate(-90,-5,40)">yMin</text>
  
                  <g transform="translate(0,40)">
                      <rect x="-20" y="20" width="20" height="40" class="evenRow" />
                      <text x="-5" y="40" transform="rotate(-90,-5,40)">yMid</text>
                  </g>
  
                  <g transform="translate(0,80)">
                      <rect x="-20" y="20" width="20" height="40" class="oddRow" />
                      <text x="-5" y="40" transform="rotate(-90,-5,40)">yMax</text>
                  </g>
              </g>
              
  
              <g transform="translate(0,120)">
                  <rect x="-20" y="20" width="20" height="40" class="oddRow" />
                  <text x="-5" y="40" transform="rotate(-90,-5,40)">yMin</text>
  
                  <g transform="translate(0,40)">
                      <rect x="-20" y="20" width="20" height="40" class="evenRow" />
                      <text x="-5" y="40" transform="rotate(-90,-5,40)">yMid</text>
                  </g>
  
                  <g transform="translate(0,80)">
                      <rect x="-20" y="20" width="20" height="40" class="oddRow" />
                      <text x="-5" y="40" transform="rotate(-90,-5,40)">yMax</text>
                  </g>
              </g>
              
              <g transform="translate(0,240)">
                  <rect x="-20" y="20" width="20" height="40" class="oddRow" />
                  <text x="-5" y="40" transform="rotate(-90,-5,40)">yMin</text>
  
                  <g transform="translate(0,40)">
                      <rect x="-20" y="20" width="20" height="40" class="evenRow" />
                      <text x="-5" y="40" transform="rotate(-90,-5,40)">yMid</text>
                  </g>
  
                  <g transform="translate(0,80)">
                      <rect x="-20" y="20" width="20" height="40" class="oddRow" />
                      <text x="-5" y="40" transform="rotate(-90,-5,40)">yMax</text>
                  </g>
              </g>
              
              <rect x="-40" y="20" width="20" height="120" class="evenRow" />
              <text x="-25" y="80" transform="rotate(-90,-25,80)">xMin</text>
              
              <g transform="translate(0,120)">
                  <rect x="-40" y="20" width="20" height="120" class="oddRow" />
                  <text x="-25" y="80" transform="rotate(-90,-25,80)">xMid</text>
              </g>
      
              <g transform="translate(0,240)">
                  <rect x="-40" y="20" width="20" height="120" class="evenRow" />
                  <text x="-25" y="80" transform="rotate(-90,-25,80)">xMax</text>
              </g>
      
              <defs>
                  <g id="row">
                      <rect width="110" height="40" transform="translate(0  ,20)"/>
                      <rect width="110" height="40" transform="translate(110,20)"/>
                      <rect width="110" height="40" transform="translate(220,20)"/>
                  </g>
              </defs>
  
              <g id="evenRowBlock">
                  <use xlink:href="#row" class="evenRow" transform="translate(0,0)"/>
                  <use xlink:href="#row" class="oddRow" transform="translate(0,40)"/>
                  <use xlink:href="#row" class="evenRow" transform="translate(0,80)"/>
              </g>
  
              <g id="oddRowBlock" transform="translate(0,120)">
                  <use xlink:href="#row" class="oddRow" transform="translate(0,0)"/>
                  <use xlink:href="#row" class="evenRow" transform="translate(0,40)"/>
                  <use xlink:href="#row" class="oddRow" transform="translate(0,80)"/>
              </g>
  
              <use xlink:href="#evenRowBlock" transform="translate(0,240)"/>
      
              <rect x="-40" y="380" width="40" height="40" fill="white" stroke="black" 
/>
              <text x="-15" y="400" transform="rotate(-90, -15, 400)">none</text>
              <use xlink:href="#row" class="oddRow" transform="translate(0,360)" />
  
          </g>
  
          <g id="testCases" transform="translate(80, 80)">
              <defs>
                  <rect id="viewBox" x="20" y="2" width="70" height="36" stroke="red" 
fill="none"/>     
                  <g id="smilley">
                      <g  transform="translate(-15,-15)" >
                          <circle cx="10" cy="25" r="4" fill="crimson" />
                          <circle cx="20" cy="25" r="4" fill="crimson" />
                          <circle cx="15" cy="15" r="10" fill="yellow"/>
                          <circle cx="12" cy="12" r="1.5" fill="black"/>
                          <circle cx="17" cy="12" r="1.5" fill="black"/>
                          <path d="M 10 19 A 8 8 0 0 0 20 19" stroke="black" 
stroke-width="1" fill="none"/>
                      </g>
                  </g>
              </defs>
  
              <!-- xMinYXXX XXX -->
              <g>
                  <!-- ... YMin XXX -->
                  <g>
                      <g>
                          <symbol id="xMinYMinMeet" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMinYMin meet">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMinYMinMeet" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(110, 0)">
                          <symbol id="xMinYMinSlice" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMinYMin slice">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMinYMinSlice" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(220, 0)">
                          <symbol id="xMinYMinUnspecified" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMinYMin">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMinYMinUnspecified" x="20" y="2" 
width="70" height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
                  </g>
  
                  <!-- ... YMid XXX -->
                  <g transform="translate(0, 40)">
                      <g>
                          <symbol id="xMinYMidMeet" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMinYMid meet">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMinYMidMeet" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(110, 0)">
                          <symbol id="xMinYMidSlice" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMinYMid slice">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMinYMidSlice" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(220, 0)">
                          <symbol id="xMinYMidUnspecified" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMinYMid">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMinYMidUnspecified" x="20" y="2" 
width="70" height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
                  </g>
  
                  <!-- ... YMax XXX -->
                  <g transform="translate(0, 80)">
                      <g>
                          <symbol id="xMinYMaxMeet" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMinYMax meet">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMinYMaxMeet" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(110, 0)">
                          <symbol id="xMinYMaxSlice" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMinYMax slice">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMinYMaxSlice" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(220, 0)">
                          <symbol id="xMinYMaxUnspecified" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMinYMax">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMinYMaxUnspecified" x="20" y="2" 
width="70" height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
                  </g>
              </g>
  
  
              <!-- xMidYXXX XXX -->
              <g transform="translate(0, 120)">
                  <!-- ... YMin XXX -->
                  <g>
                      <g>
                          <symbol id="xMidYMinMeet" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMidYMin meet">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMidYMinMeet" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(110, 0)">
                          <symbol id="xMidYMinSlice" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMidYMin slice">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMidYMinSlice" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(220, 0)">
                          <symbol id="xMidYMinUnspecified" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMidYMin">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMidYMinUnspecified" x="20" y="2" 
width="70" height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
                  </g>
  
                  <!-- ... YMid XXX -->
                  <g transform="translate(0, 40)">
                      <g>
                          <symbol id="xMidYMidMeet" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMidYMid meet">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMidYMidMeet" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(110, 0)">
                          <symbol id="xMidYMidSlice" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMidYMid slice">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMidYMidSlice" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(220, 0)">
                          <symbol id="xMidYMidUnspecified" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMidYMid">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMidYMidUnspecified" x="20" y="2" 
width="70" height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
                  </g>
  
                  <!-- ... YMax XXX -->
                  <g transform="translate(0, 80)">
                      <g>
                          <symbol id="xMidYMaxMeet" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMidYMax meet">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMidYMaxMeet" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(110, 0)">
                          <symbol id="xMidYMaxSlice" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMidYMax slice">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMidYMaxSlice" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(220, 0)">
                          <symbol id="xMidYMaxUnspecified" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMidYMax">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMidYMaxUnspecified" x="20" y="2" 
width="70" height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
                  </g>
              </g>
  
              <!-- xMaxYXXX XXX -->
              <g transform="translate(0, 240)">
                  <!-- ... YMin XXX -->
                  <g>
                      <g>
                          <symbol id="xMaxYMinMeet" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMaxYMin meet">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMaxYMinMeet" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(110, 0)">
                          <symbol id="xMaxYMinSlice" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMaxYMin slice">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMaxYMinSlice" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(220, 0)">
                          <symbol id="xMaxYMinUnspecified" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMaxYMin">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMaxYMinUnspecified" x="20" y="2" 
width="70" height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
                  </g>
  
                  <!-- ... YMid XXX -->
                  <g transform="translate(0, 40)">
                      <g>
                          <symbol id="xMaxYMidMeet" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMaxYMid meet">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMaxYMidMeet" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(110, 0)">
                          <symbol id="xMaxYMidSlice" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMaxYMid slice">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMaxYMidSlice" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(220, 0)">
                          <symbol id="xMaxYMidUnspecified" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMaxYMid">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMaxYMidUnspecified" x="20" y="2" 
width="70" height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
                  </g>
  
                  <!-- ... YMax XXX -->
                  <g transform="translate(0, 80)">
                      <g>
                          <symbol id="xMaxYMaxMeet" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMaxYMax meet">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMaxYMaxMeet" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(110, 0)">
                          <symbol id="xMaxYMaxSlice" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMaxYMax slice">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMaxYMaxSlice" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(220, 0)">
                          <symbol id="xMaxYMaxUnspecified" viewBox="-10 -10 20 23" 
preserveAspectRatio="xMaxYMax">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#xMaxYMaxUnspecified" x="20" y="2" 
width="70" height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
                  </g>
              </g>
  
  
              <!-- none XXX -->
              <g transform="translate(0,360)">
                  <g>
                      <g>
                          <symbol id="noneMeet" viewBox="-10 -10 20 23" 
preserveAspectRatio="none meet">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#noneMeet" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(110, 0)">
                          <symbol id="noneSlice" viewBox="-10 -10 20 23" 
preserveAspectRatio="none slice">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#noneSlice" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
  
                      <g transform="translate(220, 0)">
                          <symbol id="noneUnspecified" viewBox="-10 -10 20 23" 
preserveAspectRatio="none">
                              <use xlink:href="#smilley" />
                          </symbol>
                          <use xlink:href="#noneUnspecified" x="20" y="2" width="70" 
height="36" />
                          <use xlink:href="#viewBox" />
                      </g>
                  </g>
  
              </g>
  
  
  
          </g>
  
      </g><!-- "content" -->
  
      <!-- ============================================================= -->
      <!-- Batik sample mark                                             -->
      <!-- ============================================================= -->
      <use xlink:href="../batikLogo.svg#Batik_Tag_Box" />
  
  </svg>
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to