Debian Codegraph @

samples/tests/spec/filters/feDisplacementMap.svg

raw
1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
3 "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
5 <!--
6
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
13
14 http://www.apache.org/licenses/LICENSE-2.0
15
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
21
22 -->
23 <!-- ========================================================================= -->
24 <!-- feDisplacementMap filter test -->
25 <!-- -->
26 <!-- @author [email protected] -->
27 <!-- @version $Id$ -->
28 <!-- ========================================================================= -->
29
30 <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
31
32 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body" width="450" height="500" viewBox="0 0 450 500">
33 <title>Filter Effect: feDisplacementMap</title>
34 <!-- ============================================================= -->
35 <!-- Test content -->
36 <!-- ============================================================= -->
37
38 <g class="legend">
39 <text x="225" y="50" class="title">
40 Filter Effect: feDisplacementMap
41 </text>
42
43 <defs>
44 <!-- ========================================== -->
45 <!-- Pattern used to visualize the distorsions -->
46 <!-- created by displacement map. -->
47 <!-- ========================================== -->
48 <pattern id="pattern" patternUnits="userSpaceOnUse" x="0" y="0"
49 width="20" height="20">
50 <rect x="0" y="0" width="10" height="10" fill="red"/>
51 <rect x="10" y="10" width="10" height="10" fill="green" />
52 </pattern>
53
54 <!-- ========================================== -->
55 <!-- Source for the displacement tests -->
56 <!-- ========================================== -->
57 <rect id="displaced" x="0" y="0" width="100" height="100" fill="url(#pattern)" />
58
59 <filter id="noOp" x="0" y="0" width="1" height="1">
60 <feImage xlink:href="#displaced" result="displaced" />
61 </filter>
62
63 <!-- ========================================== -->
64 <!-- Variations in the Red channel only -->
65 <!-- ========================================== -->
66 <linearGradient id="redOnly" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0" color-interpolation="linearRGB">
67 <stop offset="0" stop-color="rgb(255, 188, 188)" />
68 <stop offset=".25" stop-color="rgb(0, 188, 188)" />
69 <stop offset=".5" stop-color="rgb(255, 188, 188)" />
70 <stop offset="1" stop-color="rgb(0, 188, 188)" />
71 </linearGradient>
72
73 <radialGradient id="redAndGreenFill2" gradientUnits="objectBoundingBox" cx=".5" cy=".5" r="1" spreadMethod="reflect">
74 <stop offset="0" stop-color="rgb(255, 0, 188)" />
75 <stop offset="1" stop-color="rgb(0, 255, 188)" />
76 </radialGradient>
77
78 <linearGradient id="redAndGreenFill" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="0" color-interpolation="linearRGB">
79 <stop offset="0" stop-color="rgb(255, 0, 188)" />
80 <stop offset=".25" stop-color="rgb(0, 255, 188)" />
81 <stop offset=".5" stop-color="rgb(255, 0, 188)" />
82 <stop offset="1" stop-color="rgb(0, 255, 188)" />
83 </linearGradient>
84
85 <rect id="redOnlyMap" x="0" y="0" width="100" height="100" fill="url(#redOnly)" />
86
87 <rect id="redAndGreenMap" x="0" y="0" width="100" height="100" fill="url(#redAndGreenFill)" />
88
89 <filter id="xOnly" x="0" y="0" width="1" height="1">
90 <feImage xlink:href="#redOnlyMap" result="map" />
91 <feImage xlink:href="#displaced" result="displaced" />
92 <feDisplacementMap in="displaced" in2="map"
93 scale="30" xChannelSelector="R" yChannelSelector="G" />
94 </filter>
95
96 <filter id="yOnly" x="0" y="0" width="1" height="1">
97 <feImage xlink:href="#redOnlyMap" result="map" />
98 <feImage xlink:href="#displaced" result="displaced" />
99 <feDisplacementMap in="displaced" in2="map"
100 scale="30" xChannelSelector="G" yChannelSelector="R" />
101 </filter>
102
103 <filter id="xy" x="0" y="0" width="1" height="1">
104 <feImage xlink:href="#redOnlyMap" result="map" />
105 <feImage xlink:href="#displaced" result="displaced" />
106 <feDisplacementMap in="displaced" in2="map"
107 scale="30" xChannelSelector="R" yChannelSelector="R" />
108 </filter>
109
110 <filter id="redAndGreen" x="0" y="0" width="1" height="1">
111 <feImage xlink:href="#redAndGreenMap" result="map" />
112 <feImage xlink:href="#displaced" result="displaced" />
113 <feDisplacementMap in="displaced" in2="map"
114 scale="30" xChannelSelector="R" yChannelSelector="G" />
115 </filter>
116
117
118
119 </defs>
120
121
122 <!-- ================================================== -->
123 <!-- First, test different types of displacements -->
124 <!-- ================================================== -->
125
126 <!-- ============================== -->
127 <!-- Reference -->
128 <!-- ============================== -->
129 <g transform="translate(20, 100)">
130 <rect x="0" y="0" width="100" height="100" filter="url(#noOp)"/>
131 <rect x="0" y="0" width="100" height="100" stroke="black" fill="none"/>
132 <text x="50" y="-3">Reference</text>
133 </g>
134
135 <!-- ============================== -->
136 <!-- x-axis only -->
137 <!-- ============================== -->
138 <g transform="translate(150, 100)">
139 <rect x="0" y="0" width="100" height="100" filter="url(#xOnly)"/>
140 <rect x="0" y="0" width="100" height="100" stroke="black" fill="none"/>
141 <text x="50" y="-3">x only</text>
142 </g>
143
144 <!-- ============================== -->
145 <!-- y-axis only -->
146 <!-- ============================== -->
147 <g transform="translate(280, 100)">
148 <rect x="0" y="0" width="100" height="100" filter="url(#yOnly)"/>
149 <rect x="0" y="0" width="100" height="100" stroke="black" fill="none"/>
150 <text x="50" y="-3">y only</text>
151 </g>
152
153 <!-- ============================== -->
154 <!-- x and y -->
155 <!-- ============================== -->
156 <g transform="translate(20, 230)">
157 <rect x="0" y="0" width="100" height="100" filter="url(#xy)"/>
158 <rect x="0" y="0" width="100" height="100" stroke="black" fill="none"/>
159 <text x="50" y="-3">x and y</text>
160 </g>
161
162 <!-- ============================== -->
163 <!-- Rend and Green -->
164 <!-- ============================== -->
165 <g transform="translate(150, 230)">
166 <rect x="0" y="0" width="100" height="100" filter="url(#redAndGreen)"/>
167 <rect x="0" y="0" width="100" height="100" stroke="black" fill="none"/>
168 <text x="50" y="-3">x and y (different)</text>
169 </g>
170
171 </g>
172
173 <!-- ============================================================= -->
174 <!-- Batik sample mark -->
175 <!-- ============================================================= -->
176 <use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" />
177
178 </svg>
179