Hello,
I seem to be having some difficulty copying part of one image to another image.
BufferedImage source // 160 pixels x 224 pixels
BufferedImage dest // 16 pixels by 16 pixels
What I want to do is copy a 16x16 tile from source into dest. Lets say I want to copy tile 2,2 (pixels 32-48, 32-48)
example :
Graphics g = dest.getGraphics();
g.drawImage(source, 0, 0, 16, 16, 32, 32, 16, 16, null);
This bit of code doesn't work because it seems to try to squish the entire source image into the destination image. Then I found some code that says use Graphics.setClip():
Graphics g = dest.getGraphics();
g.setClip(32,32,16,16)
g.drawImage(source, 0, 0, null)
But that doesn't work either.
I must be missing something simple because it can't be that hard to pick out a 16 x 16 tile from an image thats 160 x 224 pixels big.
EDIT: I'm a retard but I managed to fix the problem. It seems as though the problem is between the chair and the keyboard on this one.