public class Image extends Widget
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.| Constructor and Description |
|---|
Image()
Creates an image with no region or patch, stretched, and aligned center.
|
Image(Drawable drawable)
Creates an image stretched, and aligned center.
|
Image(Drawable drawable,
Scaling scaling)
Creates an image aligned center.
|
Image(Drawable drawable,
Scaling scaling,
int align) |
Image(NinePatch patch)
Creates an image stretched, and aligned center.
|
Image(Skin skin,
java.lang.String drawableName)
Creates an image stretched, and aligned center.
|
Image(Texture texture)
Creates an image stretched, and aligned center.
|
Image(TextureRegion region)
Creates an image stretched, and aligned center.
|
| Modifier and Type | Method and Description |
|---|---|
void |
draw(Batch batch,
float parentAlpha)
If this method is overridden, the super method or
Widget.validate() should be called to ensure the widget is laid out. |
Drawable |
getDrawable() |
float |
getImageHeight() |
float |
getImageWidth() |
float |
getImageX() |
float |
getImageY() |
float |
getMinHeight() |
float |
getMinWidth() |
float |
getPrefHeight() |
float |
getPrefWidth() |
void |
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child,
calls
Layout.invalidate() on any each child whose width or height has changed, and calls Layout.validate() on each
child. |
void |
setAlign(int align) |
void |
setDrawable(Drawable drawable) |
void |
setDrawable(Skin skin,
java.lang.String drawableName) |
void |
setScaling(Scaling scaling) |
getMaxHeight, getMaxWidth, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validateact, addAction, addCaptureListener, addListener, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasParent, hit, isAscendantOf, isDescendantOf, isTouchable, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront, toStringpublic Image()
public Image(NinePatch patch)
patch - May be null.public Image(TextureRegion region)
region - May be null.public Image(Texture texture)
public Image(Skin skin, java.lang.String drawableName)
public Image(Drawable drawable)
drawable - May be null.public Image(Drawable drawable, Scaling scaling)
drawable - May be null.public void layout()
LayoutLayout.invalidate() on any each child whose width or height has changed, and calls Layout.validate() on each
child. This method should almost never be called directly, instead Layout.validate() should be used.public void draw(Batch batch, float parentAlpha)
WidgetWidget.validate() should be called to ensure the widget is laid out.public void setDrawable(Skin skin, java.lang.String drawableName)
public void setDrawable(Drawable drawable)
drawable - May be null.public Drawable getDrawable()
public void setScaling(Scaling scaling)
public void setAlign(int align)
public float getMinWidth()
getMinWidth in interface LayoutgetMinWidth in class Widgetpublic float getMinHeight()
getMinHeight in interface LayoutgetMinHeight in class Widgetpublic float getPrefWidth()
getPrefWidth in interface LayoutgetPrefWidth in class Widgetpublic float getPrefHeight()
getPrefHeight in interface LayoutgetPrefHeight in class Widgetpublic float getImageX()
public float getImageY()
public float getImageWidth()
public float getImageHeight()