简体   繁体   English

SVG中的CamanJS?

[英]CamanJS in SVG?

I'm looking to do some client-side image manipulation using CamanJS ( http://camanjs.com/guides/ ) or some other tool like it on an image within an <svg> element. 我正在寻找使用CamanJS( http://camanjs.com/guides/ )或诸如<svg>元素内的图像上的其他工具进行一些客户端图像处理的方法。

Sample code is like this... 示例代码是这样的...

<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>

It's getting to the <image> tag in the <svg> tag that seems to be the issue. 到达<svg>标记中的<image>标记似乎是问题所在。 Does anyone know if CamanJS can work with this? 有人知道CamanJS是否可以使用它吗? Or if there's something similar out there that can work in this scenario? 还是如果有类似的东西可以在这种情况下工作?

use foreignObject and set height, width, x, and y positions as well 使用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 更多SVG素材

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM