Package tripleplay.ui

Class Background

java.lang.Object
tripleplay.ui.Background
Direct Known Subclasses:
BlankBackground, CompositeBackground, RoundRectBackground, Scale9Background

public abstract class Background extends Object
A background is responsible for rendering a border and a fill. It is used in conjunction with groups and buttons and any other elements that need a background.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    An instantiation of a particular background template.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The alpha transparency of this background (or null if no alpha has been configured).
    static final float
    The (highest) depth at which background layers are rendered.
    The insets of this background, added to get the overall Element size.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    alpha(float alpha)
    Configures the alpha transparency of this background.
    static Background
    beveled(int bgColor, int ulColor, int brColor)
    Creates a beveled background with the specified colors.
    static Background
    Creates a null background (transparent).
    static Background
    bordered(int bgColor, int color, float thickness)
    Creates a bordered background with the specified colors and thickness.
    static Background
    centered(Tile tile)
    Creates a centered background with the specified texture tile.
    static Background
    composite(Background... constituents)
    Creates a composite background with the specified backgrounds.
    static Background
    cropped(Tile tile)
    Creates a cropped centered background with the specified texture tile.
    static Background
    image(TileSource source)
    Creates a background with the specified source.
    inset(float uniformInset)
    Configures uniform insets on this background.
    inset(float horiz, float vert)
    Configures horizontal and vertical insets on this background.
    inset(float top, float right, float bottom, float left)
    Configures non-uniform insets on this background.
    insetBottom(float bottom)
    Sets the bottom inset for this background.
    insetLeft(float left)
    Sets the left inset for this background.
    insetRight(float right)
    Sets the right inset for this background.
    insets(Insets insets)
    Configures insets on this background.
    insetTop(float top)
    Sets the top inset for this background.
    instantiate(Background delegate, pythagoras.f.IDimension size)
    Instantiates a background at the supplied size.
    static Background
    roundRect(Graphics gfx, int bgColor, float cornerRadius)
    Creates a round rect background with the specified color and corner radius.
    static Background
    roundRect(Graphics gfx, int bgColor, float cornerRadius, int borderColor, float borderWidth)
    Creates a round rect background with the specified parameters.
    scale9(Tile tile)
    Creates a scale9 background with the specified texture tile.
    static Background
    solid(int color)
    Creates a solid background of the specified color.
    static Background
    Creates a tiled background with the specified texture.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • BACKGROUND_DEPTH

      public static final float BACKGROUND_DEPTH
      The (highest) depth at which background layers are rendered. May range from (-11, 10].
      See Also:
    • insets

      public Insets insets
      The insets of this background, added to get the overall Element size.
    • alpha

      public Float alpha
      The alpha transparency of this background (or null if no alpha has been configured).
  • Constructor Details

    • Background

      public Background()
  • Method Details

    • blank

      public static Background blank()
      Creates a null background (transparent).
    • solid

      public static Background solid(int color)
      Creates a solid background of the specified color.
    • beveled

      public static Background beveled(int bgColor, int ulColor, int brColor)
      Creates a beveled background with the specified colors.
    • bordered

      public static Background bordered(int bgColor, int color, float thickness)
      Creates a bordered background with the specified colors and thickness.
    • roundRect

      public static Background roundRect(Graphics gfx, int bgColor, float cornerRadius)
      Creates a round rect background with the specified color and corner radius.
    • roundRect

      public static Background roundRect(Graphics gfx, int bgColor, float cornerRadius, int borderColor, float borderWidth)
      Creates a round rect background with the specified parameters.
    • image

      public static Background image(TileSource source)
      Creates a background with the specified source.
    • centered

      public static Background centered(Tile tile)
      Creates a centered background with the specified texture tile.
    • cropped

      public static Background cropped(Tile tile)
      Creates a cropped centered background with the specified texture tile.
    • tiled

      public static Background tiled(Texture tex)
      Creates a tiled background with the specified texture.
    • scale9

      public static Scale9Background scale9(Tile tile)
      Creates a scale9 background with the specified texture tile. See Scale9Background.
    • composite

      public static Background composite(Background... constituents)
      Creates a composite background with the specified backgrounds. See CompositeBackground.
    • instantiate

      public static Background.Instance instantiate(Background delegate, pythagoras.f.IDimension size)
      Instantiates a background at the supplied size.
    • insets

      public Background insets(Insets insets)
      Configures insets on this background.
    • inset

      public Background inset(float uniformInset)
      Configures uniform insets on this background.
    • inset

      public Background inset(float horiz, float vert)
      Configures horizontal and vertical insets on this background.
    • inset

      public Background inset(float top, float right, float bottom, float left)
      Configures non-uniform insets on this background.
    • insetLeft

      public Background insetLeft(float left)
      Sets the left inset for this background.
    • insetRight

      public Background insetRight(float right)
      Sets the right inset for this background.
    • insetTop

      public Background insetTop(float top)
      Sets the top inset for this background.
    • insetBottom

      public Background insetBottom(float bottom)
      Sets the bottom inset for this background.
    • alpha

      public Background alpha(float alpha)
      Configures the alpha transparency of this background.