Package com.aoindustries.awt.image
Class Images
- java.lang.Object
-
- com.aoindustries.awt.image.Images
-
public final class Images extends Object
- Author:
- AO Industries, Inc.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PointfindImage(int[] imagePixels, int imageWidth, int imageHeight, int[] findmePixels, int findmeWidth, int findmeHeight, double tolerance)Finds one image within another.static PointfindImage(BufferedImage image, BufferedImage findme, double tolerance)Finds one image within another.static ImagegetImageFromResources(Class<?> clazz, String name)Loads an image from a resource using the default toolkit.static ImagegetImageFromResources(Class<?> clazz, String name, Toolkit toolkit)Loads an image from a resource using the provided toolkit.static int[]getRGB(BufferedImage image)Gets the RGB pixels for the given image into a new array.static voidgetRGB(BufferedImage image, int[] pixels)Gets the RGB pixels for the given image into the given array.static int[]getRGBArray(int width, int height)Gets an array big enough to hold the pixels for an image of the given size.static int[]getRGBArray(Dimension size)Gets an array big enough to hold the pixels for an image of the given size.static int[]getRGBArray(BufferedImage image)Gets an array big enough to hold the provided image pixels.
-
-
-
Method Detail
-
getRGBArray
public static int[] getRGBArray(int width, int height)Gets an array big enough to hold the pixels for an image of the given size. The array is not populated.
-
getRGBArray
public static int[] getRGBArray(Dimension size)
Gets an array big enough to hold the pixels for an image of the given size. The array is not populated.
-
getRGBArray
public static int[] getRGBArray(BufferedImage image)
Gets an array big enough to hold the provided image pixels. The array is not populated.
-
getRGB
public static int[] getRGB(BufferedImage image)
Gets the RGB pixels for the given image into a new array.
-
getRGB
public static void getRGB(BufferedImage image, int[] pixels)
Gets the RGB pixels for the given image into the given array.
-
findImage
public static Point findImage(BufferedImage image, BufferedImage findme, double tolerance)
Finds one image within another.- Parameters:
tolerance- The portion of red, green, and blue differences allowed before ignoring a certain location. Zero implies an exact match.- Returns:
- The top-left point where the top left of the image is found or
nullif not found within tolerance.
-
findImage
public static Point findImage(int[] imagePixels, int imageWidth, int imageHeight, int[] findmePixels, int findmeWidth, int findmeHeight, double tolerance)
Finds one image within another.- Parameters:
tolerance- The portion of red, green, and blue differences allowed before ignoring a certain location. Zero implies an exact match.- Returns:
- The top-left point where the top left of the image is found or
nullif not found within tolerance.
-
getImageFromResources
public static Image getImageFromResources(Class<?> clazz, String name) throws IOException
Loads an image from a resource using the default toolkit.- Throws:
IOException
-
getImageFromResources
public static Image getImageFromResources(Class<?> clazz, String name, Toolkit toolkit) throws IOException
Loads an image from a resource using the provided toolkit.- Throws:
IOException
-
-