Package limn.graphics

Record Class RoundRect

java.lang.Object
java.lang.Record
limn.graphics.RoundRect
Record Components:
x - left edge
y - top edge
width - width
height - height
topLeft - top-left corner radius
topRight - top-right corner radius
bottomRight - bottom-right corner radius
bottomLeft - bottom-left corner radius

public record RoundRect(float x, float y, float width, float height, float topLeft, float topRight, float bottomRight, float bottomLeft) extends Record
Immutable rounded rectangle with independent corner radii, in logical points. Radii larger than the sides allow are reduced proportionally (the CSS border-radius rule) by normalized().
  • Constructor Summary

    Constructors
    Constructor
    Description
    RoundRect(float x, float y, float width, float height, float topLeft, float topRight, float bottomRight, float bottomLeft)
    Creates an instance of a RoundRect record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the value of the bottomLeft record component.
    float
    Returns the value of the bottomRight record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    float
    Returns the value of the height record component.
     
    static RoundRect
    of(float x, float y, float width, float height, float radius)
    Rounded rect with the same radius on all four corners.
    float
    Returns the value of the topLeft record component.
    float
    Returns the value of the topRight record component.
    final String
    Returns a string representation of this record class.
    float
    Returns the value of the width record component.
    float
    x()
    Returns the value of the x record component.
    float
    y()
    Returns the value of the y record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • RoundRect

      public RoundRect(float x, float y, float width, float height, float topLeft, float topRight, float bottomRight, float bottomLeft)
      Creates an instance of a RoundRect record class.
      Parameters:
      x - the value for the x record component
      y - the value for the y record component
      width - the value for the width record component
      height - the value for the height record component
      topLeft - the value for the topLeft record component
      topRight - the value for the topRight record component
      bottomRight - the value for the bottomRight record component
      bottomLeft - the value for the bottomLeft record component
  • Method Details

    • of

      public static RoundRect of(float x, float y, float width, float height, float radius)
      Rounded rect with the same radius on all four corners.
    • normalized

      public RoundRect normalized()
      Returns:
      an equivalent RoundRect whose radii are guaranteed to fit the sides: if any two radii sharing a side exceed its length, all four are scaled down by the same factor (CSS rule). Note: renderers additionally cap each radius at half the smaller side (the per-quadrant SDF's validity domain), so a lone radius in (side/2, side] draws as side/2
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • x

      public float x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • y

      public float y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component
    • width

      public float width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public float height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • topLeft

      public float topLeft()
      Returns the value of the topLeft record component.
      Returns:
      the value of the topLeft record component
    • topRight

      public float topRight()
      Returns the value of the topRight record component.
      Returns:
      the value of the topRight record component
    • bottomRight

      public float bottomRight()
      Returns the value of the bottomRight record component.
      Returns:
      the value of the bottomRight record component
    • bottomLeft

      public float bottomLeft()
      Returns the value of the bottomLeft record component.
      Returns:
      the value of the bottomLeft record component