Skip to content

moissinac/SuperPath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SuperPath

Proposed extension for SVG

For now, conceived as a proof of concept, but can be useful and seems working well.

If you write a scientific paper and use that code, thank's to cite me as follow:

Moissinac, J.-C.; Concolato, C.; Le Feuvre, J., "Super Path: A Necessary Primitive for Vector Graphic Formats," Advances in Multimedia (MMEDIA), 2010 Second International Conferences on , vol., no., pp.191,195, 13-19 June 2010

doi: 10.1109/MMEDIA.2010.39

URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=5501583&isnumber=5501582

SuperPathExpander.js

Script which expand instances of the superpath extension to produce a standard SVG 1.1 file. Implements L, l, Q, q, C, c, T, t, S, s, a, A, h, H, v, V

A typical usage is:

  • add this script in your svg file with the line
  <script type="application/ecmascript" xlink:href="SuperPathExpander.js" />
  • add that code for the onload event in the main svg element
 onload="superpath.expandPaths()"

Then, the principle is to define chunk of path as part of a path by associating id to that part, then to use it with the commands # or ! in the data for other path. The chunk is then defined after translation in a sequence of relatives commands deduced from tha source path.

#idOfMyChunk|

insert a copy of the chunk with id idOfMyChunk (a | must follow the id; it's the separator with what follows)

!idOfMyChunk|

insert a copy of the chunk with id idOfMyChunk (a | must follow the id; it's the separator with what follows) but after reversing the commands (from the end to the begining, and processing them to follow the same geometry from the end to the begining)

See http://moissinac.github.io/SuperPath/ for samples (which are also in the Samples directory of the repositoty)

See https://github.com/moissinac/SuperPath/wiki/In-progress-new-implementation-of-SuperPath for the specification and some known issues

bitHound Score