Safari 中遮罩形状上的 SVG 过滤器未渲染
我正在使用蒙版从 SVG 形状中切出一个圆圈。我想要带有羽化边缘的聚光灯效果,因此我使用高斯模糊滤镜在 Firefox 和 Chrome 中实现此目的,但由于某种原因我无法让 Safari 渲染该滤镜。这与它是掩模定义中的形状有什么关系吗?我读到 Webkit 过去需要设置一个标志来启用 SVG 过滤器。会是这样吗?
这是过滤器定义:
<defs>
<filter id="blur_alpha" x="-1" y="-1" width="100" height="100" filterUnits="objectBoundingBox">
<feGaussianBlur result="blur_alpha_blur" in="SourceAlpha" stdDeviation="10"/>
</filter>
</defs>
这是实现它的 SVG:
<svg version="1.1" width="360" height="515" viewBox="0 0 360 515">
<defs>
<mask id="circle_mask0" x="0" y="0" width="360" height="515" maskUnits="userSpaceOnUse">
<rect x="0" y="0" width="360" height="515" stroke-width="0" fill="white" opacity="0.8"/>
<circle cx="514" cy="492" r="129.6" stroke-width="0" fill="black" opacity="1" filter="url(#blur_alpha)"/>
</mask>
</defs>
<rect x="0" y="0" width="360" height="515" stroke-width="0" mask="url(#circle_mask0)" opacity="1"/>
</svg>
我已经尝试在同一个 SVG 中定义过滤器、更改过滤器单元等。这里有一个链接可以查看它。在 Chrome/Firefox 中尝试,然后在 Safari 中尝试: soundandtheshadow.com
更新
在 Safari 中搜索 SVG 滤镜的其他应用程序,我注意到没有过滤器正在渲染。显然这是我的 Safari 版本上的错误,我通过浏览器提交了错误报告。如果有人对如何让这个问题得到更多关注有更好的建议,请告诉我。如果有人有解决方法,我会保留这个问题!
I'm using a mask to cut out a circle from my SVG shape. I'm going for a spotlight effect with a feathered edge so I'm using a Gaussian blur filter to achieve this in Firefox and Chrome, but for some reason I cannot get Safari to render the filter. Could this have anything to do with it being a shape within a mask definition? I read that Webkit used to require a flag to be set to enable SVG filters. Could that be it?
Here's the filter definition:
<defs>
<filter id="blur_alpha" x="-1" y="-1" width="100" height="100" filterUnits="objectBoundingBox">
<feGaussianBlur result="blur_alpha_blur" in="SourceAlpha" stdDeviation="10"/>
</filter>
</defs>
Here's the SVG implementing it:
<svg version="1.1" width="360" height="515" viewBox="0 0 360 515">
<defs>
<mask id="circle_mask0" x="0" y="0" width="360" height="515" maskUnits="userSpaceOnUse">
<rect x="0" y="0" width="360" height="515" stroke-width="0" fill="white" opacity="0.8"/>
<circle cx="514" cy="492" r="129.6" stroke-width="0" fill="black" opacity="1" filter="url(#blur_alpha)"/>
</mask>
</defs>
<rect x="0" y="0" width="360" height="515" stroke-width="0" mask="url(#circle_mask0)" opacity="1"/>
</svg>
I've already tried defining the filter within the same SVG, changing the filter units, etc. Here's a link to see it. Try it in Chrome/Firefox and then in Safari: soundandtheshadow.com
Update
Searching around for other applications of SVG filters in Safari, I noticed that no filters were rendering. Apparently this is a bug on my version of Safari, I submitted a bug report through the browser. If anyone has better advice on how to get this issue more attention, please let me know. I'll keep the question open in case somebody has a workaround!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是一个错误。当前版本的 Safari 中只是没有实现 SVG 过滤器(或者更确切地说,它是在 Webkit 中没有过滤器支持的情况下构建的)。
此表可能对您有用:http://caniuse.com/svg-filters
UPD :在给出答案时,Safari 6(支持 SVG 过滤器)已经发布了一段时间。
This is not a bug. SVG filters are just not implemented (or, rather, it is built without filter support in Webkit) in the current version of Safari.
This table might be useful to you: http://caniuse.com/svg-filters
UPD: At the moment of the answer being awarded, Safari 6 (which supports SVG filters) is out for some time.