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

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

问题描述

我在 LibGDX 中没有找到任何适用于矢量图形的内容.

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

帖子 表明 AGG 已经很接近了,他们还提到这很痛苦.

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

有没有无痛的替代方案?

Is there a painless alternative ?

推荐答案

目前(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 搜索出现了这个 GPL 的 Java SVG 渲染器,它使用 AWT 后端.这段代码看起来很简单,可以适应使用 Libgdx 渲染.但是,鉴于它的简单程度,尚不清楚实际支持多少 SVG(或者它是否完全有效).

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 解析器和渲染器.它看起来很大.您也许可以将 SVG 渲染为 .png 格式(然后将其转换为 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.)

有一个(死了?)libgdx SVG 扩展项目 但是貌似只完成了最基本的 SVG 解析.

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天全站免登陆