Java BufferedImage Operation hitTest(BufferedImage image, int x, int y)

Here you can find the source of hitTest(BufferedImage image, int x, int y)

Description

Returns true if the supplied image contains a non-transparent pixel at the specified coordinates, false otherwise.

License

Open Source License

Declaration

public static boolean hitTest(BufferedImage image, int x, int y) 

Method Source Code

//package com.java2s;
// under the terms of the GNU Lesser General Public License as published

import java.awt.image.BufferedImage;

public class Main {
    /**//  w  w  w  .j ava2 s  .  c  o m
     * Returns true if the supplied image contains a non-transparent pixel
     * at the specified coordinates, false otherwise.
     */
    public static boolean hitTest(BufferedImage image, int x, int y) {
        // it's only a hit if the pixel is non-transparent
        int argb = image.getRGB(x, y);
        return (argb >> 24) != 0;
    }
}

Related

  1. gradientMask(BufferedImage img, float start, float stop)
  2. greyScale(BufferedImage image)
  3. grid(BufferedImage image, int between)
  4. height(BufferedImage image, Double measurementLatitude, Double measurementLongitude)
  5. highlight(BufferedImage img, Color source, Color dest)
  6. hueShift(BufferedImage image, int hue)
  7. inColormap(float[][] in, float min, float max, float[][] colormap, BufferedImage b)
  8. indexToDirectColorModel(BufferedImage image)
  9. intBuffer2BufferedImage(IntBuffer ib, BufferedImage img)