Canvg转换-使用填充网址时的行为异常 [英] Canvg conversion - weird behavior when using a fill url

查看:92
本文介绍了Canvg转换-使用填充网址时的行为异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用canvg js库将svg转换为画布.

I'm trying to convert svg to canvas using the canvg js lib.

原始svg包含一个rect,该rect具有svg模式的url填充属性.当我使用canvg将svg转换为画布时:

The original svg contains a rect which has a fill attribute of url to a svg pattern. When I convert the svg to canvas using canvg:

canvg(document.getElementById('canvas'), svg);

矩形填充的图像会改变其比例(宽度和高度会发生变化).

The image of the rect fill changes its proportions (The width and the height change).

显示了转换前后的svg.

This shows the svg before and after the conversion.

有人有解决这个问题的想法吗?

Does anyone have an idea for solving this issue?

推荐答案

http://jsfiddle.net/L3hondLn/230/

我改变了

<pattern id="img1" width="20" height="20">

<pattern id="img1" width="200" height="200">

而且有效.

这篇关于Canvg转换-使用填充网址时的行为异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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