0

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 enter image description here multiplicate when needed (no problem here) and delete some parts of it, to background, so it will take this shape: enter image description here 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: enter image description here

Rareș Smeu
  • 95
  • 1
  • 11

2 Answers2

0

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.

Troubleshoot
  • 1,816
  • 1
  • 12
  • 19
  • something like this: http://stackoverflow.com/questions/3914265/drawing-multiplie-lines-in-a-buffered-image-in-java, but i need to be able to delete some parts, or better say put transparet parts on it. – Rareș Smeu Oct 14 '13 at 14:12
  • You can draw to a BufferedImage but you cannot delete from it in such an accurate way to my knowledge. – Troubleshoot Oct 14 '13 at 14:16
  • My 2d game, its a car going on a rought route, like mountain, and for the route, i was thinking of taking a textre, adding the lines of route, and deleting what its up of it, for the sky, Could you give me an idea about how i can do this in code ? for alot of random levels ? – Rareș Smeu Oct 14 '13 at 14:21
0

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.

Community
  • 1
  • 1
P.T.
  • 24,557
  • 7
  • 64
  • 95