PlayN - 在图像上绘制 [英] PlayN - Draw on an Image
问题描述
我最近开始使用PlayN作为一个爱好项目,现在偶然发现了一个问题。
I have recently started using PlayN for a hobby project and has now stumbled upon a problem.
我想在图像上绘制一些线条和文字并保存此图片供以后使用。
在Java中我只会创建一个BufferedImage并使用它的graphicsBuffered来绘制,但我在PlayN中找不到任何类似的解决方案。
I would like to draw some lines and text onto an Image and save this image for later use. In Java I would just make a BufferedImage and use its graphicsBuffered to draw upon, but I can not find any similar solution in PlayN.
这是不是可能,如果是这样的话?
Is this at all possible, and if so how ?
我不知何故需要能够将BufferedImage转换为Image,反之亦然。
I somehow need to be able to convert a BufferedImage to an Image and the other way around.
推荐答案
创建一个CanvasImage,将您的图像绘制到CanvasImage上,然后在其上绘制文本和线条。然后,您可以在ImageLayer中使用CanvasImage将其放入场景图中。
Create a CanvasImage, draw your image onto the CanvasImage, and then draw your text and lines on top of it. You can then use the CanvasImage in an ImageLayer to put it into your scene graph.
这篇关于PlayN - 在图像上绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!