code: public final Color getColor(int x, int y) {
          int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData();
          int idx = x + y * width;
  
          return new RGBColor((pixels[idx] >> 16 & 0x000000ff) / 255.0,
                              (pixels[idx] >> 8  & 0x000000ff) / 255.0,
                              (pixels[idx]       & 0x000000ff) / 255.0,
                              (pixels[idx] >> 24)              / 255.0);
      }
docs: Returns the pixel color of this Image.
  
  @param x
  The x-coordinate of the pixel.
  @param y
  The y-coordinate of the pixel.
  @return
  The color of the pixel.