Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: NineSliceTextureBuilder

[21:7] extends: FxObj

Wraps FXGL's NineSliceTextureBuilder (com.almasb.fxgl.texture.NineSliceTextureBuilder), the only path to a 9-slice-resizable Texture. Build by giving the source Texture's nine sub-rectangles (4 corners, 4 sides, 1 center) then call build(width, height) to produce a Texture sized to any (w, h) where corners stay fixed and sides + center stretch to fill. Kept despite the no-builders rule: there is no NineSliceTexture class; build is the only way to obtain a 9-slice-resizable Texture.

Methods

  • NineSliceTextureBuilder (object TextureObj)

    Creates a new builder from a source Texture. Use the matching (ImageObj) form via aji if your input is a raw fx.Image.

    • @p TextureObj is a Texture wrapper.
  • topLeft (double X, double Y, double W, double H)

    Top-left corner region.

  • top (double X, double Y, double W, double H)

    Top edge region (stretched horizontally on build).

  • topRight (double X, double Y, double W, double H)

    Top-right corner region.

  • right (double X, double Y, double W, double H)

    Right edge region (stretched vertically on build).

  • botRight (double X, double Y, double W, double H)

    Bottom-right corner region.

  • bot (double X, double Y, double W, double H)

    Bottom edge region (stretched horizontally on build).

  • botLeft (double X, double Y, double W, double H)

    Bottom-left corner region.

  • left (double X, double Y, double W, double H)

    Left edge region (stretched vertically on build).

  • center (double X, double Y, double W, double H)

    Center region (stretched in both axes on build).

  • build (int Width, int Height)

    Builds the resulting 9-slice Texture sized to (Width, Height). Both dimensions must be greater than the combined corner + edge dimensions or the builder throws.

    • @p Width is the final pixel width.
    • @p Height is the final pixel height.
    • @r A Texture wrapper around the assembled 9-slice texture.
  • getTexture ()

    Returns the source Texture as a wrapper.

  • getTopLeft ()

  • setTopLeft (object TextureObj)

  • getTop ()

  • setTop (object TextureObj)

  • getTopRight ()

  • setTopRight (object TextureObj)

  • getRight ()

  • setRight (object TextureObj)

  • getBotRight ()

  • setBotRight (object TextureObj)

  • getBot ()

  • setBot (object TextureObj)

  • getBotLeft ()

  • setBotLeft (object TextureObj)

  • getLeft ()

  • setLeft (object TextureObj)

  • getCenter ()

  • setCenter (object TextureObj)