Beispiel:SVG-Filter-08.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" type="text/css" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css" />  
  <style>
svg {
  width: 96%;
  padding:0;
  margin:0;
  background: white;
}
  </style>
  <title>Beispiel: feFlood</title>
</head>
 
<body>
<h1>SVG-Filter feFlood</h1>

<main>
<svg viewbox="0 0 1000 750">
  <defs>	
    <filter id="f1" width="100%" height="100%" >
      <feFlood flood-color="skyblue"  />
    </filter>
    <filter id="f2" width="100%" height="100%">
      <feFlood flood-color="skyblue" flood-opacity=".5" />
    </filter>
	
<!-- zusätzlich mit feComposite -->
    <filter id="f3" width="100%" height="100%">
      <feFlood flood-color="skyblue" 
        result="out1" />
      <feComposite in="SourceGraphic" in2="out1"
        operator="over" />
    </filter>
    <filter id="f4" width="100%" height="100%">
      <feFlood flood-color="skyblue" 
        result="out1" />
      <feComposite in="SourceGraphic" in2="out1"
        operator="arithmetic"
        k1="0" k2="1" k3="1" k4="0" />
    </filter>
    <filter id="f5" width="100%" height="100%">
      <feFlood flood-color="skyblue" 
        result="out1" />
      <feComposite in="out1" in2="SourceGraphic"
        operator="in" />
    </filter>
	
<!-- zusätzlich mit feComposite und feBlend -->
    <filter id="f6" width="100%" height="100%">
      <feFlood flood-color="skyblue" 
        result="out1" />
      <feComposite in="out1" in2="SourceGraphic"
        operator="over"
        result="out2" />
      <feBlend in="SourceGraphic" in2="out2"
        mode="darken" />
    </filter>
	<filter id="f7" width="100%" height="100%">
      <feFlood flood-color="sykblue" 
        result="out1" />
      <feComposite in="out1" in2="SourceGraphic"
        operator="in"
        result="out2" />
      <feBlend in="SourceGraphic" in2="out2"
        mode="multiply" />
    </filter>
    <symbol id="bild" >
	  <image x="0" y="0" width="200px" height="200px"
         xlink:href="http://wiki.selfhtml.org/images/f/fe/Doppeldecker.svg">
        <title>Doppeldecker</title>
      </image>		
	</symbol>
  </defs>

  <text x="20" y="25"> ohne Filter</text>
  <use xlink:href="#bild" transform="translate(20,50) " />
  
  <text x="250" y="25" font-weight="bold"> Füllung mit Farbe</text>
  <text x="250" y="50"> opacity="1"</text>
  <use xlink:href="#bild" transform="translate(250,80)"
    filter="url(#f1)" />
  <text x="250" y="290"> opacity="0.5"</text>	
  <use xlink:href="#bild" transform="translate(250,320)"
    filter="url(#f2)" />
	
  <text x="500" y="25" font-weight="bold"> feFlood - feComposite</text> 	
  <text x="500" y="50"> operator="over"</text>
  <use xlink:href="#bild" transform="translate(500,80)"
    filter="url(#f3)" />
<text x="500" y="290"> operator="arithmetic"</text>	
  <use xlink:href="#bild" transform="translate(500,320)"
    filter="url(#f4)" />
	<text x="500" y="550"> operator="in"</text>
  <use xlink:href="#bild" transform="translate(500,580)"
    filter="url(#f5)" />
	
  <text x="750" y="25" font-weight="bold"> feFlood, feComposite, feBlend</text>
  <text x="750" y="50"> operator="over" mode="darken"</text>
  <use xlink:href="#bild" transform="translate(750,80)"
    filter="url(#f6)" />
  <text x="750" y="290">operator="in" mode="multiply"</text>
  <use xlink:href="#bild" transform="translate(750,320)"
    filter="url(#f7)" />	

</svg>

</main>
</body>
</html>