Class NinePatch<T>

java.lang.Object
juuxel.libninepatch.NinePatch<T>
Type Parameters:
T - the texture type

public final class NinePatch<T> extends Object
A nine-patch renderer.

New NinePatch instances are creating using NinePatch.Builder.

  • Method Details

    • draw

      public <C> void draw​(ContextualTextureRenderer<? super T,​C> renderer, C context, int width, int height)
      Draws a nine-patch region using a contextual texture renderer.
      Type Parameters:
      C - the type of context that is needed to draw a texture
      Parameters:
      renderer - the renderer for drawing the texture
      context - the context used for drawing the texture
      width - the width of the target region
      height - the height of the target region
    • draw

      public void draw​(TextureRenderer<? super T> renderer, int width, int height)
      Draws a nine-patch region using a non-contextual texture renderer.
      Parameters:
      renderer - the renderer for drawing the texture
      width - the width of the target region
      height - the height of the target region
    • builder

      public static <T> NinePatch.Builder<T> builder​(T texture)
      Creates a NinePatch.Builder using a full texture.
      Type Parameters:
      T - the texture type
      Parameters:
      texture - the texture
      Returns:
      a nine-patch renderer builder using the texture
    • builder

      public static <T> NinePatch.Builder<T> builder​(TextureRegion<T> texture)
      Creates a NinePatch.Builder using a texture region.
      Type Parameters:
      T - the texture type
      Parameters:
      texture - the texture region
      Returns:
      a nine-patch renderer builder using the texture region
      Throws:
      NullPointerException - if the texture region is null