使用模糊滤镜时,Safari呈现错误的颜色 [英] Safari renders wrong colors when using blur filter

查看:136
本文介绍了使用模糊滤镜时,Safari呈现错误的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将模糊滤镜应用于svg元素,但似乎Safari无法正确渲染颜色。这是我的问题的一个例子:

 < svg height =110width =110> 
< defs>
< filter id =f1x =0y =0>
< feGaussianBlur stdDeviation =15/>
< / filter>
< / defs>
< rect width =90height =90stroke-width =3fill =#ff4300filter =url(#f1)/>
< / svg> b


$ b

nofollow noreferrer> http://jsfiddle.net/6gZ8t/1/



Safari:



< Chrome:

p>



这个颜色在所有brwoser expet Safari中都是正确的,它的亮度更高......有人知道这个问题的解决方法吗?

解决方案

Safari的默认颜色插值(linearRGB)似乎在最近的更新中被打破。如果您在过滤器中全面切换到sRGB,您将获得更正确的结果(尽管它们全部经过伽玛校正)。

 < filter id =f1x =0y =0color-interpolation-filters =sRGB> 


I try to apply a blur filter to a svg elment, but it seems that Safari can't render the colors right. Here is an example of my problem:

<svg height="110" width="110">
    <defs>
          <filter id="f1" x="0" y="0">
               <feGaussianBlur stdDeviation="15" />
          </filter>
    </defs>
        <rect width="90" height="90"  stroke-width="3" fill="#ff4300" filter="url(#f1)" />
</svg>

http://jsfiddle.net/6gZ8t/1/

Safari:

Chrome:

The color is right in every brwoser expet Safari, where it is much brighter...Does anyone know a fix for this?

解决方案

Safari's default color interpolation (linearRGB) seems to be broken in recent updates. If you switch to sRGB across the board in your filters, you will get more correct results (although they'll all be gamma corrected).

<filter id="f1" x="0" y="0" color-interpolation-filters="sRGB">

这篇关于使用模糊滤镜时,Safari呈现错误的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆