Package arc.scene.ui

Class Image

Direct Known Subclasses:
BorderImage, ColorImage, SchematicsDialog.SchematicImage

public class Image extends Element
Displays a Drawable, scaled various way within the widgets bounds. The preferred size is the min size of the drawable. Only when using a TextureRegionDrawable will the actor's scale, rotation, and origin be used when drawing.
  • Field Details

    • imageX

      protected float imageX
    • imageY

      protected float imageY
    • imageWidth

      protected float imageWidth
    • imageHeight

      protected float imageHeight
  • Constructor Details

    • Image

      public Image()
      Creates an image with no region or patch, stretched, and aligned center.
    • Image

      public Image(Drawable name, Color color)
    • Image

      public Image(NinePatch patch)
      Creates an image stretched, and aligned center.
      Parameters:
      patch - May be null.
    • Image

      public Image(TextureRegion region)
      Creates an image stretched, and aligned center.
      Parameters:
      region - May be null.
    • Image

      public Image(Texture texture)
      Creates an image stretched, and aligned center.
    • Image

      public Image(Drawable drawable)
      Creates an image stretched, and aligned center.
      Parameters:
      drawable - May be null.
    • Image

      public Image(Drawable drawable, Scaling scaling)
      Creates an image aligned center.
      Parameters:
      drawable - May be null.
    • Image

      public Image(Drawable drawable, Scaling scaling, int align)
      Parameters:
      drawable - May be null.
  • Method Details

    • layout

      public void layout()
      Description copied from class: Element
      Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, calls Element.invalidate() on any each child whose width or height has changed, and calls Element.validate() on each child. This method should almost never be called directly, instead Element.validate() should be used.
      Overrides:
      layout in class Element
    • draw

      public void draw()
      Description copied from class: Element
      Draws the element. Does nothing by default.
      Overrides:
      draw in class Element
    • getRegion

      public TextureRegion getRegion()
    • getDrawable

      public Drawable getDrawable()
      Returns:
      May be null.
    • setDrawable

      public void setDrawable(TextureRegion region)
    • setDrawable

      public void setDrawable(Drawable drawable)
      Parameters:
      drawable - May be null.
    • setScaling

      public Image setScaling(Scaling scaling)
    • setAlign

      public void setAlign(int align)
    • getMinWidth

      public float getMinWidth()
      Overrides:
      getMinWidth in class Element
    • getMinHeight

      public float getMinHeight()
      Overrides:
      getMinHeight in class Element
    • getPrefWidth

      public float getPrefWidth()
      Overrides:
      getPrefWidth in class Element
    • getPrefHeight

      public float getPrefHeight()
      Overrides:
      getPrefHeight in class Element
    • getImageX

      public float getImageX()
    • getImageY

      public float getImageY()
    • getImageWidth

      public float getImageWidth()
    • getImageHeight

      public float getImageHeight()