| 1 |
<svg version="1.1" baseProfile="full" id="svg-root" |
| 2 |
width="100%" height="100%" viewBox="0 0 480 360" |
| 3 |
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 4 |
<!--======================================================================--> |
| 5 |
<!--= SVG 1.1 2nd Edition Test Case =--> |
| 6 |
<!--======================================================================--> |
| 7 |
<!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =--> |
| 8 |
<!--= Institute of Technology, European Research Consortium for =--> |
| 9 |
<!--= Informatics and Mathematics (ERCIM), Keio University). =--> |
| 10 |
<!--= All Rights Reserved. =--> |
| 11 |
<!--= See http://www.w3.org/Consortium/Legal/. =--> |
| 12 |
<!--======================================================================--> |
| 13 |
<d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/" |
| 14 |
template-version="1.4" reviewer="SVGWG" author="Peter Graffagnino" status="accepted" |
| 15 |
version="$Revision: 1.6 $" testname="$RCSfile: filters-displace-01-f.svg,v $"> |
| 16 |
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/filters.html#feDisplacementMapElement"> |
| 17 |
<p> |
| 18 |
Verify the basic capability to handle the feDisplacementMap filter |
| 19 |
node. Six images should appear in 2 rows of 3. On the left in each |
| 20 |
row a test image of a checker board is displayed. In the middle |
| 21 |
column is the displacement map. In the right-hand column is the |
| 22 |
result. All displacement maps are generated as png files with gamma |
| 23 |
1.0 and must be interpreted linearly for the proper geometric |
| 24 |
displacement to occur. |
| 25 |
</p> |
| 26 |
<p> |
| 27 |
The top row tests a displacement map which displaces each pixel by an |
| 28 |
amount equivalent to a rotation of 20 degrees around the center of the |
| 29 |
image. A blue reference rectangle is drawn on the result using an svg |
| 30 |
transform attribute to mimick the same 20 degree rotation. The edges |
| 31 |
of the blue rectangle should be parallel to the grid lines in the |
| 32 |
displaced image. Distortion of the grid pattern such that the grid |
| 33 |
lines are slightly curved is indicative of improper gamma handling in |
| 34 |
the viewer. |
| 35 |
</p> |
| 36 |
<p> |
| 37 |
The bottom row tests a displacement map which distorts the image |
| 38 |
spherically. |
| 39 |
</p> |
| 40 |
<p> |
| 41 |
In addition to feDisplacementMap, this test uses the 'feImage' and |
| 42 |
'rect' elements. Figure labeling uses the text element. The |
| 43 |
reference blue rectangle uses fill, fill-opacity, and transform. |
| 44 |
</p> |
| 45 |
</d:testDescription> |
| 46 |
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml"> |
| 47 |
<p> |
| 48 |
Run the test. No interaction required. |
| 49 |
</p> |
| 50 |
</d:operatorScript> |
| 51 |
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml"> |
| 52 |
<p> |
| 53 |
The rendered image should match the reference image. The edges |
| 54 |
of the blue rectangle must be parallel to the grid lines in the |
| 55 |
displaced image. The center of the bottommost right distorted image |
| 56 |
should be on a gridpoint. |
| 57 |
</p> |
| 58 |
</d:passCriteria> |
| 59 |
</d:SVGTestCase> |
| 60 |
<title id="test-title">$RCSfile: filters-displace-01-f.svg,v $</title> |
| 61 |
<defs> |
| 62 |
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F"> |
| 63 |
<font-face-src> |
| 64 |
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/> |
| 65 |
</font-face-src> |
| 66 |
</font-face> |
| 67 |
</defs> |
| 68 |
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18"> |
| 69 |
<defs> |
| 70 |
<filter id="DispMapChecker" filterUnits="objectBoundingBox" x="0" y="0" width="1" height="1"> |
| 71 |
<feImage xlink:href="../images/DisplaceChecker.png"/> |
| 72 |
</filter> |
| 73 |
<filter id="RotateMap" filterUnits="objectBoundingBox" x="0" y="0" width="1" height="1"> |
| 74 |
<feImage xlink:href="../images/rotate20.png"/> |
| 75 |
</filter> |
| 76 |
<filter id="SphereMap" filterUnits="objectBoundingBox" x="0" y="0" width="1" height="1"> |
| 77 |
<feImage xlink:href="../images/sphere.png"/> |
| 78 |
</filter> |
| 79 |
<filter id="RotateMapTest" filterUnits="objectBoundingBox" x="0" y="0" width="1" height="1"> |
| 80 |
<feImage result="Map" xlink:href="../images/rotate20.png"/> |
| 81 |
<feImage result="Texture" xlink:href="../images/DisplaceChecker.png"/> |
| 82 |
<feDisplacementMap in="Texture" in2="Map" scale="64" xChannelSelector="R" yChannelSelector="G"/> |
| 83 |
</filter> |
| 84 |
<filter id="SphereMapTest" filterUnits="objectBoundingBox" x="0" y="0" width="1" height="1"> |
| 85 |
<feImage result="Map" xlink:href="../images/sphere.png"/> |
| 86 |
<feImage result="Texture" xlink:href="../images/DisplaceChecker.png"/> |
| 87 |
<feDisplacementMap in="Texture" in2="Map" scale="64" xChannelSelector="R" yChannelSelector="G"/> |
| 88 |
</filter> |
| 89 |
</defs> |
| 90 |
|
| 91 |
<g font-family="Arial" font-size="12" text-anchor="middle"> |
| 92 |
<rect x="15" y="15" width="128" height="128" filter="url(#DispMapChecker)"/> |
| 93 |
<rect x="20" y="115" width="118" height="20" fill="#DDD"/> |
| 94 |
<text x="79" y="130">Checkerboard Image</text> |
| 95 |
|
| 96 |
<rect x="158" y="15" width="128" height="128" filter="url(#RotateMap)"/> |
| 97 |
<rect x="163" y="112" width="118" height="30" fill="#DDD"/> |
| 98 |
<text> |
| 99 |
<tspan x="222" y="125">Displacement Map</tspan> |
| 100 |
<tspan x="222" y="138">(20 deg. rotation)</tspan> |
| 101 |
</text> |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
<rect x="301" y="15" width="128" height="128" filter="url(#RotateMapTest)"/> |
| 106 |
<rect x="-1" y="-1" width="2" height="2" transform="translate(365,79) rotate(20) scale(32)" fill="blue" fill-opacity="0.5"/> |
| 107 |
<text> |
| 108 |
<tspan x="365" y="160">Result</tspan> |
| 109 |
<tspan x="365" y="172">(overlayed with 20 deg.</tspan> |
| 110 |
<tspan x="365" y="184">rotated blue rectangle)</tspan> |
| 111 |
</text> |
| 112 |
|
| 113 |
|
| 114 |
<rect x="15" y="158" width="128" height="128" filter="url(#DispMapChecker)"/> |
| 115 |
<rect x="20" y="258" width="118" height="20" fill="#DDD"/> |
| 116 |
<text x="79" y="273">Checkerboard Image</text> |
| 117 |
|
| 118 |
|
| 119 |
<rect x="158" y="158" width="128" height="128" filter="url(#SphereMap)"/> |
| 120 |
<rect x="163" y="255" width="118" height="30" fill="#DDD"/> |
| 121 |
<text> |
| 122 |
<tspan x="222" y="268">Displacement Map</tspan> |
| 123 |
<tspan x="222" y="283">(spherical distortion)</tspan> |
| 124 |
</text> |
| 125 |
|
| 126 |
|
| 127 |
<rect x="301" y="200" width="128" height="128" filter="url(#SphereMapTest)"/> |
| 128 |
<text x="365" y="345">Result</text> |
| 129 |
</g> |
| 130 |
</g> |
| 131 |
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32"> |
| 132 |
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.6 $</text> |
| 133 |
</g> |
| 134 |
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> |
| 135 |
<!-- comment out this watermark once the test is approved --> |
| 136 |
<!--<g id="draft-watermark"> |
| 137 |
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/> |
| 138 |
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240" |
| 139 |
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text> |
| 140 |
</g>--> |
| 141 |
</svg> |