Record Class Stroke

java.lang.Object
java.lang.Record
org.inspirenxe.strata.api.extension.Stroke
Record Components:
width - the width in UI units, centered on the path for lines, polylines and shapes; 0 draws nothing
cap - the shape of the ends of an open path
join - the shape of the corners where two segments meet

public record Stroke(float width, Stroke.Cap cap, Stroke.Join join) extends Record
How a line or an outline is drawn: its width, the shape of its open ends and the shape of its corners. Make one once and keep it in a field; it is a value.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The shape of the ends of an open path.
    static enum 
    The shape of the corner where two segments of a path meet.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Stroke(float width, Stroke.Cap cap, Stroke.Join join)
    Checks the arguments.
  • Method Summary

    Modifier and Type
    Method
    Description
    cap()
    Returns the value of the cap record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the join record component.
    static Stroke
    of(float width)
    Returns a stroke of a width with Stroke.Cap.BUTT ends and Stroke.Join.MITER corners.
    final String
    Returns a string representation of this record class.
    float
    Returns the value of the width record component.

    Methods inherited from class Object

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

  • Method Details

    • of

      public static Stroke of(float width)
      Returns a stroke of a width with Stroke.Cap.BUTT ends and Stroke.Join.MITER corners.
      Parameters:
      width - the width in UI units
      Returns:
      the stroke
      Throws:
      IllegalArgumentException - if the width is negative or not finite
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • width

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

      public Stroke.Cap cap()
      Returns the value of the cap record component.
      Returns:
      the value of the cap record component
    • join

      public Stroke.Join join()
      Returns the value of the join record component.
      Returns:
      the value of the join record component