java.lang.Object
com.aoapps.hodgepodge.awt.image.Images
- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Point
findImage
(int[] imagePixels, int imageWidth, int imageHeight, int[] findmePixels, int findmeWidth, int findmeHeight, double tolerance) Finds one image within another.static Point
findImage
(BufferedImage image, BufferedImage findme, double tolerance) Finds one image within another.static Image
getImageFromResources
(FunctionE<? super String, ? extends InputStream, ? extends IOException> getResourceAsStream, String name) Loads an image from a resource using the default toolkit.static Image
getImageFromResources
(FunctionE<? super String, ? extends InputStream, ? extends IOException> getResourceAsStream, 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 void
getRGB
(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 Details
-
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
Gets an array big enough to hold the pixels for an image of the given size. The array is not populated. -
getRGBArray
Gets an array big enough to hold the provided image pixels. The array is not populated. -
getRGB
Gets the RGB pixels for the given image into a new array. -
getRGB
Gets the RGB pixels for the given image into the given array. -
findImage
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
null
if 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
null
if not found within tolerance.
-
getImageFromResources
public static Image getImageFromResources(FunctionE<? super String, ? extends InputStream, throws IOException? extends IOException> getResourceAsStream, String name) Loads an image from a resource using the default toolkit.- Throws:
IOException
-
getImageFromResources
public static Image getImageFromResources(FunctionE<? super String, ? extends InputStream, throws IOException? extends IOException> getResourceAsStream, String name, Toolkit toolkit) Loads an image from a resource using the provided toolkit.- Throws:
IOException
-