أحتاج مساعده في الجافا

كل ما يهم مطور المواقع ... لغات برمجة المواقع .. سكربتات .. مناقشات ..
مغلق
Some1
عضو جديد
مشاركات: 1
اشترك في: 03 ديسمبر 2008, 13:57

أحتاج مساعده في الجافا

مشاركة بواسطة Some1 »

when i do the Vertical mirror for a picture it apears fine but when i tryed to do the Horizontal there is an error apears:

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());
     }
   }
 }
 
   }
}
 

the error when i try to run it :


كود: تحديد الكل

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
saanina
عبدالرحمــــن
مشاركات: 3762
اشترك في: 30 أغسطس 2004, 13:54

أحتاج مساعده في الجافا

مشاركة بواسطة saanina »

في الحقيقه لم اقابل مطوراً للجافا سابقاً ..
لكن يمكن ان نقوم بدعوة احدهم , اذا كنت تعرف احداً ارسلي عنوانه برساله خاصه
لعل وعسى يكون صديقاً لنا هنا ..
دمت بود
مغلق