Reputation: 2787
I have this code in which I want to add a feGaussianBlur
to a <rect/>
element:
<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="1000">
<defs>
<filter id="f">
<feGaussianBlur in="SourceGraphic" stdDeviation="20"/>
</filter>
</defs>
<rect x="100" y="100" height="200" width="180" fill="green" filter="url(#f)"/>
</svg>
The output is rendered like this:
As you can see, that the sides are not softened. The sides have a hard border.
But, when I decrease the value of the stdDeviation
, it works well. Here is the output if the value of stdDeviation
is set to 10:
Why is it not working properly with a value greater than 10? And what can I do to achieve it?
Upvotes: 1
Views: 1483
Reputation: 2753
If you're using this on the web, you can solve this with a single line of CSS:
svg { overflow: visible; }
This will allow the SVG to bleed out beyond the edge of the element.
Upvotes: -1
Reputation: 14565
Expand the filter region
x="-20%" y="-20%" width="150%" height="150%"
<svg xmlns="http://www.w3.org/2000/svg" width="1000" height="1000">
<defs>
<filter id="f" x="-20%" y="-20%" width="150%" height="150%">
<feGaussianBlur in="SourceGraphic" stdDeviation="20"/>
</filter>
</defs>
<rect x="100" y="100" height="200" width="180" fill="green" filter="url(#f)"/>
</svg>
Upvotes: 8