📄 svg 高斯模糊.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0055)http://www.w3school.com.cn/svg/svg_filters_gaussian.asp -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>SVG 高斯模糊</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META http-equiv=Content-Language content=zh-cn>
<META content=all name=robots>
<META content=w3school.com.cn name=author>
<META content="Copyright W3school.com.cn All Rights Reserved." name=Copyright>
<META content=true name=MSSmartTagsPreventParsing>
<META http-equiv=imagetoolbar content=false><LINK href="SVG 高斯模糊_files/c1.css"
type=text/css rel=stylesheet>
<META content="MSHTML 6.00.3790.4134" name=GENERATOR></HEAD>
<BODY id=xml>
<DIV id=wrapper>
<DIV id=header>
<H1><A title=点击此处,返回首页
href="http://www.w3school.com.cn/index.html">w3school在线教程</A></H1></DIV>
<DIV id=navfirst>
<UL id=menu>
<LI id=h><A title=HTML教程 href="http://www.w3school.com.cn/h.asp">HTML教程</A>
</LI>
<LI id=x><A title=XML教程 href="http://www.w3school.com.cn/x.asp">XML教程</A>
</LI>
<LI id=b><A title=浏览器脚本 href="http://www.w3school.com.cn/b.asp">浏览器脚本</A>
</LI>
<LI id=s><A title=服务器脚本 href="http://www.w3school.com.cn/s.asp">服务器脚本</A>
</LI>
<LI id=d><A title="dot net教程" href="http://www.w3school.com.cn/d.asp">dot
net教程</A> </LI>
<LI id=m><A title=多媒体教程 href="http://www.w3school.com.cn/m.asp">多媒体教程</A>
</LI>
<LI id=w><A title=建站手册 href="http://www.w3school.com.cn/w.asp">建站手册</A>
</LI></UL></DIV>
<DIV id=navsecond>
<DIV id=course>
<H2>SVG 基础</H2>
<UL>
<LI><A title="SVG 首页" href="http://www.w3school.com.cn/svg/index.asp">SVG
首页</A>
<LI><A title="SVG 简介" href="http://www.w3school.com.cn/svg/svg_intro.asp">SVG
简介</A>
<LI><A title="SVG 实例"
href="http://www.w3school.com.cn/svg/svg_example.asp">SVG 实例</A>
<LI><A title=在HTML文档中的SVG
href="http://www.w3school.com.cn/svg/svg_inhtml.asp">SVG in HTML</A> </LI></UL>
<H2>SVG 形状</H2>
<UL>
<LI><A title="SVG 矩形" href="http://www.w3school.com.cn/svg/svg_rect.asp">SVG
矩形</A>
<LI><A title="SVG 圆形" href="http://www.w3school.com.cn/svg/svg_circle.asp">SVG
圆形</A>
<LI><A title="SVG 椭圆"
href="http://www.w3school.com.cn/svg/svg_ellipse.asp">SVG 椭圆</A>
<LI><A title="SVG 线条" href="http://www.w3school.com.cn/svg/svg_line.asp">SVG
线条</A>
<LI><A title="SVG 多边形"
href="http://www.w3school.com.cn/svg/svg_polygon.asp">SVG 多边形</A>
<LI><A title="SVG 折线"
href="http://www.w3school.com.cn/svg/svg_polyline.asp">SVG 折线</A>
<LI><A title="SVG 路径" href="http://www.w3school.com.cn/svg/svg_path.asp">SVG
路径</A> </LI></UL>
<H2>SVG 滤镜</H2>
<UL>
<LI><A title="SVG 滤镜简介"
href="http://www.w3school.com.cn/svg/svg_filters_intro.asp">SVG 滤镜简介</A>
<LI><A title="SVG 高斯滤镜"
href="http://www.w3school.com.cn/svg/svg_filters_gaussian.asp">SVG 高斯滤镜</A>
</LI></UL>
<H2>SVG 渐变</H2>
<UL>
<LI><A title="SVG 线形渐变"
href="http://www.w3school.com.cn/svg/svg_grad_linear.asp">SVG 线形渐变</A>
<LI><A title="SVG 放射渐变"
href="http://www.w3school.com.cn/svg/svg_grad_radial.asp">SVG 放射渐变</A>
</LI></UL>
<H2>SVG 实例</H2>
<UL>
<LI><A title="SVG 实例"
href="http://www.w3school.com.cn/svg/svg_examples.asp">SVG 实例</A> </LI></UL>
<H2>SVG 参考</H2>
<UL>
<LI><A title="SVG 元素"
href="http://www.w3school.com.cn/svg/svg_reference.asp">SVG 元素</A>
</LI></UL></DIV>
<DIV id=selected>
<H2>建站手册</H2>
<UL>
<LI><A title=网站构建 href="http://www.w3school.com.cn/site/index.asp">网站构建</A>
<LI><A title=W3C href="http://www.w3school.com.cn/w3c/index.asp">万维网联盟</A>
<LI><A title=浏览器信息
href="http://www.w3school.com.cn/browsers/index.asp">浏览器信息</A>
<LI><A title=网站品质 href="http://www.w3school.com.cn/quality/index.asp">网站品质</A>
<LI><A title=语义网 href="http://www.w3school.com.cn/semweb/index.asp">语义网</A>
<LI><A title=职业规划 href="http://www.w3school.com.cn/careers/index.asp">职业规划</A>
<LI><A title=网站主机 href="http://www.w3school.com.cn/hosting/index.asp">网站主机</A>
</LI></UL></DIV></DIV>
<DIV id=maincontent>
<H2>SVG 高斯模糊</H2>
<DIV id=tpn>
<UL class=prenext>
<LI class=pre><A
href="http://www.w3school.com.cn/svg/svg_filters_intro.asp">Previous Page</A>
</LI>
<LI class=next><A
href="http://www.w3school.com.cn/svg/svg_grad_linear.asp">Next Page</A>
</LI></UL></DIV>
<DIV class=intro>
<P><STRONG>必须在<defs>标签中定义SVG滤镜。</STRONG></P></DIV>
<DIV>
<H3>高斯模糊(Gaussian Blur)</H3>
<P><filter> 标签用来定义SVG滤镜。<filter> 标签使用必需的 id 属性来定义向图形应用哪个滤镜?</P>
<P><filter> 标签必须嵌套在<defs>标签内。<defs> 标签是 definitions
的缩写,它允许对诸如滤镜等特殊元素进行定义。</P>
<P>请把下面的代码拷贝到记事本,然后把文件保存为"filter1.svg"。把此文件放入您的web目录:</P><PRE><?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></PRE>
<H4>代码解释:</H4>
<UL>
<LI><filter> 标签的 id 属性可为滤镜定义一个唯一的名称(同一滤镜可被文档中的多个元素使用)
<LI>filter:url 属性用来把元素链接到滤镜。当链接滤镜 id 时,必须使用 # 字符
<LI>滤镜效果是通过 <feGaussianBlur> 标签进行定义的。fe 后缀可用于所有的滤镜
<LI><feGaussianBlur> 标签的stdDeviation属性可定义模糊的程度
<LI>in="SourceGraphic" 这个部分定义了由整个图像创建效果 </LI></UL>
<P><A href="http://www.w3school.com.cn/svg/filter1.svg">查看例子</A></P>
<P>另一个 stdDeviation 值不同的例子</P><PRE><?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></PRE>
<P><A href="http://www.w3school.com.cn/svg/filter2.svg">查看例子</A></P></DIV>
<DIV id=bpn>
<UL class=prenext>
<LI class=pre><A
href="http://www.w3school.com.cn/svg/svg_filters_intro.asp">Previous Page</A>
</LI>
<LI class=next><A
href="http://www.w3school.com.cn/svg/svg_grad_linear.asp">Next Page</A>
</LI></UL></DIV></DIV>
<DIV id=sidebar>
<DIV id=searchui>
<FORM id=searchform action=http://www.google.com/search method=get>
<P><LABEL for=searched_content>Search:</LABEL></P>
<P><INPUT type=hidden value=www.w3school.com.cn name=sitesearch></P>
<P><INPUT class=box id=searched_content title=在此输入搜索内容。 name=as_q> <INPUT class=button title=搜索! type=submit value=Go> </P></FORM></DIV>
<DIV id=tools>
<H5 id=tools_reference><A
href="http://www.w3school.com.cn/svg/svg_reference.asp">SVG 参考手册</A></H5>
<H5 id=tools_example><A
href="http://www.w3school.com.cn/example/svge_examples.asp">SVG
实例</A></H5></DIV>
<DIV id=books></DIV></DIV>
<DIV id=footer>
<P>W3School提供的内容仅用于培训。我们不保证内容的正确性。通过使用本站内容随之而来的风险与本站无关。当使用本站时,代表您已接受了本站的使用条款和隐私条款。</P>
<P>版权所有,保留一切权利。未经书面许可,不得转载。W3School(s)简体中文版授权上海蒙信网络科技有限公司在中华人民共和国运营。</P></DIV></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -