Package com.prineside.tdi2.scene2d.ui
Class Image
java.lang.Object
com.prineside.tdi2.scene2d.Actor
com.prineside.tdi2.scene2d.ui.Widget
com.prineside.tdi2.scene2d.ui.Image
- All Implemented Interfaces:
Layout
- Direct Known Subclasses:
AnimatedImage
,ImageWithParentColor
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.- Author:
- Nathan Sweet
-
Constructor Summary
ConstructorsConstructorDescriptionImage()
Creates an image with no drawable, stretched, and aligned center.Creates an image stretched, and aligned center.Image
(TextureRegion region) Creates an image stretched, and aligned center.Creates an image stretched, and aligned center.Creates an image stretched, and aligned center.Creates an image aligned center. -
Method Summary
Modifier and TypeMethodDescriptionvoid
If this method is overridden, the super method orWidget.validate()
should be called to ensure the widget is laid out.int
getAlign()
float
float
float
float
float
float
float
float
void
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsLayout.invalidate()
on any each child whose width or height has changed, and callsLayout.validate()
on each child.void
setAlign
(int align) void
setDrawable
(Drawable drawable) Sets a new drawable for the image.void
setScaling
(Scaling scaling) toString()
Methods inherited from class com.prineside.tdi2.scene2d.ui.Widget
getMaxHeight, getMaxHeightValue, getMaxWidth, getMaxWidthValue, getMinHeightValue, getMinWidthValue, getPrefHeightValue, getPrefWidthValue, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setPrefHeight, setPrefHeight, setPrefWidth, setPrefWidth, validate
Methods inherited from class com.prineside.tdi2.scene2d.Actor
act, 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, toFront
-
Constructor Details
-
Image
public Image()Creates an image with no drawable, stretched, and aligned center. -
Image
Creates an image stretched, and aligned center.- Parameters:
patch
- May be null.
-
Image
Creates an image stretched, and aligned center.- Parameters:
region
- May be null.
-
Image
Creates an image stretched, and aligned center. -
Image
Creates an image stretched, and aligned center.- Parameters:
drawable
- May be null.
-
Image
Creates an image aligned center.- Parameters:
drawable
- May be null.
-
Image
- Parameters:
drawable
- May be null.
-
-
Method Details
-
layout
public void layout()Description copied from interface:Layout
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsLayout.invalidate()
on any each child whose width or height has changed, and callsLayout.validate()
on each child. This method should almost never be called directly, insteadLayout.validate()
should be used. -
draw
Description copied from class:Widget
If this method is overridden, the super method orWidget.validate()
should be called to ensure the widget is laid out. -
setDrawable
Sets a new drawable for the image. The image's pref size is the drawable's min size. If using the image actor's size rather than the pref size,Widget.pack()
can be used to size the image to its pref size.- Parameters:
drawable
- May be null.
-
getDrawable
- Returns:
- May be null.
-
setScaling
-
setAlign
public void setAlign(int align) -
getAlign
public int getAlign() -
getMinWidth
public float getMinWidth()- Specified by:
getMinWidth
in interfaceLayout
- Overrides:
getMinWidth
in classWidget
-
getMinHeight
public float getMinHeight()- Specified by:
getMinHeight
in interfaceLayout
- Overrides:
getMinHeight
in classWidget
-
getPrefWidth
public float getPrefWidth()- Specified by:
getPrefWidth
in interfaceLayout
- Overrides:
getPrefWidth
in classWidget
-
getPrefHeight
public float getPrefHeight()- Specified by:
getPrefHeight
in interfaceLayout
- Overrides:
getPrefHeight
in classWidget
-
getImageX
public float getImageX() -
getImageY
public float getImageY() -
getImageWidth
public float getImageWidth() -
getImageHeight
public float getImageHeight() -
toString
-