| 1 |
<?xml version="1.0" standalone="no"?> |
| 2 |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" |
| 3 |
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> |
| 4 |
<svg width="13.5cm" height="2.7cm" viewBox="0 0 1350 270" |
| 5 |
xmlns="http://www.w3.org/2000/svg" version="1.1"> |
| 6 |
<title>Example enable-background01</title> |
| 7 |
<desc>This test case shows five pictures which illustrate the rules |
| 8 |
for background image processing.</desc> |
| 9 |
|
| 10 |
<defs> |
| 11 |
<filter id="ShiftBGAndBlur" |
| 12 |
filterUnits="userSpaceOnUse" x="0" y="0" width="1200" height="400"> |
| 13 |
<desc> |
| 14 |
This filter discards the SourceGraphic, if any, and just produces |
| 15 |
a result consisting of the BackgroundImage shifted down 125 units |
| 16 |
and then blurred. |
| 17 |
</desc> |
| 18 |
<feOffset in="BackgroundImage" dx="0" dy="125" /> |
| 19 |
<feGaussianBlur stdDeviation="8" /> |
| 20 |
</filter> |
| 21 |
<filter id="ShiftBGAndBlur_WithSourceGraphic" |
| 22 |
filterUnits="userSpaceOnUse" x="0" y="0" width="1200" height="400"> |
| 23 |
<desc> |
| 24 |
This filter takes the BackgroundImage, shifts it down 125 units, blurs it, |
| 25 |
and then renders the SourceGraphic on top of the shifted/blurred background. |
| 26 |
</desc> |
| 27 |
<feOffset in="BackgroundImage" dx="0" dy="125" /> |
| 28 |
<feGaussianBlur stdDeviation="8" result="blur" /> |
| 29 |
<feMerge> |
| 30 |
<feMergeNode in="blur"/> |
| 31 |
<feMergeNode in="SourceGraphic"/> |
| 32 |
</feMerge> |
| 33 |
</filter> |
| 34 |
</defs> |
| 35 |
|
| 36 |
<g transform="translate(0,0)"> |
| 37 |
<desc>The first picture is our reference graphic without filters.</desc> |
| 38 |
<rect x="25" y="25" width="100" height="100" fill="red"/> |
| 39 |
<g opacity=".5"> |
| 40 |
<circle cx="125" cy="75" r="45" fill="green"/> |
| 41 |
<polygon points="160,25 160,125 240,75" fill="blue"/> |
| 42 |
</g> |
| 43 |
<rect x="5" y="5" width="260" height="260" fill="none" stroke="blue"/> |
| 44 |
</g> |
| 45 |
|
| 46 |
<g enable-background="new" transform="translate(270,0)"> |
| 47 |
<desc>The second adds an empty 'g' element which invokes ShiftBGAndBlur.</desc> |
| 48 |
<rect x="25" y="25" width="100" height="100" fill="red"/> |
| 49 |
<g opacity=".5"> |
| 50 |
<circle cx="125" cy="75" r="45" fill="green"/> |
| 51 |
<polygon points="160,25 160,125 240,75" fill="blue"/> |
| 52 |
</g> |
| 53 |
<g filter="url(#ShiftBGAndBlur)"/> |
| 54 |
<rect x="5" y="5" width="260" height="260" fill="none" stroke="blue"/> |
| 55 |
</g> |
| 56 |
|
| 57 |
<g enable-background="new" transform="translate(540,0)"> |
| 58 |
<desc>The third invokes ShiftBGAndBlur on the inner group.</desc> |
| 59 |
<rect x="25" y="25" width="100" height="100" fill="red"/> |
| 60 |
<g filter="url(#ShiftBGAndBlur)" opacity=".5"> |
| 61 |
<circle cx="125" cy="75" r="45" fill="green"/> |
| 62 |
<polygon points="160,25 160,125 240,75" fill="blue"/> |
| 63 |
</g> |
| 64 |
<rect x="5" y="5" width="260" height="260" fill="none" stroke="blue"/> |
| 65 |
</g> |
| 66 |
|
| 67 |
<g enable-background="new" transform="translate(810,0)"> |
| 68 |
<desc>The fourth invokes ShiftBGAndBlur on the triangle.</desc> |
| 69 |
<rect x="25" y="25" width="100" height="100" fill="red"/> |
| 70 |
<g opacity=".5"> |
| 71 |
<circle cx="125" cy="75" r="45" fill="green"/> |
| 72 |
<polygon points="160,25 160,125 240,75" fill="blue" |
| 73 |
filter="url(#ShiftBGAndBlur)"/> |
| 74 |
</g> |
| 75 |
<rect x="5" y="5" width="260" height="260" fill="none" stroke="blue"/> |
| 76 |
</g> |
| 77 |
|
| 78 |
<g enable-background="new" transform="translate(1080,0)"> |
| 79 |
<desc>The fifth invokes ShiftBGAndBlur_WithSourceGraphic on the triangle.</desc> |
| 80 |
<rect x="25" y="25" width="100" height="100" fill="red"/> |
| 81 |
<g opacity=".5"> |
| 82 |
<circle cx="125" cy="75" r="45" fill="green"/> |
| 83 |
<polygon points="160,25 160,125 240,75" fill="blue" |
| 84 |
filter="url(#ShiftBGAndBlur_WithSourceGraphic)"/> |
| 85 |
</g> |
| 86 |
<rect x="5" y="5" width="260" height="260" fill="none" stroke="blue"/> |
| 87 |
</g> |
| 88 |
</svg> |
| 89 |
|