Java texture png modificaiton

不打扰是莪最后的温柔 提交于 2019-12-24 20:06:20

问题


I'm trying to make a simple java game. I have some png file that i want to draw, but first i want to make some modification on that png. I would like to take a png, and delete to background some parts of it and add some colored lines.. For my game im using libgdx. I dont know what to use for this, so i can search on google about it and learn. Few hints, about what functions i should use could be awesome, Ty.

P.S. I tryed to search on internet before post here, but i didnt find something that could help me, probably idk what to search.v

Edit: I found Pixmap from libgdx, but i can delete to background. Any advices ?

Edit2: i want to load this texture

multiplicate when needed (no problem here) and delete some parts of it, to background, so it will take this shape:

by using pixmap, when im drawing background over it, nothing is happen, because its draw over, not instead of. What i could make, was using pixmap to draw the top part, that i want to delete, and manualy delete it using external programs:


回答1:


I think you might want to look at a "mask" image. There are some approaches listed here: https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-Masking

Alternatively, you could use create a mesh that encodes the "ground" (with the bump) and then texture it. OpenGL would take care of truncating the edge of the mesh. Try: Drawing textured polygons with libgdx

Another approach is to just draw the dirt texture on the full screen, and then draw the "background" over it. You will need to make pixels in the "background" image transparent so the dirt will show through. Whatever pixel editor you are using should be able to do that. Alternatively, pick a "key" color and convert those pixels to transparent when you load the image as a pixmap.




回答2:


I don't know if this question is serious, but you cannot do what you're asking in Java. You need a photo editing software such as Photoshop or GIMP.



来源:https://stackoverflow.com/questions/19361733/java-texture-png-modificaiton

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!