XML technologies / SVG / Filters, transformations and gradients / Using and combining filters and lighting effectively / Filters and masks / The feGaussianBlur element

(Excerpt from “Das Einsteigerseminar SVG — Webgrafiken mit XML” by Helma Spona)

The filter element <feGaussianBlur> creates shadows and has already been used several times. The attribute stdDeviation needs further explanation: it controls how strongly the object is blurred and how soft its edge becomes. Pass one or two numeric values. A single value controls the blur on both axes. With two values, the first controls the x axis and the second the y axis.

The attribute in also strongly affects the shadow’s appearance. With SourceAlpha, a shadow is created from the alpha channel; with SourceGraphic, it is created from the entire object. Usually this filter must be combined with others: it creates only the shadow itself, not the original element with a shadow.

The next example first creates three shadows with the values in="SourceGraphic" and different values for the attribute stdDeviation. The first element uses the value 3 for both axes; the second uses 6 for the x axis and 0 for the y axis; the third reverses those settings.

<filter id="einfach">
  <feGaussianBlur stdDeviation="3"/>
</filter>
<filter id="schatten2">
  <feGaussianBlur in="SourceGraphic" stdDeviation="6 0"/>
</filter>
<filter id="schatten3">
  <feGaussianBlur in="SourceGraphic" stdDeviation="0 6"/>
</filter>
<filter id="schatten4">
  <feGaussianBlur in="SourceAlpha" stdDeviation="6"/>
</filter>

The last filter again uses equal values on both axes, but sets the attribute in to SourceAlpha.

Results of the defined feGaussianBlur filters

Figure: Results of the defined feGaussianBlur filters.

   

 

 

 

back to top