<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
<!--======================================================================-->
<!--=  Copyright 2002 World Wide Web Consortium, (Massachusetts          =-->
<!--=  Institute of Technology, Institut National de Recherche en        =-->
<!--=  Informatique et en Automatique, Keio University). All Rights      =-->
<!--=  Reserved. See http://www.w3.org/Consortium/Legal/.                =-->
<!--======================================================================-->
<!-- ===================================================================== -->
<!--                                                                       -->
<!-- coords-units-01-b.svg                                                 -->
<!-- 1.1 revision by Christophe Jolif                                      -->
<!--                                                                       -->
<!-- Validate the processing rules for converting coordinates and          -->
<!-- lengths defined in fractions of the current object's bounding box     -->
<!-- to user space coordinates and length.                                 -->
<!--                                                                       -->
<!-- Author : Vincent Hardy, 29-Feb-2000                                   -->
<!--                                                                       -->
<!-- History:                                                              -->
<!--  29-Feb-2000, VH: Created.  Matches 20000302 SVG spec.                -->
<!--  09-Mar-2000, LH: suite integration (name, editorial, ..), ser#2      -->
<!--  09-Mar-2000, LH: fix framing rect,  ser#3.                           -->
<!--  24-Apr-2000, LH: remove text-anchor,  ser#4.                         -->
<!--  02-Jun-2000, LH: fix fx,fy on radial grads" stroke lines;  ser#5.    -->
<!--  04-Jun-2000, LH: mark "NA" (in -patch) on PNG, for patterns"  ser#6  -->
<!--  03-Aug-2000, LH: update DOCTYPE for CR DTD, 20000802" ser# .         -->
<!--  16-Aug-2000, LH: rename ser#7.                                       -->
<!--  29-Sep-2000, VH: fixed pattern reference problems" ser#8.            -->
<!--  07-Dec-2000, JF: update to Nov. 2 spec, fix other errors.            -->
<!--                                                                       -->
<!-- ===================================================================== -->
<!--======================================================================-->
<!--= Note. After October 2000, revision history is kept as CVS 'commit' =-->
<!--= log messages, and therefore is no longer in the preceding preamble.=-->
<!--======================================================================-->
<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360">
  <title id="test-title">coords-units-01-b</title>
  <desc id="test-desc">This test validates the processing rules for converting coordinates and length defined in fractions of the current object's bounding box to user space coordinates and length. Note that this test assumes that linear and radial gradients, as well as patterns are implemented.</desc>
  <!--======================================================================-->
  <!--Content of Test Case follows...                  =====================-->
  <!--======================================================================-->
  <g id="test-body-content">
    <!-- ==================================================================== -->
    <!-- The following gradients will be used to fill a rectangle with the    -->
    <!-- following geometry in User space: x=0, y=0, width=50 height=20       -->
    <!-- The gradient vector, in linearBoundingBox, is defined as: (0%, 0%)   -->
    <!-- to (100%, 0%).                                                       -->
    <!-- The gradient vector, in linearBoundingBoxFraction, is defined as:    -->
    <!-- (0, 0) to (1, 0), which is equivalent.                               -->
    <!-- According to the spec, for our rectangle, this corresponds to the    -->
    <!-- following user space coordinates:                                    -->
    <!-- (0%, 0%) becomes (0, 0) and (100%, 0%) becomes (20, 0)               -->
    <!-- These values are used to define the linearUserSpace gradient.        -->
    <!-- If the test succeeds, all the gradient should fill the rectangles    -->
    <!-- the same way                                                         -->
    <!-- ==================================================================== -->
    <linearGradient id="linearBoundingBoxPercentage" gradientUnits="objectBoundingBox" x1="0%" y1="0%" x2="100%" y2="0%">
      <stop stop-color="red" offset="0"/>
      <stop stop-color="blue" offset="1"/>
    </linearGradient>
    <linearGradient id="linearBoundingBoxFraction" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0">
      <stop stop-color="red" offset="0"/>
      <stop stop-color="blue" offset="1"/>
    </linearGradient>
    <linearGradient id="linearUserSpace" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="50" y2="0">
      <stop stop-color="red" offset="0"/>
      <stop stop-color="blue" offset="1"/>
    </linearGradient>
    <!-- Draw Text Comment -->
    <g transform="translate(30, 40)">
      <rect x="0" y="0" width="50" height="20" fill="url(#linearBoundingBoxPercentage)"/>
      <rect x="0" y="0" width="50" height="20" transform="translate(0, 20)" fill="url(#linearBoundingBoxFraction)"/>
      <rect x="0" y="0" width="50" height="20" transform="translate(0, 40)" fill="url(#linearUserSpace)"/>
      <line x1="0" y1="20" x2="50" y2="20" stroke="#cccccc" stroke-width="1"/>
      <line x1="0" y1="40" x2="50" y2="40" stroke="#cccccc" stroke-width="1"/>
    </g>
    <!-- ==================================================================== -->
    <!-- The following gradients will be used to fill a rectangle with the    -->
    <!-- following geometry in User space: x=0, y=0, width=60 height=60       -->
    <!-- The radial gradient outmost circle, in radialBoundingBox, is defined -->
    <!-- as: cx=25% cy=25% r=25%                                              -->
    <!-- The radial gradient outmost circle, in radialBoundingBoxFraction, is -->
    <!-- defined as: cx=0.25 cy=0.25 and r=0.25                               -->
    <!-- These two definition, for our rectangle, should be identical to the  -->
    <!-- following radial gradient outmost circle, in radialUserSpace:        -->
    <!-- cx=15 cy=15 r=15                                                     -->
    <!-- ==================================================================== -->
    <radialGradient id="radialBoundingBoxPercentage" gradientUnits="objectBoundingBox" cx="25%" cy="25%" r="25%" fx="25%" fy="25%">
      <stop stop-color="red" offset="0"/>
      <stop stop-color="blue" offset="1"/>
    </radialGradient>
    <radialGradient id="radialBoundingBoxFraction" gradientUnits="objectBoundingBox" cx="0.25" cy="0.25" r="0.25" fx="0.25" fy="0.25">
      <stop stop-color="red" offset="0"/>
      <stop stop-color="blue" offset="1"/>
    </radialGradient>
    <radialGradient id="radialUserSpace" gradientUnits="userSpaceOnUse" cx="15" cy="15" r="15" fx="15" fy="15">
      <stop stop-color="red" offset="0"/>
      <stop stop-color="blue" offset="1"/>
    </radialGradient>
    <!-- Draw Text Comment -->
    <g transform="translate(30, 140)">
      <rect x="0" y="0" width="60" height="60" fill="url(#radialBoundingBoxPercentage)"/>
      <rect x="0" y="0" width="60" height="60" transform="translate(61, 0)" fill="url(#radialBoundingBoxFraction)"/>
      <rect x="0" y="0" width="60" height="60" transform="translate(122, 0)" fill="url(#radialUserSpace)"/>
    </g>
    <!-- ==================================================================== -->
    <!-- The following patterns will be used to fill a rectangle, with the    -->
    <!-- following geometry in User space: x=0, y=0, width=50 height=30       -->
    <!-- The pattern tile, in patterBoundingBoxPercentage, is defined as:     -->
    <!-- x=25% y=25% width=50% height=50%                                     -->
    <!-- The pattern tile, in patternBoundingBoxFraction, is defined as:      -->
    <!-- x=0.25 y=0.25 width=0.50 height=0.50                                 -->
    <!-- For our test rectangle, both correspond to the following User space  -->
    <!-- coordinates: x=12.5 y=7.5 width=25 height=15                         -->
    <!-- These coordinates are use to define the patternUserSpace tile        -->
    <!-- ==================================================================== -->
    <pattern id="patternBoundingBoxPercentage" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" x="25%" y="25%" width="50%" height="50%">
      <circle cx="0.50" cy="0.50" r="0.25" fill="red"/>
      <rect x="0.4" y="0.4" width=".2" height=".2" fill="blue"/>
    </pattern>
    <pattern id="patternBoundingBoxFraction" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" x="0.25" y="0.25" width="0.50" height="0.50">
      <circle cx="0.50" cy="0.50" r="0.25" fill="red"/>
      <rect x="0.4" y="0.4" width=".2" height=".2" fill="blue"/>
    </pattern>
    <pattern id="patternUserSpace" patternUnits="userSpaceOnUse" patternContentUnits="userSpaceOnUse" x="12.5" y="7.5" width="25" height="15">
      <circle id="patternContent" cx="25" cy="15" r="10" fill="red"/>
      <rect x="20" y="12" width="10" height="6" fill="blue"/>
    </pattern>
    <!-- Draw Text Comment -->
    <g transform="translate(30, 250)">
      <rect x="0" y="0" width="50" height="30" fill="url(#patternBoundingBoxPercentage)" stroke="black"/>
      <rect x="0" y="0" width="50" height="30" transform="translate(150, 0)" fill="url(#patternBoundingBoxFraction)" stroke="black"/>
      <rect x="0" y="0" width="50" height="30" transform="translate(300, 0)" fill="url(#patternUserSpace)" stroke="black"/>
    </g>
    <!-- Test framing rectangle, drawn just inside viewport boundary. -->
    <rect x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
  </g>
	<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
</svg>

