Code Horizontal :
كود: تحديد الكل
public class HoriPic{
   public  static void mirrorHorizontal(Picture p)
 {
 {
   int mirrorPoint = p.getHeight() / 2;
   Pixel leftPixel = null;
   Pixel rightPixel = null;
   // loop through the rows
   for (int y = 0; y < p.getWidth(); y++)
   {
     // loop from 0 to just before the mirror point
     for (int x = 0; x < mirrorPoint; x++)
     {
         leftPixel = p.getPixel(x, y);
       rightPixel = p.getPixel(x,p.getWidth()-y-1);
       rightPixel.setColor(leftPixel.getColor());
     }
   }
 }
 
   }
}
  كود: تحديد الكل
ArrayIndexOutOfBoundsException: Coordinate out of bounds!
  at sun.awt.image.ByteInterleavedRaster.getDataElements(Unknown Source)
  at java.awt.image.BufferedImage.getRGB(Unknown Source)
  at SimplePicture.getBasicPixel(SimplePicture.java:300)
  at Pixel.getAlpha(Pixel.java:72)
  at Pixel.setColor(Pixel.java:212)
  at HoriPic.mirrorHorizontal(HoriPic.java:18)
  at Pic.main(Pic.java:50)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
> HELP