Class BoxPoint

java.lang.Object
tripleplay.ui.util.BoxPoint

public class BoxPoint extends Object
Defines a point relative to a box.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final BoxPoint
    The bottom left corner.
    static final BoxPoint
    The bottom right corner.
    static final BoxPoint
    The center of the box.
    final float
    Normalized x, y coordinates.
    final float
    Normalized x, y coordinates.
    final float
    Absolute x, y offsets.
    final float
    Absolute x, y offsets.
    static final BoxPoint
    The top left corner.
    static final BoxPoint
    The top right corner.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BoxPoint(float nx, float ny)
    Creates a new box point that will resolve to the given normalized coordinates.
    BoxPoint(float nx, float ny, float ox, float oy)
    Creates a new box point that will resolve to the given normalized coordinates plus the given absolute coordinates.
  • Method Summary

    Modifier and Type
    Method
    Description
    align(Style.HAlign halign, Style.VAlign valign)
    Creates a new box point that is equivalent to this one except with the given horizontal and vertical alignment.
    Creates a new box point that is equivalent to this one except with a y coordinate that will resolve to the top bottom of the box.
    Creates a new box point that is equivalent to this one except with x, y coordinates that will resolve to the center of the box.
    Creates a new box point that is equivalent to this one except with the given x alignment.
    Creates a new box point that is equivalent to this one except with an x coordinate that will resolve to the left edge of the box.
    nx(float nx)
    Creates a new box point that is equivalent to this one except with the given normalized x coordinate.
    ny(float ny)
    Creates a new box point that is equivalent to this one except with the given normalized y coordinate.
    offset(float x, float y)
    Creates a new box point that is equivalent to this one except with given offset coordinates.
    pythagoras.f.Point
    resolve(float x, float y, float width, float height, pythagoras.f.Point dest)
    Finds the coordinates of the point, using the box defined by the given coordinates.
    pythagoras.f.Point
    resolve(pythagoras.f.IDimension size, pythagoras.f.Point dest)
    Finds the coordinates of the point, using the box with top left of 0, 0 and the given dimension.
    pythagoras.f.Point
    resolve(Element<?> elem, pythagoras.f.Point dest)
    Finds the screen coordinates of the point, using the given element as the box.
    Creates a new box point that is equivalent to this one except with an x coordinate that will resolve to the right edge of the box.
    top()
    Creates a new box point that is equivalent to this one except with a y coordinate that will resolve to the top edge of the box.
    Creates a new box point that is equivalent to this one except with the given y alignment.

    Methods inherited from class java.lang.Object

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

    • TL

      public static final BoxPoint TL
      The top left corner.
    • BL

      public static final BoxPoint BL
      The bottom left corner.
    • TR

      public static final BoxPoint TR
      The top right corner.
    • BR

      public static final BoxPoint BR
      The bottom right corner.
    • CENTER

      public static final BoxPoint CENTER
      The center of the box.
    • nx

      public final float nx
      Normalized x, y coordinates. For example, nx = 1 is the right edge.
    • ny

      public final float ny
      Normalized x, y coordinates. For example, nx = 1 is the right edge.
    • ox

      public final float ox
      Absolute x, y offsets.
    • oy

      public final float oy
      Absolute x, y offsets.
  • Constructor Details

    • BoxPoint

      public BoxPoint(float nx, float ny)
      Creates a new box point that will resolve to the given normalized coordinates.
    • BoxPoint

      public BoxPoint(float nx, float ny, float ox, float oy)
      Creates a new box point that will resolve to the given normalized coordinates plus the given absolute coordinates.
  • Method Details

    • left

      public BoxPoint left()
      Creates a new box point that is equivalent to this one except with an x coordinate that will resolve to the left edge of the box.
    • right

      public BoxPoint right()
      Creates a new box point that is equivalent to this one except with an x coordinate that will resolve to the right edge of the box.
    • top

      public BoxPoint top()
      Creates a new box point that is equivalent to this one except with a y coordinate that will resolve to the top edge of the box.
    • bottom

      public BoxPoint bottom()
      Creates a new box point that is equivalent to this one except with a y coordinate that will resolve to the top bottom of the box.
    • center

      public BoxPoint center()
      Creates a new box point that is equivalent to this one except with x, y coordinates that will resolve to the center of the box.
    • offset

      public BoxPoint offset(float x, float y)
      Creates a new box point that is equivalent to this one except with given offset coordinates.
    • ny

      public BoxPoint ny(float ny)
      Creates a new box point that is equivalent to this one except with the given normalized y coordinate.
    • align

      public BoxPoint align(Style.HAlign halign, Style.VAlign valign)
      Creates a new box point that is equivalent to this one except with the given horizontal and vertical alignment.
    • valign

      public BoxPoint valign(Style.VAlign valign)
      Creates a new box point that is equivalent to this one except with the given y alignment. This is a shortcut for calling ny(float) with 0, .5, or 1.
    • nx

      public BoxPoint nx(float nx)
      Creates a new box point that is equivalent to this one except with the given normalized x coordinate.
    • halign

      public BoxPoint halign(Style.HAlign halign)
      Creates a new box point that is equivalent to this one except with the given x alignment. This is a shortcut for calling nx(float) with 0, .5, or 1.
    • resolve

      public pythagoras.f.Point resolve(Element<?> elem, pythagoras.f.Point dest)
      Finds the screen coordinates of the point, using the given element as the box.
    • resolve

      public pythagoras.f.Point resolve(float x, float y, float width, float height, pythagoras.f.Point dest)
      Finds the coordinates of the point, using the box defined by the given coordinates.
    • resolve

      public pythagoras.f.Point resolve(pythagoras.f.IDimension size, pythagoras.f.Point dest)
      Finds the coordinates of the point, using the box with top left of 0, 0 and the given dimension.