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,
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() 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,
String drawableName) |
void |
setScaling(Scaling scaling) |
getMaxHeight, getMaxWidth, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, validate
act, addAction, addCaptureListener, addListener, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, fire, 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, 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, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront, toString
public Image()
public Image(NinePatch patch)
patch
- May be null.public Image(TextureRegion region)
region
- May be null.public Image(Texture texture)
public Image(Drawable drawable)
drawable
- May be null.public Image(Drawable drawable, Scaling scaling)
drawable
- May be null.public void layout()
Layout
Layout.invalidate()
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)
Widget
Widget.validate()
should be called to ensure the widget is laid out.public void setDrawable(Drawable drawable)
public Drawable getDrawable()
public void setScaling(Scaling scaling)
public void setAlign(int align)
public float getMinWidth()
getMinWidth
in interface Layout
getMinWidth
in class Widget
public float getMinHeight()
getMinHeight
in interface Layout
getMinHeight
in class Widget
public float getPrefWidth()
getPrefWidth
in interface Layout
getPrefWidth
in class Widget
public float getPrefHeight()
getPrefHeight
in interface Layout
getPrefHeight
in class Widget
public float getImageX()
public float getImageY()
public float getImageWidth()
public float getImageHeight()
Copyright © 2015. All rights reserved.