SVG Gaussian Blur
An SVG Filter must be defined within a <defs> tag.
Gaussian Blur
The <filter> tag is used to define an SVG filter. The <filter> tag has a
required id attribute which identifies which filter will be applied to the
graphic.
The <filter> tag must be nested within a <defs> tag. The <defs> tag is short
for definitions and it allows definition of special
elements such as filter.
Copy the following code into Notepad and save
the file as "filter1.svg". Place the file in your Web directory:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="Gaussian_Blur">
<feGaussianBlur in="SourceGraphic" stdDeviation="3" />
</filter>
</defs>
<ellipse cx="200" cy="150" rx="70" ry="40"
style="fill:#ff0000;stroke:#000000;
stroke-width:2;filter:url(#Gaussian_Blur)"/>
</svg>
|
Code explanation:
- The id attribute of the <filter> tag defines a unique name for the filter
(the same filter can be used by many elements in the document)
- The filter:url(#Gaussian_Blur) property is used to link an element to a
filter. The # character must be used when linking to the filters id
- The filter effect is defined with the <feGaussianBlur> tag. The fe
prefix is used for all filters
- The stdDeviation attribute of the <feGaussianBlur> tag defines the amount of
the blur
- The in="SourceGraphic" part defines that the effect is created from
the whole image
View example
Another example with a different stdDeviation:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="Gaussian_Blur">
<feGaussianBlur in="SourceGraphic" stdDeviation="20"/>
</filter>
</defs>
<ellipse cx="200" cy="150" rx="70" ry="40"
style="fill:#ff0000;stroke:#000000;
stroke-width:2;filter:url(#Gaussian_Blur)"/>
</svg>
|
View example

Need an easy way to get data into XML, or transform XML to another format?
MapForce lets you map XML data to/from any combination of XML, database, flat file, Excel 2007, XBRL, or Web services data.
Then it transforms data instantly or auto-generates royalty-free data integration code for recurrent conversions.
New features in Version 2010!
Download a free, fully functional 30-day trial to experience the following features:
- Easy-to-use, graphical data mapping interface
- Instant data transformation
- XSLT 1.0/2.0 and XQuery code generation
- Java, C#, and C++ code generation
- Advanced data processing functions
- Support for all major relational databases including SQL Server, IBM DB2, Oracle, and more
- Visual Studio & Eclipse integration
Download a fully-functional trial today!
|
|
|
|