【问题标题】:chained svg filters with feMorphology causes white image in firefox when radius is zero当半径为零时,带有 feMorphology 的链式 svg 过滤器会在 Firefox 中导致白色图像
【发布时间】:2015-10-08 20:15:42
【问题描述】:

我有以下带有链式过滤器的 svg(无操作参数)。这显示了 chrome 中的图像,而不是 Firefox 中的图像。

https://jsfiddle.net/8hpu033j/

<filter  id="filter0" class="image-filter">

                    <feGaussianBlur color-interpolation-filters="sRGB"  stdDeviation="0" result="out1" ></feGaussianBlur>
                    <feColorMatrix color-interpolation-filters="sRGB" type="saturate"  result="out2"  in="out1" values="1"></feColorMatrix>
                    <feColorMatrix color-interpolation-filters="sRGB" type="hueRotate"  result="out3" in="out2" values="0"></feColorMatrix>
                    <feMorphology color-interpolation-filters="sRGB" operator="dilate" result="out4" in="out3" radius="0"></feMorphology>

                  </filter>

如果我将 0.001(windows)或 0.0001(mac)添加到 feMorphology radius-attribute,图像也会在 Firefox 中显示。

https://jsfiddle.net/zbeyhvq7/

<filter  id="filter0" class="image-filter">

                    <feGaussianBlur color-interpolation-filters="sRGB"  stdDeviation="0" result="out1" ></feGaussianBlur>
                    <feColorMatrix color-interpolation-filters="sRGB" type="saturate"  result="out2"  in="out1" values="1"></feColorMatrix>
                    <feColorMatrix color-interpolation-filters="sRGB" type="hueRotate"  result="out3" in="out2" values="0"></feColorMatrix>
                    <feMorphology color-interpolation-filters="sRGB" operator="dilate" result="out4" in="out3" radius="0.001"></feMorphology>

                  </filter>

似乎在Firefox中feMorphologyFilter的值半径不能为0。如果我删除最后一个过滤器,一切都很好。

我在做某事吗?这里错了还是这是一个 Firefox 错误?

【问题讨论】:

    标签: firefox svg svg-filters


    【解决方案1】:

    来自SVG specification

    radius = ""

    ...

    零值禁用给定过滤器基元的效果(即,结果是透明的黑色图像)。

    所以 Firefox 是按照规范做的,不是吗?随时报告 Chrome 错误。

    【讨论】:

    • 我也发现了,但我认为这句话有点误导。似乎 webkit 的人已经阅读了句子的第一部分,而 mozilla 则在括号中给出了示例。奇怪的是,如果设置了默认值,所有其他过滤器都不会做任何事情。
    • @mojomajor 我们可以把范围从 mozilla guy 缩小到基本上是 it was me
    猜你喜欢
    • 2016-06-07
    • 2013-07-26
    • 1970-01-01
    • 1970-01-01
    • 2016-08-22
    • 2018-07-16
    • 2014-07-13
    • 2019-04-22
    • 2015-06-30
    相关资源
    最近更新 更多