Beispiel:SVG-Filter-01-Blend.html
Aus SELFHTML-Wiki
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css">
<style>
svg {
width: 96%;
padding:0;
margin:0;
background: white;
}
</style>
<title>SVG-Urfilter: feBlend</title>
</head>
<body>
<h1>SVG-Urfilter: feBlend</h1>
<svg viewBox="0 0 780 500" >
<defs>
<symbol id="kreis">
<circle cx="50" cy="50" r="50" fill="#3983ab" ></circle>
</symbol>
<symbol id="viereck">
<rect x="0" y="0" width="100" height="100" fill="#dfac20" />
</symbol>
<symbol id="rastergrafik">
<image x="0" y="0" width="100px" height="100px"
href="http://wiki.selfhtml.org/images/a/a6/Lauf-1.jpg">
</symbol>
<!-- 5 Filter mit feBlend und feTurbulence -->
<filter id="blend0">
<feTurbulence in="SourceGraphic"
baseFrequency=".2" type="fractalNoise"
/>
</filter>
<filter id="blend1">
<feTurbulence in="SourceGraphic"
baseFrequency=".2" type="fractalNoise"
result="out1" />
<feBlend in="SourceGraphic" in2="out1"
mode="normal" />
</filter>
<filter id="blend2">
<feTurbulence in="SourceGraphic"
baseFrequency=".2" type="fractalNoise"
result="out1" />
<feBlend in="SourceGraphic" in2="out1"
mode="screen" />
</filter>
<filter id="blend3">
<feTurbulence in="SourceGraphic"
baseFrequency=".2" type="fractalNoise"
result="out1" />
<feBlend in="SourceGraphic" in2="out1"
mode="darken" />
</filter>
<filter id="blend4">
<feTurbulence in="SourceGraphic"
baseFrequency=".2" type="fractalNoise"
result="out1" />
<feBlend in="SourceGraphic" in2="out1"
mode="lighten" />
</filter>
<filter id="blend5">
<feTurbulence in="SourceGraphic"
baseFrequency=".2" type="fractalNoise"
result="out1" />
<feBlend in="SourceGraphic" in2="out1"
mode="multiply" />
</filter>
</defs>
<rect width="100" height="100" Y="50"
transform="translate(0,0)"
filter="url(#blend0)"
/>
<!-- mode="normal" -->
<text x="130" y="22">normal</text>
<use href="#kreis"
transform="translate(130,50)"
filter="url(#blend1)"
/>
<use href="#viereck"
transform="translate(130,200)"
filter="url(#blend1)"
/>
<use href="#rastergrafik"
transform="translate(130,350)"
filter="url(#blend1)"
/>
<!-- mode="screen" -->
<text x="260" y="22">screen</text>
<use href="#kreis"
transform="translate(260,50)"
filter="url(#blend2)"
/>
<use href="#viereck"
transform="translate(260,200)"
filter="url(#blend2)"
/>
<use href="#rastergrafik"
transform="translate(260,350)"
filter="url(#blend2)"
/>
<!-- mode="darken" -->
<text x="390" y="22">darken</text>
<use href="#kreis"
transform="translate(390,50)"
filter="url(#blend3)"
/>
<use href="#viereck"
transform="translate(390,200)"
filter="url(#blend3)"
/>
<use href="#rastergrafik"
transform="translate(390,350)"
filter="url(#blend3)"
/>
<!-- mode="lighten" -->
<text x="520" y="22">lighten</text>
<use href="#kreis"
transform="translate(520,50)"
filter="url(#blend4)"
/>
<use href="#viereck"
transform="translate(520,200)"
filter="url(#blend4)"
/>
<use href="#rastergrafik"
transform="translate(520,350)"
filter="url(#blend4)"
/>
<!--mode="multiply" -->
<text x="650" y="22">multiply</text>
<use href="#kreis"
transform="translate(650,50)"
filter="url(#blend5)"
/>
<use href="#viereck"
transform="translate(650,200)"
filter="url(#blend5)"
/>
<use href="#rastergrafik"
transform="translate(650,350)"
filter="url(#blend5)"
/>
</svg>
<p>Mit dem Urfilter <code>feTurbulence</code> wird eine wolkenähnliche Textur erzeugt.</p>
<p>Diese wird dann mit dem feBlend-Filter mit den Eingangsgrafiken (blauer Kreis, gelbes Quadrat, Rastergrafik) zusammengelegt.</p>
</body>
</html>