问题
I am using a drop shadow filter inside an SVG file that is embedded using an img
tag. On my MacBook, it looks fine in Safari. However, in mobile Safari, the graphic gets really pixelated and loses all it's sharpness. When the filter is not applied, the SVG renders fine. Is there any way to fix that besides to pass on the filter?
回答1:
You should try explicitly setting the "filterRes" attribute of the filter to a value that matches retina displays.
回答2:
This problem is still relevant in 2018, and I've found a solution. You can duplicate the element you give the filter to, place it below the actual element, and keep filter only on it, without any filter on the element. This way, Safari and other browsers will only rasterise the element with the shadow when resizing, however it will be hidden by the sharp-looking vector element. You can see examples and read more here.
来源:https://stackoverflow.com/questions/14664407/svg-drop-shadow-filter-pixelates-svg-on-mobile-safari