Free SVG icons
mark at livecode.com
Wed Jan 3 10:16:09 EST 2018
On 2018-01-03 15:30, hh via use-livecode wrote:
>> BM wrote:
>> I looked briefly for something that could convert SVG to just a path.
>> Inkscape can do it, but I was more looking for something that could
>> do it in a batch run. Then you could convert the whole set.
> I'm looking for that for months. TMHO opinion inkscape can do that for
> selected shapes only. Even paper.js and also other js or java snippets
> do such a global flattening-all without loosing some properties.
> Please post whenever you find or write such a general
Assuming that 'flatten-to-path' means:
"Produce a compound path which, when filled, produces the same result as
filling and/or stroking a sequence of paths and/or shapes."
Then, in full generality, this is really quite complex - particularly if
you want to preserve curves (which is important if you want your
resulting path to scale arbitrarily).
There are two pieces:
1) A 'thicken' operation which takes a path and stroke properties as
input and produces a path which can be filled to produce the stroke.
(i.e. the 'inside' of the path is the same as the 'inside' of the stroke
of the original path).
2) A 'union' operation which takes two arbitrary paths and produces a
single path which, when filled, produces the same result as filling the
first path, and then filling and compositing the second path on top of
it. (i.e. the 'inside' of the path is the same as the union of the
'insides' of the two input paths).
Neither of these are at all straight-forward in the general case
However, if you restrict yourself to:
1) polygonal paths and elliptical arcs, sectors and segments
2) non-overlapping paths which use the same fill rule
Restricting to (1) means it is much easier to generate a thickened path
from the original - there's no pesky bezier thickening to deal with
(which is problematic because the curve which is a fixed perpendicular
distance from a bezier is not a bezier).
Restricting to (2) means that A union B == A concat B - i.e. you append
the path definition of B to A.
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode