|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.ui.Widget
com.badlogic.gdx.scenes.scene2d.ui.Image
public class Image
Displays a TextureRegion
or NinePatch
, scaled various way within the widgets bounds. The preferred size is the
actual size of the region or ninepatch. Only when using a TextureRegion will the actor's scale, rotation, and origin be used
when drawing.
Field Summary |
---|
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
actions, color, height, name, originX, originY, parent, rotation, scaleX, scaleY, stage, touchable, visible, width, x, y |
Constructor Summary | |
---|---|
Image()
Creates an image with no region or patch, stretched, and aligned center. |
|
Image(NinePatch patch)
Creates an image stretched, and aligned center. |
|
Image(NinePatch patch,
Scaling scaling)
Creates an image aligned center. |
|
Image(NinePatch patch,
Scaling scaling,
int align)
|
|
Image(NinePatch patch,
Scaling scaling,
int align,
java.lang.String name)
|
|
Image(Texture texture)
Creates an image stretched, and aligned center. |
|
Image(TextureRegion region)
Creates an image stretched, and aligned center. |
|
Image(TextureRegion region,
Scaling scaling)
Creates an image aligned center. |
|
Image(TextureRegion region,
Scaling scaling,
int align)
|
|
Image(TextureRegion region,
Scaling scaling,
int align,
java.lang.String name)
|
|
Image(Texture texture,
Scaling scaling)
Creates an image aligned center. |
|
Image(Texture texture,
Scaling scaling,
int align)
|
|
Image(Texture texture,
Scaling scaling,
int align,
java.lang.String name)
|
Method Summary | |
---|---|
void |
draw(SpriteBatch batch,
float parentAlpha)
If this method is overridden, the super method or Widget.validate() should be called to ensure the widget is laid out. |
float |
getImageHeight()
|
float |
getImageWidth()
|
float |
getImageX()
|
float |
getImageY()
|
float |
getMinHeight()
|
float |
getMinWidth()
|
NinePatch |
getPatch()
|
float |
getPrefHeight()
|
float |
getPrefWidth()
|
TextureRegion |
getRegion()
|
void |
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child and calls Layout.invalidate() and then Layout.validate() on each one. |
void |
setAlign(int align)
|
void |
setClickListener(ClickListener clickListener)
|
void |
setPatch(NinePatch patch)
|
void |
setRegion(TextureRegion region)
|
void |
setScaling(Scaling scaling)
|
boolean |
touchDown(float x,
float y,
int pointer)
|
void |
touchDragged(float x,
float y,
int pointer)
|
void |
touchUp(float x,
float y,
int pointer)
|
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Widget |
---|
getMaxHeight, getMaxWidth, hit, invalidate, invalidateHierarchy, needsLayout, pack, setFillParent, toScreenCoordinates, validate |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
act, action, clearActions, getStage, isMarkedToRemove, keyDown, keyTyped, keyUp, markToRemove, remove, scrolled, toLocalCoordinates, toString, touchMoved |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Image()
public Image(Texture texture)
public Image(Texture texture, Scaling scaling)
public Image(Texture texture, Scaling scaling, int align)
public Image(Texture texture, Scaling scaling, int align, java.lang.String name)
public Image(TextureRegion region)
region
- May be null.public Image(TextureRegion region, Scaling scaling)
region
- May be null.public Image(TextureRegion region, Scaling scaling, int align)
region
- May be null.public Image(TextureRegion region, Scaling scaling, int align, java.lang.String name)
region
- May be null.public Image(NinePatch patch)
patch
- May be null.public Image(NinePatch patch, Scaling scaling)
patch
- May be null.public Image(NinePatch patch, Scaling scaling, int align)
patch
- May be null.public Image(NinePatch patch, Scaling scaling, int align, java.lang.String name)
patch
- May be null.Method Detail |
---|
public void layout()
Layout
Layout.invalidate()
and then Layout.validate()
on each one. Usually this should not be called directly, instead
Layout.validate()
should be used.
layout
in interface Layout
layout
in class Widget
public void draw(SpriteBatch batch, float parentAlpha)
Widget
Widget.validate()
should be called to ensure the widget is laid out.
draw
in class Widget
batch
- the spritebatch to render withparentAlpha
- the parent's alpha value.public void setRegion(TextureRegion region)
region
- May be null.public TextureRegion getRegion()
public void setPatch(NinePatch patch)
patch
- May be null.public NinePatch getPatch()
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 boolean touchDown(float x, float y, int pointer)
touchDown
in class Widget
public void touchUp(float x, float y, int pointer)
touchUp
in class Widget
public void touchDragged(float x, float y, int pointer)
touchDragged
in class Widget
public void setClickListener(ClickListener clickListener)
public float getImageX()
public float getImageY()
public float getImageWidth()
public float getImageHeight()
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |