Inkscape moveTo 在 Raphael 中的协调方式

发布于 2024-08-30 08:48:12 字数 77 浏览 9 评论 0原文

我正在尝试将路径从 inkscape 复制到 Raphael(个别国家),问题是 moveTo 太远了,如何使其显示在画布上相对正确的位置?

I am trying to copy paths from inkscape into Raphael (individual countries), the problem is the moveTo is way off, how do I make it display on the relatively correct position on the canvas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掩耳倾听 2024-09-06 08:48:12

如果您尝试在画布上以相对位置绘制路径,则需要将所有绝对坐标转换为相对坐标。我最近遇到了同样的问题,并求助于计算器和纸张(这是一条很短的路径,不值得以编程方式进行攻击)。有一些工具声称能够进行这些转换,但根据我的经验,它们要么是不完整的链接,要么是过时的链接。

问题是 Inkscape 已经为您决定了您希望 SVG 文件的大小进行优化,并且每当可以节省几个字节时就会在相对和绝对之间来回切换。本质上,您需要做的是迭代路径,跟踪您的位置,将每个绝对节点与前一个节点(或原点,如果它是初始 moveTo)进行比较,并用差值替换任何绝对坐标。

Inkscape 首选项有一个强制绝对坐标的选项(取消选中“首选项”->“SVG 输出”->“允许相对坐标”),这可能会使转换更容易一些。

If you're trying to draw a path on a canvas in a relative position, you need to transform all of the absolute coordinates to relative coordinates. I had the same problem recently and resorted to a calculator and paper (it was a short path, and wasn't worth it to attack programatically). There are a few tools out there that claim to be able to do these transformations, but in my experience they were either incomplete or outdated links.

The problem is that Inkscape has already decided for you that you want your SVG files optimized for size, and will switch back and forth from relative to absolute whenever it would save a few bytes. Essentially, what you would need to do is iterate through the path, keeping track of your position, compare each absolute node to the previous node (or the origin, if it's the initial moveTo), and replace any absolute coordinates with the difference.

The Inkscape preferences have an option to force absolute coordinates, (uncheck Preferences->SVG Output->Allow relative coordinates) which may make the transformation a little easier.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文