MaskNodeEffect
class MaskNodeEffect
Extends: NodeEffect<Node>
Package: dev.joid.lib.ui.node.effect.impl · Module: core · Source: MaskNodeEffect.java
Hides every pixel of a node and its children outside a rectangle, or outside the opaque part of an image.

Description
Section titled “Description”The rectangle starts at the top-left corner of the node and, without a size, covers the bounds of the node: MaskNodeEffect.create() alone hides what the children draw outside the node.
Masks nest: a masked node inside another mask shows only what both keep.
Its priority is 0 (Control the order of effects).
The mask clips the drawing only: the hidden part of the node still receives the mouse.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
MaskNodeEffect | create() factory | Creates a mask that covers the whole node; the setters place and size it. |
| MaskNodeEffect() protected | Called by a subclass. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| x signal | double | 0D | Horizontal offset of the visible rectangle from the left edge of the node, in design pixels. |
| y signal | double | 0D | Vertical offset of the visible rectangle from the top edge of the node, in design pixels. |
| width signal | double | the width of the node, read on every frame | Width of the visible rectangle, in design pixels; without a value, the width of the node. |
| height signal | double | the height of the node, read on every frame | Height of the visible rectangle, in design pixels; without a value, the height of the node. |
| resource signal | Resource | null | Resource stretched over the visible rectangle, whose opaque part forms the mask: it keeps the pixels where the image has an alpha above 0.5F, so the edges are hard. |
Inherited from NodeEffect (2)
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
void | draw(Node node, Runnable body) | Draws the node and its children through UI.mask, with the rectangle or the image of the effect. |
Inherited from NodeEffect (4)
Creation details
Section titled “Creation details”create
Section titled “create”MaskNodeEffect create() factory
Creates a mask that covers the whole node; the setters place and size it.
MaskNodeEffect
Section titled “MaskNodeEffect”MaskNodeEffect() protected
Called by a subclass.
Property details
Section titled “Property details”this x(double x)fluentthis x(Supplier<Double> xSupplier)fluent signaldouble getX()
Default: 0D
Horizontal offset of the visible rectangle from the left edge of the node, in design pixels.
this y(double y)fluentthis y(Supplier<Double> ySupplier)fluent signaldouble getY()
Default: 0D
Vertical offset of the visible rectangle from the top edge of the node, in design pixels.
this width(double width)fluentthis width(Supplier<Double> widthSupplier)fluent signaldouble getWidth()
Default: the width of the node, read on every frame
Width of the visible rectangle, in design pixels; without a value, the width of the node.
getWidth() returns the width that the mask used on the last frame, 0D before the node is drawn.
height
Section titled “height”this height(double height)fluentthis height(Supplier<Double> heightSupplier)fluent signaldouble getHeight()
Default: the height of the node, read on every frame
Height of the visible rectangle, in design pixels; without a value, the height of the node.
getHeight() returns the height that the mask used on the last frame, 0D before the node is drawn.
resource
Section titled “resource”this resource(Resource resource)fluentthis resource(Supplier<Resource> resourceSupplier)fluent signalResource getResource()
Default: null
Resource stretched over the visible rectangle, whose opaque part forms the mask: it keeps the pixels where the image has an alpha above 0.5F, so the edges are hard.
null masks with the plain rectangle.
Method details
Section titled “Method details”void draw(Node node, Runnable body)
Draws the node and its children through UI.mask, with the rectangle or the image of the effect.
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
