Beispiel:SVG-Filter-in.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;
max-height:500px;
}
rect {
fill:skyblue;
stroke:blue;
stroke-width:5;
fill-opacity:.5;
}
circle {
fill:yellow;
stroke:red;
stroke-width:5;
fill-opacity:.5
}
</style>
<title>SVG-Filter: Eingangs- und Ergebniswert</title>
</head>
<body>
<h1>SVG-Filter: Eingangs- und Ergebniswert</h1>
<svg viewBox="50 0 680 600" >
<defs>
<filter id="sGraphic">
<feGaussianBlur stdDeviation="4" in="SourceGraphic"/>
</filter>
<filter id="sAlpha">
<feGaussianBlur stdDeviation="4" in="SourceAlpha"/>
</filter>
<filter id="bgImage">
<feGaussianBlur stdDeviation="4" in="BackgroundImage"/>
</filter>
<filter id="bgAlpha">
<feGaussianBlur stdDeviation="4" in="BackgroundAlpha"/>
</filter>
<filter id="fPaint">
<feGaussianBlur stdDeviation="4" in="FillPaint"/>
</filter>
<filter id="sPaint">
<feGaussianBlur stdDeviation="4" in="StrokePaint"/>
</filter>
</defs>
<g transform="translate(100,50)">
<text y="-5">Kein Filter</text>
<rect width="150" height="100" />
<circle cx="50" cy="100" r="50" />
</g>
<g transform="translate(300,50)">
<text y="-5">in=SourceGraphic</text>
<rect width="150" height="100" />
<circle cx="50" cy="100" r="50" filter="url(#sGraphic)"/>
</g>
<g transform="translate(500,50)">
<text y="-5">in=SourceAlpha</text>
<rect width="150" height="100" />
<circle cx="50" cy="100" r="50" filter="url(#sAlpha)"/>
</g>
<g transform="translate(300,250)" enable-background="new">
<text y="-5">in=BackgroundImage</text>
<rect width="150" height="100" />
<circle cx="50" cy="100" r="50" filter="url(#bgImage)"/>
</g>
<g transform="translate(500,250)" enable-background="new">
<text y="-5">in=BackgroundAlpha</text>
<rect width="150" height="100" />
<circle cx="50" cy="100" r="50" filter="url(#bgAlpha)"/>
</g>
<g transform="translate(300,400)">
<text y="-5">in=FillPaint</text>
<rect width="150" height="100" />
<circle cx="50" cy="100" r="50" filter="url(#fPaint)"/>
</g>
<g transform="translate(500,400)">
<text y="-5">in=StrokePaint</text>
<rect width="150" height="100" />
<circle cx="50" cy="100" r="50" filter="url(#sPaint)"/>
</g>
</svg>
<p>Die Werte <code>BackgroundImage, BackgroundAlpha</code> funktionieren nicht im Firefox;<br>
<code>BackgroundImage, BackgroundAlpha, FillPaint, StrokePaint</code> nicht im Safari.<br>
in Chrome, Edge und Opera werden <code>BackgroundImage, BackgroundAlpha, FillPaint, StrokePaint</code> als <b>sourceGraphic</b> dargestellt.</p>
</body>
</html>