开发者

Rendering SVG shapes with crisp edges in IE9

开发者 https://www.devze.com 2023-04-02 13:51 出处:网络
IE9 appears not to honour the SVG shape-rendering=\"crispEdges\" attribute. Here\'s a sample SVG: <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>

IE9 appears not to honour the SVG shape-rendering="crispEdges" attribute.

Here's a sample SVG:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns="http://www.w3.org/2000/s开发者_如何学Cvg" height="600" id="svgroot" version="1.1" width="800" x="0" y="0">
<line style="stroke:#000000;stroke-width:1px;stroke-opacity:1" y2="300" y1="300" x2="750" x1="50" shape-rendering="crispEdges" />
</svg>

It appears correctly under Firefox and Safari, however the line appears blured under IE9 and IE10 (Platform preview)

Is there some workaround to disable the anti-aliasing in IE9?

Thanks!


You should be able to just shift the line 0.5 "pixels" vertically instead of using shape-rendering. That way the line will look sharp in all non-IE browsers at least.

<svg xmlns="http://www.w3.org/2000/svg" height="600" width="800">
  <line style="stroke:#000" y2="300.5" y1="300.5" x2="750" x1="50" />
</svg>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号