1

I used the guides on a GIMP file to create a path which is just straight lines - no curves or anything. However, when I export the path, the SVG code uses "C" the curve indicator to draw the path. So part of the code looks like this:

<path id="Unnamed"
    fill="none" stroke="black" stroke-width="1"
    d="M 400.00,1230.00
       C 400.00,1230.00 328.00,1230.00 328.00,1230.00
         328.00,1230.00 328.00,962.00 328.00,962.00
       ...
       Z"
</path>

I want to strip out the coordinates that have been exported in this file and use them for a bunch of other things, and its obviously a trivial matter to handle the "C" format, but I"m wondering why it used C and not L and if I can get the load time faster on really complex paths if the .svg file used L.

4

3 回答 3

0

My guess is that GIMP just treats every path segment as a Bézier curve and therefore exports them to SVG as such as well. Or they simply were to lazy to implement specialized encoding of certain paths. In any event, how I see it those curves are functionally equivalent to your straight line segments. so it's still exactly the same information.

As for the load time, I think it doesn't make much of a difference. Both the XML and the path syntax have to be parsed, whether it's a few tokens more or less in the latter shouldn't make much of a difference, I think. However, as usual: If in doubt, profile :-)

于 2009-08-09T23:48:57.707 回答
0

这与路径在 GIMP 中表示为贝塞尔曲线的事实有关(正如已经正确猜测的那样)。git.gnome 中的代码gimpvectors-export.c 根据 SVG Recommendation正确导出这些曲线。

因此,每当您最终在 GIMP 中使用您的路径创建多个控制点(您基本上一直这样做)时,您最终都会得到导出的结果。

于 2013-01-24T02:35:05.290 回答
0

如果你只有直线,那么我想它在某些情况下会有所不同,因为 lineto 命令只需要指定一个点,而 curvto 需要三个点。这会使文件变大,因此可能会影响加载/解析时间。虽然可能不会很多,除非你有大量的行。

于 2009-08-10T09:00:20.247 回答