Skip to content

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.

A dark grey frame with a blue outline marks the bounds of a node; the mask keeps only a blue to light grey gradient window in its middle

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.

ReturnsSignatureSummary
MaskNodeEffectcreate() factoryCreates a mask that covers the whole node; the setters place and size it.
MaskNodeEffect() protectedCalled by a subclass.

PropertyTypeDefaultSummary
x signaldouble0DHorizontal offset of the visible rectangle from the left edge of the node, in design pixels.
y signaldouble0DVertical offset of the visible rectangle from the top edge of the node, in design pixels.
width signaldoublethe width of the node, read on every frameWidth of the visible rectangle, in design pixels; without a value, the width of the node.
height signaldoublethe height of the node, read on every frameHeight of the visible rectangle, in design pixels; without a value, the height of the node.
resource signalResourcenullResource 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)

priority · scope

ReturnsSignatureSummary
voiddraw(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)

shouldApply · toShaderPass · toShaderPasses · copy

MaskNodeEffect create() factory

Creates a mask that covers the whole node; the setters place and size it.

MaskNodeEffect() protected

Called by a subclass.

  • this x(double x) fluent
  • this x(Supplier<Double> xSupplier) fluent signal
  • double getX()

Default: 0D

Horizontal offset of the visible rectangle from the left edge of the node, in design pixels.

  • this y(double y) fluent
  • this y(Supplier<Double> ySupplier) fluent signal
  • double getY()

Default: 0D

Vertical offset of the visible rectangle from the top edge of the node, in design pixels.

  • this width(double width) fluent
  • this width(Supplier<Double> widthSupplier) fluent signal
  • double 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.

  • this height(double height) fluent
  • this height(Supplier<Double> heightSupplier) fluent signal
  • double 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.

  • this resource(Resource resource) fluent
  • this resource(Supplier<Resource> resourceSupplier) fluent signal
  • Resource 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.

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

Report a problem with this page