com.badlogic.gdx.scenes.scene2d.utils
Class NinePatchDrawable

java.lang.Object
  extended by com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable
      extended by com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable
All Implemented Interfaces:
Drawable

public class NinePatchDrawable
extends BaseDrawable

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

Constructor Summary
NinePatchDrawable()
          Creates an uninitialized NinePatchDrawable.
NinePatchDrawable(NinePatch patch)
           
NinePatchDrawable(NinePatchDrawable drawable)
           
 
Method Summary
 void draw(SpriteBatch batch, float x, float y, float width, float height)
          Draws this drawable at the specified bounds.
 NinePatch getPatch()
           
 void setPatch(NinePatch patch)
           
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable
getBottomHeight, getLeftWidth, getMinHeight, getMinWidth, getRightWidth, getTopHeight, setBottomHeight, setLeftWidth, setMinHeight, setMinWidth, setRightWidth, setTopHeight
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NinePatchDrawable

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


NinePatchDrawable

public NinePatchDrawable(NinePatch patch)

NinePatchDrawable

public NinePatchDrawable(NinePatchDrawable drawable)
Method Detail

draw

public void draw(SpriteBatch 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 with SpriteBatch.getColor(), possibly by mixing its own color.

Specified by:
draw in interface Drawable
Overrides:
draw in class BaseDrawable

setPatch

public void setPatch(NinePatch patch)

getPatch

public NinePatch getPatch()


Copyright © 2013. All Rights Reserved.