Package limn.graphics

Record Class Shadow

java.lang.Object
java.lang.Record
limn.graphics.Shadow
Record Components:
offsetX - how far the shadow lies to the right of the shape, in points
offsetY - how far below it
blur - the width of the soft edge, in points; zero or more
color - the shadow's colour, its alpha being how dark it is where it is whole

public record Shadow(float offsetX, float offsetY, float blur, Color color) extends Record
One layer of the shadow a shape casts: the shape's own outline moved by an offset, blurred, in one colour. What Canvas.drawShadow(limn.graphics.RoundRect, limn.graphics.Shadow) draws.

The blur is the distance over which the shadow's edge goes from full to nothing, as in a style sheet's box-shadow; zero is a hard copy of the shape.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Shadow(float offsetX, float offsetY, float blur, Color color)
    Creates an instance of a Shadow record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the value of the blur record component.
    Returns the value of the color 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 offsetX record component.
    float
    Returns the value of the offsetY record component.
    float
     
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • Shadow

      public Shadow(float offsetX, float offsetY, float blur, Color color)
      Creates an instance of a Shadow record class.
      Parameters:
      offsetX - the value for the offsetX record component
      offsetY - the value for the offsetY record component
      blur - the value for the blur record component
      color - the value for the color record component
  • Method Details

    • reach

      public float reach()
      Returns:
      how far past the shape's box this layer can leave ink, on its farthest side: what a widget drawing it adds to the region its repaints damage
    • 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 '=='.
      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.
    • offsetX

      public float offsetX()
      Returns the value of the offsetX record component.
      Returns:
      the value of the offsetX record component
    • offsetY

      public float offsetY()
      Returns the value of the offsetY record component.
      Returns:
      the value of the offsetY record component
    • blur

      public float blur()
      Returns the value of the blur record component.
      Returns:
      the value of the blur record component
    • color

      public Color color()
      Returns the value of the color record component.
      Returns:
      the value of the color record component