有没有办法将矢量图形整合到LibGDX开发中? [英] Is there a way to incorporate vector graphics into LibGDX development?

查看:60
本文介绍了有没有办法将矢量图形整合到LibGDX开发中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 LibGDX 中找不到任何可用于矢量图形的东西.

I haven't found anything in LibGDX that would work with vector graphics.

帖子建议

This post suggests that AGG is close as it gets, they also mentioned that it is a lot of pain.

有没有痛苦的选择?

推荐答案

目前(2013年中),似乎并没有对Libgdx中的矢量图形进行任何轻松的支持.首先,对于矢量图形,通常在实践中意味着 SVG .

There does not seem to be any painless support for vector graphics in Libgdx at this point (mid-2013). First, for vector graphics generally that means SVG in practice.

通用" SVG解决方案的部分问题在于,使其能够与所有各种极端情况一起使用似乎是一个问题.但是,如果您只是尝试呈现自己的SVG对象,则可能需要处理一个更简单的SVG子集,并且破解某些内容可能对您有用(即使它对每个人都不够通用).

Part of the problem with a "generic" SVG solution is that getting it to work with all the various corner cases seems to be an issue. However, if you are just trying to render your own SVG objects, you may have a simpler subset of SVG to deal with and hacking something up may work for you (even if its not generic enough for everybody).

此外,如果您愿意使用位图作为中介(不需要将矢量图形直接渲染到屏幕上),则只需找到基于Java的SVG解析器和光栅化器(相对于一个).使用Libgdx或LWJGL后端).

Additionally, if you're willing to use bitmaps as an intermediary (you don't need to render the vector graphics directly to the screen), you just need to find a Java-based SVG parser and rasterizer (vs. one that uses a Libgdx or LWJGL backend).

请参见将SVG文件与libgdx一起使用.这里的建议是使用Libgdx ShapeRenderer 用于简单的可缩放"图形.它不是SVG,但对于您的用例来说可能是合理的.

See Using SVG files with libgdx. The suggestion here is to use the Libgdx ShapeRenderer for simple "scalable" graphics. Its no SVG, but its might be reasonable for your use case.

Google搜索启用了

Google searches turned up this GPL'd Java SVG renderer that uses an AWT backend. This code looks simple enough that it could be adapted to use Libgdx rendering. But, given how simple it is, its not clear how much of SVG is actually supports (or if it even works at all).

Apache Batik 项目是通用Java SVG解析器和渲染器.看起来很棒.您可能可以将其转换为.png格式的SVG(然后将其转换为Libgdx Pixmaps). (我对此没有任何经验.)

The Apache Batik project is a generic Java SVG parser and renderer. It looks enormous. You may be able to get it to render SVG into .png format (and then convert those into Libgdx Pixmaps). (I don't have any experience with this.)

有一个(死点?)

There is a (dead?) libgdx SVG extension project but it looks like only the most basic SVG parsing has been completed.

这篇关于有没有办法将矢量图形整合到LibGDX开发中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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