Skip to content

RoundedShader

final class RoundedShader
Extends: ShaderProgram
Package: dev.joid.lib.shader.impl · Module: core · Source: RoundedShader.java

The shader of rounded rectangles and rounded borders, which masks what is drawn outside a rounded box.

DrawShape and RoundedShaderPass use it; call it for geometry of your own that needs rounded corners. The box is given as its inner rectangle, the box shrunk by the radius on each rounded side, in the coordinates you draw in.

ReturnsSignatureSummary
RoundedShaderinst() factoryReturns the shared shader.

ReturnsSignatureSummary
voiduse(float radius, float x1, float y1, float x2, float y2, Runnable runnable) staticRuns runnable with the shader bound on the inner rectangle x1, y1, x2, y2 and the corner radius, then restores the previous shader.
voidbind(float radius, float x1, float y1, float x2, float y2)Binds the shader on the inner rectangle and the corner radius, masking the texture tinted by the color.
voidbind(float radius, float x1, float y1, float x2, float y2, ShaderFillType type)Binds the shader and masks what type names.
voidaligned(boolean aligned)If true, the edge is smoothed over one screen pixel for a box on the pixel grid; if false, over the coverage of a box under a rotation or a fractional scale.
voidstroke(float stroke)Keeps only a stroke stroke wide inside the edge, for a rounded border; 0F fills the whole box.
Inherited from ShaderProgram (7)

delete · unbind · getShader · canDraw · isAvailable · gradient · uniformGradient

RoundedShader inst() factory

Returns the shared shader.

void use(float radius, float x1, float y1, float x2, float y2, Runnable runnable) static

Runs runnable with the shader bound on the inner rectangle x1, y1, x2, y2 and the corner radius, then restores the previous shader.

void bind(float radius, float x1, float y1, float x2, float y2)

Binds the shader on the inner rectangle and the corner radius, masking the texture tinted by the color.

void bind(float radius, float x1, float y1, float x2, float y2, ShaderFillType type)

Binds the shader and masks what type names.

void aligned(boolean aligned)

If true, the edge is smoothed over one screen pixel for a box on the pixel grid; if false, over the coverage of a box under a rotation or a fractional scale.

void stroke(float stroke)

Keeps only a stroke stroke wide inside the edge, for a rounded border; 0F fills the whole box.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page