我希望使用CamanJS (http://camanjs.com/guides/)或其他类似工具对<svg>
元素中的图像进行一些客户端图像操作。
示例代码如下所示...
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="624" height="793" id="svg_3162" style="width: 639px;">
<desc>Created with Rapha�l</desc>
<defs></defs>
<rect x="15" y="150" width="24" height="24" r="0" rx="0" ry="0" fill="#ff0000" stroke="none"></rect>
<rect x="7" y="174" width="24" height="24" r="0" rx="0" ry="0" fill="#000000" stroke="none"></rect>
MORE SVG STUFF
<image x="35" y="0" width="600" height="769" preserveAspectRatio="none" xlink:href="https://s3.amazonaws.com/path/to/image.jpg"></image>
MORE SVG STUFF
</svg>
<svg>
标记中的<image>
标记似乎是问题所在。有没有人知道CamanJS能不能用这个?或者是否有类似的东西可以在这个场景中工作?
发布于 2018-09-29 21:19:03
使用foreignObject并设置高度、宽度、x和y位置
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="624" height="793" id="svg_3162" style="width: 639px;">
<desc>Created with Rapha�l</desc>
<defs></defs>
<rect x="15" y="150" width="24" height="24" r="0" rx="0" ry="0" fill="#ff0000" stroke="none"></rect>
<rect x="7" y="174" width="24" height="24" r="0" rx="0" ry="0" fill="#000000" stroke="none"></rect>
MORE SVG STUFF
MORE SVG STUFF
https://stackoverflow.com/questions/52564725
复制相似问题