android - 将带有过滤器的 SVG 转换为 Android Vector Drawable
问题描述
我需要转换包含过滤器标签的 SVG 文件,它通常由 fe* 标签组成。(feFlood,feGaussianBlur,...)Android Asset Studio 和其他工具无法处理它,我唯一想到的是在矢量可绘制中使用渐变,但它仅适用于 SVG 中的线性渐变。例如,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 文件并删除它/它们。然后再次尝试导入。
如果您需要模糊效果,那么您将无法使用 aVectorDrawable.
您将被迫使用位图图像。
推荐阅读
- php - PHP 错误:致命错误:未捕获的 PDOException:SQLSTATE [42000]:语法错误或访问冲突:1064 您的 SQL 语法有错误;
- dart - 如何将 `ByteData` 实例写入 Dart 中的文件?
- python - 在 SqlAlchemy 中加入时如何将子查询对象转换为 ResultProxy 类?
- c# - IdentityServer3 - 错误 Microsoft.IdentityModel.Tokens.SecurityTokenInvalidSignatureException:IDX10503:签名验证失败
- mysql - 从 SQL 列中删除所有字母
- java - 操作栏后退键不起作用
- php - 使用 git 终端时,laravel homestead “找不到驱动程序”
- lua - 使用 lua 文件来要求其他 lua 文件?
- webview - 单击onesignal通知时打开android webview应用程序
- php - php exec wget无法下载大文件