Interface Image

  • All Known Implementing Classes:
    AWTImage, GDXImage, TeaImage

    public interface Image
    Represents an image based on raster graphics. Images be loaded from PNG or JPEG files using a MediaLoader.

    Instances of an Image may represent either the entire underlying image, or a rectangular region within the source image. That is, instances do not always map directly to an image file. This aligns with the common practice of including multiple images within a larger image, either as a sprite sheet (for 2D graphics) or a texture (for 3D graphics).

    • Method Detail

      • getRegion

        Rect getRegion()
      • getWidth

        default int getWidth()
      • getHeight

        default int getHeight()
      • extractRegion

        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.
      • getColor

        ColorRGB getColor​(int x,
                          int y)
        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 getAlpha(int, int).
      • getAlpha

        int getAlpha​(int x,
                     int y)
        Returns the alpha of a pixel within the image. The returned value is between 0 (fully transparent) and 100 (fully opaque).