Class GuiSvgDocument

java.lang.Object
com.render.api.gui.GuiSvgDocument

public final class GuiSvgDocument extends Object
Retained mutable SVG element tree with stable node identities and versioned asynchronous rasterization.

DOM and style mutations increment generation(). The shared asset manager keeps the last valid texture visible while a newer generation rasterizes, discards obsolete completions, and publishes only the newest requested generation.

  • Method Details

    • parse

      public static GuiSvgDocument parse(String svg)
    • builder

      public static GuiSvgDocument builder(GuiSvgBuilder builder)
    • root

      public GuiSvgDocument.Node root()
    • nodes

      public List<GuiSvgDocument.Node> nodes()
    • byId

      public Optional<GuiSvgDocument.Node> byId(String id)
    • select

      public List<GuiSvgDocument.Node> select(GuiSvgSelector selector)
    • rule

      public GuiSvgDocument rule(GuiSvgSelector selector, Consumer<GuiStyleBuilder> declarations)
      Adds a retained typed presentation rule and applies all rules in source order.
      Returns:
      this document
    • append

      public GuiSvgDocument.Node append(GuiSvgDocument.Node parent, String tag)
    • remove

      public void remove(GuiSvgDocument.Node node)
    • hitTest

      public Optional<GuiSvgDocument.Node> hitTest(float x, float y)
      Performs transformed retained hit testing for SVG viewport, shape, path, line, polyline, polygon, image, and text geometry. Visibility and pointer-event suppression are honored; nodes later in paint order win.
    • markup

      public String markup()
    • sampleAnimations

      public boolean sampleAnimations(double animationTimeSeconds)
      Samples every retained SVG attribute animation against a view animation clock.

      The document generation changes only if at least one serialized attribute value changes. RenderLib invokes this automatically when the document is painted; it is public so a caller can drive a detached document with another retained clock.

      Parameters:
      animationTimeSeconds - clock time in seconds
      Returns:
      whether the sampled SVG markup changed
    • cacheKey

      public String cacheKey()
    • generation

      public long generation()
    • hintWidth

      public float hintWidth()
    • hintHeight

      public float hintHeight()
    • load

      public com.render.api.gui.GuiLoadedAsset load() throws Exception
      Throws:
      Exception