Class Images


  • public final class Images
    extends Object
    Author:
    AO Industries, Inc.
    • 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 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​(Class<?> clazz,
                                                  String name)
                                           throws IOException
        Loads an image from a resource using the default toolkit.
        Throws:
        IOException