Record Class BackendServices

java.lang.Object
java.lang.Record
limn.backend.spi.BackendServices
Record Components:
ui - the user-interface thread's runtime, bound to the thread that will run the loop
textRuler - measures and shapes text
fontCatalog - the font families the platform offers
fontLoader - reads a font file the application names, and a family's faces ahead of their first use
imageDecoder - decodes image files
svgRenderer - draws SVG
graphics3d - the 3D viewport's renderer, or null for none
videoSurfaces - GPU surfaces a video view composites, or null for none
audioEngine - plays sound, or null for no audio device
audioDecoder - decodes sound files, or null when there is no audio at all
glyphOutlines - the outlines of the glyphs the text ruler shapes, which a printed document writes as text, or null for none

public record BackendServices(UiRuntime ui, TextRuler textRuler, FontCatalog fontCatalog, FontLoader fontLoader, ImageDecoder imageDecoder, SvgRenderer svgRenderer, @Nullable Graphics3D.Provider graphics3d, @Nullable VideoSurfaces.Provider videoSurfaces, @Nullable AudioEngine audioEngine, @Nullable AudioDecoder audioDecoder, @Nullable GlyphOutlines glyphOutlines) extends Record
Everything a Backend provides to the toolkit besides its windows, named in one place and installed by one call.

Until 2026-09-22 a backend installed each of these through a static setter of its own, and nothing on the SPI said which it owed: a backend that forgot the text ruler measured every string as zero wide, with no error anywhere. A backend now builds this record in its constructor and calls install(); the record's constructor refuses a missing required service on the spot.

Five services are required — nothing draws without them. Five are optional, and null is how a backend says it has none: a machine with no audio device, a backend without 3D or without GPU video surfaces, one that cannot outline glyphs. The toolkit then reports the capability as unavailable (Sounds.isAvailable(), Graphics3D, VideoSurfaces) or degrades (a printed document draws text it cannot outline from nothing, with a warning) rather than failing.

  • Constructor Details

  • Method Details

    • install

      public void install()
      Installs every service where the toolkit reads it. Once, from the backend's constructor, on the thread the backend's loop will run on.
    • 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 Objects::equals(Object,Object).
      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.
    • ui

      public UiRuntime ui()
      Returns the value of the ui record component.
      Returns:
      the value of the ui record component
    • textRuler

      public TextRuler textRuler()
      Returns the value of the textRuler record component.
      Returns:
      the value of the textRuler record component
    • fontCatalog

      public FontCatalog fontCatalog()
      Returns the value of the fontCatalog record component.
      Returns:
      the value of the fontCatalog record component
    • fontLoader

      public FontLoader fontLoader()
      Returns the value of the fontLoader record component.
      Returns:
      the value of the fontLoader record component
    • imageDecoder

      public ImageDecoder imageDecoder()
      Returns the value of the imageDecoder record component.
      Returns:
      the value of the imageDecoder record component
    • svgRenderer

      public SvgRenderer svgRenderer()
      Returns the value of the svgRenderer record component.
      Returns:
      the value of the svgRenderer record component
    • graphics3d

      public @Nullable Graphics3D.Provider graphics3d()
      Returns the value of the graphics3d record component.
      Returns:
      the value of the graphics3d record component
    • videoSurfaces

      public @Nullable VideoSurfaces.Provider videoSurfaces()
      Returns the value of the videoSurfaces record component.
      Returns:
      the value of the videoSurfaces record component
    • audioEngine

      public @Nullable AudioEngine audioEngine()
      Returns the value of the audioEngine record component.
      Returns:
      the value of the audioEngine record component
    • audioDecoder

      public @Nullable AudioDecoder audioDecoder()
      Returns the value of the audioDecoder record component.
      Returns:
      the value of the audioDecoder record component
    • glyphOutlines

      public @Nullable GlyphOutlines glyphOutlines()
      Returns the value of the glyphOutlines record component.
      Returns:
      the value of the glyphOutlines record component