Class NinePatchDrawable

java.lang.Object
arc.scene.style.BaseDrawable
arc.scene.style.NinePatchDrawable
All Implemented Interfaces:
Drawable, TransformDrawable
Direct Known Subclasses:
ScaledNinePatchDrawable

public class NinePatchDrawable extends BaseDrawable implements TransformDrawable
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.

  • Field Details

  • Constructor Details

    • 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 Details

    • draw

      public void draw(float x, float y, float width, float height)
      Description copied from interface: Drawable
      Draws this drawable at the specified bounds.
      Specified by:
      draw in interface Drawable
      Overrides:
      draw in class BaseDrawable
    • draw

      public void draw(float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)
      Specified by:
      draw in interface Drawable
      Specified by:
      draw in interface TransformDrawable
      Overrides:
      draw in class BaseDrawable
    • getPatch

      public NinePatch getPatch()
    • setPatch

      public void setPatch(NinePatch patch)
    • tint

      public NinePatchDrawable tint(Color tint)
      Creates a new drawable that renders the same as this drawable tinted the specified color.