Beispiel:SVG-Filter-feConvolveMatrix2.html

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche
<!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%;
  height: 500px;
  padding:0;
}

text {
   font-family: serif; 
   font-size: 25px;
}

</style>
  <title>SVG-Urfilter: feConvolveMatrix-2</title>
</head>
 
<body>
  <h1>SVG-Urfilter: feConvolveMatrix<br>
Präge- und Scharfzeichnungsfilterr</h1>

<svg viewBox="0 0 550 600">
  <defs>
  	<filter id="KantenErkennung">
      <feConvolveMatrix 
        order="3"
        preserveAlpha="true" 
        kernelMatrix="
		  -1 -1 -1
		  -1  8 -1
		  -1 -1 -1"
		divisor="1.0"
		bias="0.0"   
		  />
	</filter>
	
	<filter id="Schärfung">
      <feConvolveMatrix 
        order="3"
        preserveAlpha="true" 
        kernelMatrix="
		  -1 -1 -1
		  -1  9 -1
		  -1 -1 -1"
		divisor="1.0"
		bias="0.0"   
		  />
	</filter>
	
	<filter id="Prägung">
      <feConvolveMatrix 
        order="3"
        preserveAlpha="true" 
        kernelMatrix="
		  -4 0 0
		   0 1 0
		   0 0 4"
		divisor="1"
		bias="0"   
		  />
	</filter>
	   <filter id="Praegung2">
      <feConvolveMatrix
        preserveAlpha="true"
        kernelMatrix="1 0 0 0 0 0 0 0 -1"
        bias="0.5"/>
    </filter>
  </defs>

<text x="10" y="30">Kantenerkennung</text>
<image x="10" y="40" width="250px" height="250px" filter="url(#KantenErkennung)"
    href="https://wiki.selfhtml.org/images/a/a6/Lauf-1.jpg">
    <title>Lauf an der Pegnitz - normal ohne Filter</title>
</image>

<g transform="translate(270,0)">
<text x="10" y="30">Schärfung</text>
<image x="10" y="40" width="250px" height="250px" filter="url(#Schärfung)" 
    href="https://wiki.selfhtml.org/images/a/a6/Lauf-1.jpg">
    <title>Lauf an der Pegnitz - normal ohne Filter</title>
</image>
</g>

<g transform="translate(0, 300)">
<text x="10" y="30">Prägung</text>
<image x="10" y="40" width="250px" height="250px" filter="url(#Prägung)" 
    href="https://wiki.selfhtml.org/images/a/a6/Lauf-1.jpg">
    <title>Lauf an der Pegnitz - normal ohne Filter</title>
</image>
</g>

<g transform="translate(270, 300)">
<text x="10" y="30">Prägung 2</text>
<image x="10" y="40" width="250px" height="250px" filter="url(#Praegung2)" 
    href="https://wiki.selfhtml.org/images/a/a6/Lauf-1.jpg">
    <title>Lauf an der Pegnitz - normal ohne Filter</title>
</image>
</g>
</svg>

</body>
</html>