将带有过滤器的 SVG 转换为 Android 矢量可绘制对象

Convert SVG with filters to Android Vector Drawable

我需要转换包含 filter 标签的 SVG 文件,这些标签通常由 fe* 标签组成。 (feFlood, feGaussianBlur,...) Android Asset Studio 和其他工具无法处理它,我唯一想到的是在矢量绘图中使用渐变,但它只适合 SVG 中的 linearGradient。 例如,Asset Studio 无法转换此代码

<svg width="230" height="120"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink">

 <filter id="blurMe">
    <feGaussianBlur in="SourceGraphic" stdDeviation="5" />
 </filter>

 <circle cx="60"  cy="60" r="50" fill="green" />

 <circle cx="170" cy="60" r="50" fill="green"
      filter="url(#blurMe)" />
</svg>

有人可以提供转换此类标签的算法吗?

<filter><feGuaussianBlur> 是 SVG 过滤器元素。他们向 SVG 元素添加位图滤镜效果。

Android VectorDrawables does not support SVG filters.

如果您可以在没有滤镜效果(模糊)的情况下生活,请编辑您的 SVG 文件并删除 it/them。然后再次尝试导入。

如果您需要模糊效果,那么您将无法使用 VectorDrawable. 您将不得不使用位图图像。