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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
RoundedShader | inst() factory | Returns the shared shader. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
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. |
Inherited from ShaderProgram (7)
delete · unbind · getShader · canDraw · isAvailable · gradient · uniformGradient
Creation details
Section titled “Creation details”RoundedShader inst() factory
Returns the shared shader.
Method details
Section titled “Method details”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.
aligned
Section titled “aligned”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.
stroke
Section titled “stroke”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
