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 drawable, 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,
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. |
int |
getAlign() |
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)
Sets a new drawable for the image.
|
void |
setDrawable(Skin skin,
String drawableName) |
void |
setScaling(Scaling scaling) |
String |
toString() |
getMaxHeight, getMaxWidth, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, validateact, addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, 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, hasKeyboardFocus, hasParent, hasScrollFocus, hit, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, remove, removeAction, removeCaptureListener, removeListener, rotateBy, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFrontpublic Image()
public Image(@Null NinePatch patch)
patch - May be null.public Image(@Null TextureRegion region)
region - May be null.public Image(Texture texture)
public Image(@Null Drawable drawable)
drawable - May be null.public Image(@Null 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(@Null Drawable drawable)
Widget.pack() can be used to size the image to its pref size.drawable - May be null.public void setScaling(Scaling scaling)
public void setAlign(int align)
public int getAlign()
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()
Copyright © 2021. All rights reserved.