Class GuiGradient
java.lang.Object
com.render.api.gui.GuiGradient
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA color stop with an optional second position.static final recordExplicit color interpolation hint between the neighboring color stops.static enumDirection used when interpolating the hue component of a polar color space.static enumColor space used between gradient stops.static final recordTyped stop position.static enumUnit carried by an advanced stop or hint position.static interfaceOne item in an advanced stop sequence.static final recordA compatibility color stop.static enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatangleDegrees(float angleDegrees) center(float x, float y) floatcenterX()floatcenterY()colorAt(float progress) colorAt(float progress, float referenceLength) Samples with a resolved pixel reference length for typed pixel stops.conic()copy()endColor()endColor(int argb) Deprecated.endColor(RenderColor color) interpolation(GuiGradient.InterpolationSpace space, GuiGradient.HueDirection hueDirection) Selects the interpolation color space and hue path.linear()radial()floatradius()radius(float radius) Sets the radial reach relative to the farthest box corner.booleanrepeating(boolean repeating) intresolution(int resolution) Sets gradient lookup precision.startColor(int argb) Deprecated.startColor(RenderColor color) steps()steps(GuiGradient.Step... steps) Replaces the sequence with typed color stops and interpolation hints.stop(float position, int argb) Deprecated.stop(float position, RenderColor color) Appends a color stop.stops()stops(GuiGradient.Stop... stops) Replaces all stops.type()type(GuiGradient.Type type)
-
Constructor Details
-
GuiGradient
public GuiGradient()
-
-
Method Details
-
startColor
-
startColor
-
startColor
Deprecated. -
endColor
-
endColor
-
endColor
Deprecated. -
angleDegrees
public float angleDegrees() -
angleDegrees
-
type
-
type
-
linear
-
radial
-
conic
-
center
-
centerX
public float centerX() -
centerY
public float centerY() -
radius
Sets the radial reach relative to the farthest box corner. -
radius
public float radius() -
repeating
-
repeating
public boolean repeating() -
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 spacehueDirection- polar hue direction- Returns:
- this gradient
-
interpolationSpace
-
hueDirection
-
stop
Appends a color stop. Equal positions are retained, enabling hard transitions. -
stop
Deprecated. -
stops
Replaces all stops. At least two stops are required. -
stops
-
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
-
colorAt
-
colorAt
Samples with a resolved pixel reference length for typed pixel stops.- Parameters:
progress- geometric gradient progressreferenceLength- resolved gradient-line length in design or device pixels- Returns:
- interpolated color
-
copy
-
endColor(RenderColor).