Class GuiGradient

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

public final class GuiGradient extends Object
Browser-style gradient configuration for GUI backgrounds.

Linear gradients keep the original two-color API, while arbitrary color stops, radial/conic geometry, repeating paint, and lookup quality are additive options. Keep a configured instance on a retained component or custom painted component instead of constructing an equivalent gradient every frame; this lets the renderer reuse one managed lookup texture. If that GPU texture is invalidated, the current frame safely uses the adaptive mesh path and recreates the lookup on demand.

  • Constructor Details

    • GuiGradient

      public GuiGradient()
  • Method Details

    • startColor

      public RenderColor startColor()
    • startColor

      public GuiGradient startColor(RenderColor color)
    • endColor

      public RenderColor endColor()
    • endColor

      public GuiGradient endColor(RenderColor color)
    • angleDegrees

      public float angleDegrees()
    • angleDegrees

      public GuiGradient angleDegrees(float angleDegrees)
    • type

      public GuiGradient.Type type()
    • type

      public GuiGradient type(GuiGradient.Type type)
    • linear

      public GuiGradient linear()
    • radial

      public GuiGradient radial()
    • conic

      public GuiGradient conic()
    • center

      public GuiGradient center(float x, float y)
    • centerX

      public float centerX()
    • centerY

      public float centerY()
    • radius

      public GuiGradient radius(float radius)
      Sets the radial reach relative to the farthest box corner.
    • radius

      public float radius()
    • repeating

      public GuiGradient repeating(boolean repeating)
    • repeating

      public boolean repeating()
    • resolution

      public GuiGradient resolution(int resolution)
      Sets gradient lookup precision. Higher values improve very large or sharp gradients at the cost of a larger cached one-dimensional texture; the accepted range is 4 through 64. The same value controls subdivision density if the shader lookup path is unavailable.
    • resolution

      public int resolution()
    • interpolation

      public GuiGradient interpolation(GuiGradient.InterpolationSpace space, GuiGradient.HueDirection hueDirection)
      Selects the interpolation color space and hue path.
      Parameters:
      space - interpolation color space
      hueDirection - polar hue direction
      Returns:
      this gradient
    • interpolationSpace

      public GuiGradient.InterpolationSpace interpolationSpace()
    • hueDirection

      public GuiGradient.HueDirection hueDirection()
    • stop

      public GuiGradient stop(float position, RenderColor color)
      Appends a color stop. Equal positions are retained, enabling hard transitions.
    • stops

      public GuiGradient stops(GuiGradient.Stop... stops)
      Replaces all stops. At least two stops are required.
    • stops

      public List<GuiGradient.Stop> stops()
    • steps

      public GuiGradient steps(GuiGradient.Step... steps)
      Replaces the sequence with typed color stops and interpolation hints.

      At least two color stops are required. Hints must appear between color stops.

      Parameters:
      steps - typed sequence
      Returns:
      this gradient
    • steps

      public List<GuiGradient.Step> steps()
    • colorAt

      public RenderColor colorAt(float progress)
    • colorAt

      public RenderColor colorAt(float progress, float referenceLength)
      Samples with a resolved pixel reference length for typed pixel stops.
      Parameters:
      progress - geometric gradient progress
      referenceLength - resolved gradient-line length in design or device pixels
      Returns:
      interpolated color
    • copy

      public GuiGradient copy()
    • immutableCopy

      public GuiGradient immutableCopy()
      Returns a detached snapshot whose mutators reject subsequent changes.
      Returns:
      immutable gradient snapshot