Class NinePatchDrawable
- java.lang.Object
-
- com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable
-
- com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable
-
- All Implemented Interfaces:
Drawable
,TransformDrawable
public class NinePatchDrawable extends BaseDrawable implements TransformDrawable
Drawable for aNinePatch
.The drawable sizes are set when the ninepatch is set, but they are separate values. Eg,
Drawable.getLeftWidth()
could be set to more thanNinePatch.getLeftWidth()
in order to provide more space on the left than actually exists in the ninepatch.The min size is set to the ninepatch total size by default. It could be set to the left+right and top+bottom, excluding the middle size, to allow the drawable to be sized down as small as possible.
-
-
Constructor Summary
Constructors Constructor Description NinePatchDrawable()
Creates an uninitialized NinePatchDrawable.NinePatchDrawable(NinePatch patch)
NinePatchDrawable(NinePatchDrawable drawable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
draw(Batch batch, float x, float y, float width, float height)
Draws this drawable at the specified bounds.void
draw(Batch batch, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)
NinePatch
getPatch()
void
setPatch(NinePatch patch)
Sets this drawable's ninepatch and set the min width, min height, top height, right width, bottom height, and left width to the patch's padding.NinePatchDrawable
tint(Color tint)
Creates a new drawable that renders the same as this drawable tinted the specified color.-
Methods inherited from class com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable
getBottomHeight, getLeftWidth, getMinHeight, getMinWidth, getName, getRightWidth, getTopHeight, setBottomHeight, setLeftWidth, setMinHeight, setMinSize, setMinWidth, setName, setPadding, setRightWidth, setTopHeight, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.badlogic.gdx.scenes.scene2d.utils.Drawable
getBottomHeight, getLeftWidth, getMinHeight, getMinWidth, getRightWidth, getTopHeight, setBottomHeight, setLeftWidth, setMinHeight, setMinWidth, setRightWidth, setTopHeight
-
-
-
-
Constructor Detail
-
NinePatchDrawable
public NinePatchDrawable()
Creates an uninitialized NinePatchDrawable. The ninepatch must beset
before use.
-
NinePatchDrawable
public NinePatchDrawable(NinePatch patch)
-
NinePatchDrawable
public NinePatchDrawable(NinePatchDrawable drawable)
-
-
Method Detail
-
draw
public void draw(Batch batch, float x, float y, float width, float height)
Description copied from interface:Drawable
Draws this drawable at the specified bounds. The drawable should be tinted withBatch.getColor()
, possibly by mixing its own color.- Specified by:
draw
in interfaceDrawable
- Overrides:
draw
in classBaseDrawable
-
draw
public void draw(Batch batch, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)
- Specified by:
draw
in interfaceTransformDrawable
-
setPatch
public void setPatch(NinePatch patch)
Sets this drawable's ninepatch and set the min width, min height, top height, right width, bottom height, and left width to the patch's padding.
-
getPatch
public NinePatch getPatch()
-
tint
public NinePatchDrawable tint(Color tint)
Creates a new drawable that renders the same as this drawable tinted the specified color.
-
-