Skip to content

RoundedNodeEffect

class RoundedNodeEffect
Extends: NodeEffect<Node>
Package: dev.joid.lib.ui.node.effect.impl · Module: core · Source: RoundedNodeEffect.java

Rounds the corners of what a node draws, all four or only some of them.

A blue rectangle with rounded corners

The corners are cut from the pixels of the node, so it rounds a rectangle, an image or a video alike. The radius never goes past half the shorter side: create(999F) turns a rectangle into a pill. A BorderNodeEffect on the same node outlines the rounded shape, and a ShadowNodeEffect takes its radius and its sides. Its priority is 100, so its pass runs before a blur and a border.

ReturnsSignatureSummary
RoundedNodeEffectcreate(float radius) factoryCreates an effect that rounds the four corners with this radius, in design pixels.
RoundedNodeEffectcreate(Supplier radiusSupplier) factoryCreates an effect whose radius follows a Supplier: a signal, a derived value or a lambda.
RoundedNodeEffect(Supplier radiusSupplier) protectedCalled by a subclass with the same argument as create(Supplier).

PropertyTypeDefaultSummary
radius signalfloatset at creationRadius of the corners, in design pixels, bounded by half the shorter side of the node.
top signalbooleantrueIf false, the two top corners stay square: a corner is rounded only when both of its sides are.
bottom signalbooleantrueIf false, the two bottom corners stay square.
left signalbooleantrueIf false, the two left corners stay square.
right signalbooleantrueIf false, the two right corners stay square.
Inherited from NodeEffect (2)

priority · scope

ReturnsSignatureSummary
IShaderPasstoShaderPass(Node node)Returns the pass that cuts the corners, with the edges of the node snapped to the screen pixels.
Inherited from NodeEffect (4)

draw · shouldApply · toShaderPasses · copy

RoundedNodeEffect create(float radius) factory

Creates an effect that rounds the four corners with this radius, in design pixels.

RoundedNodeEffect create(Supplier<Float> radiusSupplier) factory

Creates an effect whose radius follows a Supplier: a signal, a derived value or a lambda.

RoundedNodeEffect(Supplier<Float> radiusSupplier) protected

Called by a subclass with the same argument as create(Supplier).

  • this radius(float radius) fluent
  • this radius(Supplier<Float> radiusSupplier) fluent signal
  • float getRadius()

Default: set at creation

Radius of the corners, in design pixels, bounded by half the shorter side of the node.

  • this top(boolean top) fluent
  • this top(Supplier<Boolean> topSupplier) fluent signal
  • boolean isTop()

Default: true

If false, the two top corners stay square: a corner is rounded only when both of its sides are.

  • this bottom(boolean bottom) fluent
  • this bottom(Supplier<Boolean> bottomSupplier) fluent signal
  • boolean isBottom()

Default: true

If false, the two bottom corners stay square.

  • this left(boolean left) fluent
  • this left(Supplier<Boolean> leftSupplier) fluent signal
  • boolean isLeft()

Default: true

If false, the two left corners stay square.

  • this right(boolean right) fluent
  • this right(Supplier<Boolean> rightSupplier) fluent signal
  • boolean isRight()

Default: true

If false, the two right corners stay square.

IShaderPass toShaderPass(Node node)

Returns the pass that cuts the corners, with the edges of the node snapped to the screen pixels.


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