Here's the error I keep getting when trying to run my new method I'm creating.
java.lang.ArrayIndexOutOfBoundsExceptio... Coordinate out of bounds!
at sun.awt.image.ByteInterleavedRaster.getD... Source)
at java.awt.image.BufferedImage.getRGB(Unkn... Source)
at SimplePicture.getBasicPixel(SimplePictur...
at Pixel.getColor(Pixel.java:184)
at Picture.rotate(Picture.java:253)`
Here's the code-
public Picture rotate () {
Picture newPic = new Picture(getWidth(),getHeight());
for (int x=0;x<getWidth();x++)
for (int y=0;y<getHeight()*2;y++) {
Pixel a = getPixel (x,y);
Pixel c = getPixel (getWidth()-1-x,y);
a.setColor (c.getColor());
c.setColor (a.getColor());
}
return newPic;
}
Could anyone help?