How can I import SVG in an OpenVG context?

1.6k Views Asked by At

I have a C program that uses OpenVG to display vector animations. All the objects are created by writting VG functions again and again... I work with an artist who can provides me SVG files of vectorial pictures. So my objective is to display these SVG in my OpenVG context but I can't find any way.

Firstly I worked with SVGconv(http://svgconv.blasiussecundus.me) but his creator told me that it's not supported from 10 years...

Maybe important detail : the program run on a RaspberryPi.

In my mind there is to solutions : 1) a function exists in VG to import SVG but I've missed it 2) A valid parser is somewhere on the web...

What is your opinion ?

Thank you

3

There are 3 best solutions below

1
On

Have you tried this tool to do your conversion? http://svgconv.sourceforge.net/

1
On

1)No function exists to display svg. OpenVG's level is higher than OpenGL's one, but it is still low-level library (global functions, setting of main parameters mostly via these functions, difficult process of creating context and etc.).

2)"A valid parser is somewhere on the web" - a huge amount of parsers, but I haven't seen any parser with a full svg support. So anyway you need a knowledge of low-level graphics programming. It could be much easier to write your one via for example cocos2d.

1
On

On http://www.khronos.org/openvg/ you will see mention to OpenVG supporting "SVG" and "Flash", this is just for marketing and there are no special function's particular to "SVG" or "Flash" in OpenVG.

What there referring to is SVG and Flash are supported via "Path Rendering".

Example:

<path d="M300,200 h-150 a150,150 0 1,0 150,-150 z"
    fill="red" stroke="blue" stroke-width="5" />

enter image description here

For things like shapes in SVG ...

Example:

<rect x="1" y="1" width="1198" height="398"
    fill="none" stroke="blue" stroke-width="1" />

There are some special function in OpenVG to draw rectangles and such.

But OpenVG is all about "Path Rendering, Clipping, Shaders, ..." for SVG support in OpenVG you just need an XML Parsing Library.