Package limn.graphics

Record Class BackdropEffect.Crt

java.lang.Object
java.lang.Record
limn.graphics.BackdropEffect.Crt
Record Components:
tint - colour over the tube; usually clear, since a tint dense enough to see also flattens the curvature it is laid over
scanline - how deep the mask cuts, 0 (none) to 1. Drives both the scan lines and the grille: bright scan lines swell into their own gap the way a phosphor does, so a lit area stays lit instead of being evenly darkened. Around 0.2 reads as a tube behind glass; 0.5 and up reads as one you are close to
curvature - how far the face bulges, 0 (flat) to 1, and with it how far the corners fall away. The displacement grows with the SQUARE of the distance from the centre, so the middle stays still and the corners move most, which is the shape of a real tube and not a lens
All Implemented Interfaces:
BackdropEffect
Enclosing interface:
BackdropEffect

public static record BackdropEffect.Crt(Color tint, float scanline, float curvature) extends Record implements BackdropEffect
The backdrop as a cathode-ray tube shows it: bent onto a curved face and striped by the scan. A shape wearing this reads as a screen inside the window rather than as a filter over it, which is the whole reason it is a shape effect and not a full-frame pass.

Both halves are anchored to the shape, not to the framebuffer, and that is the opposite of BackdropEffect.Pixelate. A pixelated panel anchors its grid to the framebuffer so a panel that moves does not shimmer through its own cells; a tube's curvature and its scan lines are properties of the tube, so they have to travel with it, and one that kept its stripes while it slid would read as a hole cut in a filter.

The two pitches are locked rather than exposed: 6.0f points for the beam and 3.0f for the mask. In points and not pixels, so the structure is the same size on a dense display as on a coarse one; and the beam coarser than the mask, which is the ratio that makes the scan read as lines at all. At one shared pitch the two patterns sum into an even mesh, which looks like a screen door laid over the picture.

Two parameters drive four things. scanline moves the beam and the mask together and curvature moves the bulge and the falloff together, because within each pair the two are genuinely one thing: the glass that bends the picture is the glass that dims its corners, and a beam without the mask in front of it is not a tube. Across the pairs they are different hardware, which is why there are two parameters and not one.

Give it room. Both halves are fractions of the distance from the shape's own centre, so in a panel the size of a caption they move a point or two and the whole thing reads as a stripe pattern laid over the picture. It wants to be the screen.

  • Field Details

    • SCAN_PITCH

      public static final float SCAN_PITCH
      Beam pitch in points: the distance between one scan line and the next.
      See Also:
    • GRILLE_PITCH

      public static final float GRILLE_PITCH
      Mask pitch in points: the width of one RGB triad of the aperture grille.
      See Also:
  • Constructor Details

    • Crt

      public Crt(Color tint, float scanline, float curvature)
      Creates an instance of a Crt record class.
      Parameters:
      tint - the value for the tint record component
      scanline - the value for the scanline record component
      curvature - the value for the curvature record component
    • Crt

      public Crt(Color tint)
      A tube with a visible scan and a gentle bulge: the default set 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
    • scanline

      public float scanline()
      Returns the value of the scanline record component.
      Returns:
      the value of the scanline record component
    • curvature

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