Class AWTImage

  • All Implemented Interfaces:
    Image

    public class AWTImage
    extends java.lang.Object
    implements Image
    Represents image data using Java 2D's BufferedImage. Images can be loaded from files using ImageIO, and can also be created programmatically.
    • Constructor Summary

      Constructors 
      Constructor Description
      AWTImage​(java.awt.image.BufferedImage image)  
      AWTImage​(java.awt.image.BufferedImage image, FilePointer origin)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Image extractRegion​(Rect region)
      Returns a new Image instance that is based on the same source image, but only contains the specified rectangular region within the source image.
      int getAlpha​(int x, int y)
      Returns the alpha of a pixel within the image.
      ColorRGB getColor​(int x, int y)
      Returns the RGB color value of a pixel within the image.
      int getHeight()  
      java.awt.image.BufferedImage getImage()  
      Rect getRegion()  
      int getWidth()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AWTImage

        public AWTImage​(java.awt.image.BufferedImage image,
                        FilePointer origin)
      • AWTImage

        public AWTImage​(java.awt.image.BufferedImage image)
    • Method Detail

      • getImage

        public java.awt.image.BufferedImage getImage()
      • getWidth

        public int getWidth()
        Specified by:
        getWidth in interface Image
      • getHeight

        public int getHeight()
        Specified by:
        getHeight in interface Image
      • extractRegion

        public Image extractRegion​(Rect region)
        Description copied from interface: Image
        Returns a new Image instance that is based on the same source image, but only contains the specified rectangular region within the source image.
        Specified by:
        extractRegion in interface Image
      • getColor

        public ColorRGB getColor​(int x,
                                 int y)
        Description copied from interface: Image
        Returns the RGB color value of a pixel within the image. This does not include the pixel's alpha value even if the image does support transparency. The alpha value can be retrieved separately using Image.getAlpha(int, int).
        Specified by:
        getColor in interface Image
      • getAlpha

        public int getAlpha​(int x,
                            int y)
        Description copied from interface: Image
        Returns the alpha of a pixel within the image. The returned value is between 0 (fully transparent) and 100 (fully opaque).
        Specified by:
        getAlpha in interface Image
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object