Class Shape<T extends BlendableEntity<?>>

Type Parameters:
T - a subclass inheriting Entity, used in order to return this as a T instead of a Shape.
All Implemented Interfaces:
Mask
Direct Known Subclasses:
Circle, Line, Polygon, Rectangle, RoundedRectangle

public abstract class Shape<T extends BlendableEntity<?>> extends BlendableEntity<T> implements Mask
A Shape represents a graphical entity with a fill and a line, both of which have an alpha and color. You may also set the line's width in world units.
  • Method Details

    • setFillColor

      public T setFillColor(int color)
      Sets the color of the fill of this Shape as an RGB integer. If the fill should not be drawn, use setFillAlpha(0).

      Default is 0xFFFFFF (white).

      Parameters:
      color - the color of the fill of this Shape.
      Returns:
      this Shape.
      Throws:
      IllegalArgumentException - if color isn't a valid RGB integer
    • setFillColor

      public T setFillColor(int color, Curve curve)
      Sets the color of the fill of this Shape as an RGB integer. If the fill should not be drawn, use setFillAlpha(0).

      Default is 0xFFFFFF (white).

      Parameters:
      color - the color of the fill of this Shape.
      curve - the transition to animate between values of this property.
      Returns:
      this Shape.
      Throws:
      IllegalArgumentException - if color isn't a valid RGB integer
    • getFillColor

      public Integer getFillColor()
      Returns the color of the fill of this Shape as an RGB integer.

      Default is 0xFFFFFF (white).

      Returns:
      the color of the fill of this Shape.
    • setFillAlpha

      public T setFillAlpha(double alpha)
      Sets the alpha of the fill of this Shape as a percentage.

      Default is 1.

      Parameters:
      alpha - the alpha of the fill of this Shape.
      Returns:
      this Shape.
      Throws:
      IllegalArgumentException - if alpha < 0 or alpha > 1
    • setFillAlpha

      public T setFillAlpha(double alpha, Curve curve)
      Sets the alpha of the fill of this Shape as a percentage.

      Default is 1.

      Parameters:
      alpha - the alpha of the fill of this Shape.
      curve - the transition to animate between values of this property.
      Returns:
      this Shape.
      Throws:
      IllegalArgumentException - if alpha < 0 or alpha > 1
    • getFillAlpha

      public double getFillAlpha()
      Returns the alpha of the fill of this Shape as a percentage.

      Default is 1.

      Returns:
      the alpha of the fill of this Shape.
    • setLineAlpha

      public T setLineAlpha(double alpha)
      Sets the alpha of the border of this Shape as a percentage.

      Default is 1.

      Parameters:
      alpha - the alpha for the border of this Shape.
      Returns:
      this Shape.
      Throws:
      IllegalArgumentException - if alpha < 0 or alpha > 1
    • setLineAlpha

      public T setLineAlpha(double alpha, Curve curve)
      Sets the alpha of the border of this Shape as a percentage.

      Default is 1.

      Parameters:
      alpha - the alpha for the border of this Shape.
      curve - the transition to animate between values of this property.
      Returns:
      this Shape.
      Throws:
      IllegalArgumentException - if alpha < 0 or alpha > 1
    • getLineAlpha

      public double getLineAlpha()
      Returns the alpha of the border of this Shape as a percentage.

      Default is 1.

      Returns:
      the alpha for the border of this Shape.
    • setLineWidth

      public T setLineWidth(double lineWidth)
      Sets the width of the border of this Shape in world units.

      Default is 0.

      Parameters:
      lineWidth - the width for the border of this Shape.
      Returns:
      this Shape.
    • setLineWidth

      public T setLineWidth(double lineWidth, Curve curve)
      Sets the width of the border of this Shape in world units.

      Default is 0.

      Parameters:
      lineWidth - the width for the border of this Shape.
      curve - the transition to animate between values of this property.
      Returns:
      this Shape.
    • getLineWidth

      public double getLineWidth()
      Returns the width of the border of this Shape in world units.

      Default is 0.

      Returns:
      the width of the border of this Shape.
    • setLineColor

      public T setLineColor(int lineColor)
      Sets the color of the border of this Shape as an RGB integer.

      Default is 0xFFFFFF (white).

      Parameters:
      lineColor - the color for the border of this Shape.
      Returns:
      this Shape.
      Throws:
      IllegalArgumentException - if lineColor isn't a valid RGB integer
    • setLineColor

      public T setLineColor(int lineColor, Curve curve)
      Sets the color of the border of this Shape as an RGB integer.

      Default is 0xFFFFFF (white).

      Parameters:
      lineColor - the color for the border of this Shape.
      curve - the transition to animate between values of this property.
      Returns:
      this Shape.
      Throws:
      IllegalArgumentException - if lineColor isn't a valid RGB integer
    • getLineColor

      public int getLineColor()
      Returns the color of the border of this Shape as an RGB integer.

      Default is 0xFFFFFF (white).

      Returns:
      the color of the border of this Shape.