APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.scenes.scene2d.utils

public Class NinePatchDrawable

extends BaseDrawable
implements TransformDrawable
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.scenes.scene2d.utils.TransformDrawable, com.badlogic.gdx.scenes.scene2d.utils.Drawable
Imports
com.badlogic.gdx.graphics.Color, com.badlogic.gdx.graphics.g2d.Batch, .NinePatch

Drawable for a NinePatch.

The drawable sizes are set when the ninepatch is set, but they are separate values. Eg, Drawable#getLeftWidth() could be set to more than NinePatch#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.

Author
Nathan Sweet

Field Summary

Modifier and TypeField and Description
private NinePatch

Constructor Summary

AccessConstructor and Description
public
NinePatchDrawable()

Creates an uninitialized NinePatchDrawable.

public
public

Method Summary

Modifier and TypeMethod and Description
public void
draw(Batch batch, float x, float y, float width, float height)

Overrides com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable.draw.

Implements com.badlogic.gdx.scenes.scene2d.utils.Drawable.draw.

Draws this drawable at the specified bounds.

public void
draw(Batch batch, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)

Implements com.badlogic.gdx.scenes.scene2d.utils.TransformDrawable.draw.

public NinePatch
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.

public NinePatchDrawable
tint(Color tint)

Creates a new drawable that renders the same as this drawable tinted the specified color.

Inherited from com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable:
getBottomHeightgetLeftWidthgetMinHeightgetMinWidthgetNamegetRightWidthgetTopHeightsetBottomHeightsetLeftWidthsetMinHeightsetMinWidthsetNamesetRightWidthsetTopHeighttoString

Field Detail

patchback to summary
private NinePatch patch

Constructor Detail

NinePatchDrawableback to summary
public NinePatchDrawable()

Creates an uninitialized NinePatchDrawable. The ninepatch must be set before use.

NinePatchDrawableback to summary
public NinePatchDrawable(NinePatch patch)
NinePatchDrawableback to summary
public NinePatchDrawable(NinePatchDrawable drawable)

Method Detail

drawback to summary
public void draw(Batch batch, float x, float y, float width, float height)

Overrides com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable.draw.

Implements com.badlogic.gdx.scenes.scene2d.utils.Drawable.draw.

Doc from com.badlogic.gdx.scenes.scene2d.utils.Drawable.draw.

Draws this drawable at the specified bounds. The drawable should be tinted with Batch#getColor(), possibly by mixing its own color.

drawback to summary
public void draw(Batch batch, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)

Implements com.badlogic.gdx.scenes.scene2d.utils.TransformDrawable.draw.

getPatchback to summary
public NinePatch getPatch()
setPatchback to summary
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.

tintback to summary
public NinePatchDrawable tint(Color tint)

Creates a new drawable that renders the same as this drawable tinted the specified color.