Re: Draw part of an image
Can you paint the hex in a rectangle and then draw a polygon over it to cover up the parts you don't want to see.
Or edit the pixels of you don't want displayed and make them transparent.
Re: Draw part of an image
I would like to be able to do that, I'm just not sure how. I am putting the hexes on a solid blue background in the jpg file, but I don't know what the commands are to make that transparent when I draw it. Worst case scenario, I can make one hex per jpg, but I'll still need to make the blue background transparent so only the hex appears on my Panel. I'm not too experienced with Graphics2D and AWT, so thanks for any help you can give.
Re: Draw part of an image
I've seen code on some of the forums that set some pixels transparent. I don't remember where.
Perhaps you could use a photo editor to change some of the pixels to transparent.
What is it you are trying to draw?
Re: Draw part of an image
I'm making a map for a strategy game, out of hexes. I want to have each hex as a separate entity so I can build lots of maps out of the same small number of hexes, randomly generating maps with program rather than creating entire maps outside of Java. I could use photoshop to make a transparent background instead of blue. Would I need to load it into the Java program as a different file, like gif or png to get that to work? Because then I could just capture rectangles and the transparent parts can overlap.
Re: Draw part of an image
Write a small test program and give it a try. I've never tried to paint an image multiple times to make a grid like you seem to want to do.