Class ImageUtils


  • public abstract class ImageUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.awt.image.BufferedImage cloneImage​(java.awt.image.BufferedImage image)  
      static void composeThroughMask​(java.awt.image.Raster src, java.awt.image.WritableRaster dst, java.awt.image.Raster sel)
      Compose src onto dst using the alpha of sel to interpolate between the two.
      static java.awt.image.BufferedImage convertImageToARGB​(java.awt.Image image)
      Convert an Image into a TYPE_INT_ARGB BufferedImage.
      static java.awt.image.BufferedImage createImage​(java.awt.image.ImageProducer producer)  
      static int[] getRGB​(java.awt.image.BufferedImage image, int x, int y, int width, int height, int[] pixels)
      A convenience method for getting ARGB pixels from an image.
      static java.awt.Rectangle getSelectedBounds​(java.awt.image.BufferedImage p)  
      static java.awt.image.BufferedImage getSubimage​(java.awt.image.BufferedImage image, int x, int y, int w, int h)  
      static void paintCheckedBackground​(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)  
      static void setRGB​(java.awt.image.BufferedImage image, int x, int y, int width, int height, int[] pixels)
      A convenience method for setting ARGB pixels in an image.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • backgroundImage

        public static java.awt.image.BufferedImage backgroundImage
    • Constructor Detail

      • ImageUtils

        public ImageUtils()
    • Method Detail

      • createImage

        public static java.awt.image.BufferedImage createImage​(java.awt.image.ImageProducer producer)
      • convertImageToARGB

        public static java.awt.image.BufferedImage convertImageToARGB​(java.awt.Image image)
        Convert an Image into a TYPE_INT_ARGB BufferedImage. If the image is already of this type, the original image is returned unchanged.
      • getSubimage

        public static java.awt.image.BufferedImage getSubimage​(java.awt.image.BufferedImage image,
                                                               int x,
                                                               int y,
                                                               int w,
                                                               int h)
      • cloneImage

        public static java.awt.image.BufferedImage cloneImage​(java.awt.image.BufferedImage image)
      • paintCheckedBackground

        public static void paintCheckedBackground​(java.awt.Component c,
                                                  java.awt.Graphics g,
                                                  int x,
                                                  int y,
                                                  int width,
                                                  int height)
      • getSelectedBounds

        public static java.awt.Rectangle getSelectedBounds​(java.awt.image.BufferedImage p)
      • composeThroughMask

        public static void composeThroughMask​(java.awt.image.Raster src,
                                              java.awt.image.WritableRaster dst,
                                              java.awt.image.Raster sel)
        Compose src onto dst using the alpha of sel to interpolate between the two. I can't think of a way to do this using AlphaComposite.
      • getRGB

        public static int[] getRGB​(java.awt.image.BufferedImage image,
                                   int x,
                                   int y,
                                   int width,
                                   int height,
                                   int[] pixels)
        A convenience method for getting ARGB pixels from an image. This tries to avoid the performance penalty of BufferedImage.getRGB unmanaging the image.
      • setRGB

        public static void setRGB​(java.awt.image.BufferedImage image,
                                  int x,
                                  int y,
                                  int width,
                                  int height,
                                  int[] pixels)
        A convenience method for setting ARGB pixels in an image. This tries to avoid the performance penalty of BufferedImage.setRGB unmanaging the image.