在C ++中渲染矢量图形(.svg) [英] Render a vector graphic (.svg) in C++

查看:641
本文介绍了在C ++中渲染矢量图形(.svg)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和一个朋友正在开发一个2D游戏,其中图形将是.svg文件,我们将通过先对它们进行光栅化,或者直接在表面上渲染它们来进行缩放(这仍然需要在某些点进行光栅化) 。

My and a friend are working on a 2D game where the graphics will be .svg files and we will scale them appropriately either by rasterizing them first, or rendering them directly on a surface (which still would require rasterization at some point).

问题是,我一直在寻找一个库,这将允许我采取一个.svg文件,最终得到它渲染在allegro。据我所知,它会涉及到栅格化到某种格式,allegro可以读取,然后allegro可以渲染flattened图像。

The problem is, I've been looking all day to find a library that will allow me to take an .svg file and eventually get it to render in allegro. As far as I know, it would involve rasterization into some sort of format that allegro can read and then allegro could render the "flattened" image.

那么什么是一些C库我可以用于采取.SVG文件和扁平化,所以我可以渲染它吗?

So what are some C++ libraries I could use for taking an .SVG file and "flattening" it so I can render it? The library obviously needs to support scaling too so I can scale the vector graphic then rasterize it.

我使用的是Windows和Visual C ++ Express 2010。

I'm using Windows and Visual C++ Express 2010.

任何建议都会有帮助,因为我现在很迷失:

Any suggestions would be helpful as I am very lost right now:

我试过开罗,但它只允许写.svg文件,并且不允许您读取.svg文件。我也看过与cario合作的librsvg,但是我有很多麻烦让它在Windows上正常工作(因为它有GNOME依赖的负载)。

I've tried Cairo, but it only allows writing of .svg files and doesn't allow you to read the .svg file. I've also looked into librsvg which works with Cario, but I was having a lot of trouble getting it to work properly on Windows (because it has loads of GNOME dependencies). If you have any guides for getting these to work (on Windows) that would be great too.

推荐答案

wxsvg library 允许加载和操作SVG文件。 Qt还有 SVG模块

The wxsvg library allows loading and manipulating SVG files. Qt also has an SVG module.

这篇关于在C ++中渲染矢量图形(.svg)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆