Package limn.graphics

Record Class BackdropEffect.Clear

java.lang.Object
java.lang.Record
limn.graphics.BackdropEffect.Clear
Record Components:
tint - colour over the refracted backdrop
thickness - the pane's body, in points: both the width of the rounded rim and the optical depth the ray crosses, because for a bevelled pane they are the same measurement. 0 is a flat pane that refracts nothing and catches no highlight. A thicker pane rolls wider and carries the picture further sideways under the roll; past half the shape's smallest side the whole shape is bevel
dispersion - how far red and blue split either side of green, 0 (none) to 1. This spreads the index, not the displacement: at 1 the two ends of the spectrum differ by about four parts in a hundred, against roughly one in sixty for real crown glass, so even full dispersion is an exaggeration of an optical fringe rather than a prism
All Implemented Interfaces:
BackdropEffect
Enclosing interface:
BackdropEffect

public static record BackdropEffect.Clear(Color tint, float thickness, float dispersion) extends Record implements BackdropEffect
A transparent pane: the backdrop is not blurred, it is refracted at the rim, the way light bends through the bevelled edge of real glass. The shape's own signed-distance field is the surface, so the effect follows every corner radius exactly and costs no extra geometry.

This is the cheap variant, with three samples per pixel in the rim band and no blur chain, and the one that reads as glass rather than as a frosted overlay. Over busy content it keeps the content legible, which frosting does not.

The bevel is a quarter-round and the light is actually refracted through it. The sine of the angle the surface makes with the pane is the distance still to go across the rim, which needs no height map, and the picture behind is displaced by the lateral shift through a slab of that depth. That concentration is the whole look: real glass bends almost nothing across its flat middle and then very hard in the last fraction of the bevel. An earlier version ramped the displacement quadratically, which is smooth everywhere and reads as a soft lens.

No highlight rides the rim, and that is a decision rather than an omission. ADR 019 predicted a specular would be the cheapest thing that made this read as glass rather than as a lens; built and looked at, a key light fixed in the shader reads as painted-on, because it does not move when anything else in the window does. A highlight that belonged here would have to come from somewhere the scene actually knows about, and the toolkit has no light for a 2D canvas to ask.

  • Constructor Details

    • Clear

      public Clear(Color tint, float thickness, float dispersion)
      Creates an instance of a Clear record class.
      Parameters:
      tint - the value for the tint record component
      thickness - the value for the thickness record component
      dispersion - the value for the dispersion record component
    • Clear

      public Clear(Color tint)
      A pane with a 12pt rim and a light optical fringe: the default glass of this toolkit.
  • Method Details

    • 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.
    • tint

      public Color tint()
      Returns the value of the tint record component.
      Specified by:
      tint in interface BackdropEffect
      Returns:
      the value of the tint record component
    • thickness

      public float thickness()
      Returns the value of the thickness record component.
      Returns:
      the value of the thickness record component
    • dispersion

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