简体   繁体   English

如何在OpenVG上下文中导入SVG?

[英]How can I import SVG in an OpenVG context?

I have a C program that uses OpenVG to display vector animations. 我有一个使用OpenVG来显示矢量动画的C程序。 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. 所有对象都是通过一次又一次地编写VG函数来创建的。我和一位艺术家合作,他可以​​向我提供矢量图片的SVG文件。 So my objective is to display these SVG in my OpenVG context but I can't find any way. 因此,我的目标是在我的OpenVG上下文中显示这些SVG,但我找不到任何方法。

Firstly I worked with SVGconv( http://svgconv.blasiussecundus.me ) but his creator told me that it's not supported from 10 years... 首先,我与SVGconv( http://svgconv.blasiussecundus.me )合作,但是他的创建者告诉我,十年来一直不支持它。

Maybe important detail : the program run on a RaspberryPi. 也许重要的细节:该程序在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... 在我看来,有以下解决方案:1)VG中存在一个导入SVG的函数,但我错过了2)一个有效的解析器在网络上某处...

What is your opinion ? 你有什么意见 ?

Thank you 谢谢

Have you tried this tool to do your conversion? 您是否尝试过使用此工具进行转换? http://svgconv.sourceforge.net/ http://svgconv.sourceforge.net/

1)No function exists to display svg. 1)不存在显示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.). OpenVG的级别高于OpenGL的级别,但它仍然是低级别的库(全局函数,主要通过这些函数设置主要参数,创建上下文的困难过程等)。

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. 2)“有效的解析器位于Web上的某处”-大量的解析器,但我还没有看到任何具有完整svg支持的解析器。 So anyway you need a knowledge of low-level graphics programming. 因此,无论如何,您都需要了解底层图形编程。 It could be much easier to write your one via for example cocos2d. 通过例如cocos2d编写您的脚本可能会容易得多。

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. http://www.khronos.org/openvg/上,您会看到提到支持“ SVG”和“ Flash”的OpenVG,这只是用于市场营销,在OpenVG中没有针对“ SVG”或“ Flash”的特殊功能。 。

What there referring to is SVG and Flash are supported via "Path Rendering". 通过“路径渲染”支持SVG和Flash。

Example: 例:

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

在此处输入图片说明

For things like shapes in SVG ... 对于诸如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. OpenVG中有一些特殊功能可以绘制矩形等。

But OpenVG is all about "Path Rendering, Clipping, Shaders, ..." for SVG support in OpenVG you just need an XML Parsing Library. 但是,对于OpenVG中的SVG支持,OpenVG仅涉及“路径渲染,剪切,着色器...”,您只需要一个XML解析库即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM