Skip to content

BlendState

final class BlendState
Package: dev.joid.lib.bridge.render.state · Module: core · Source: BlendState.java

How a draw combines its colors with the pixels already on the target, an equation and four factors.

BlendState is immutable and compares by value: keep your own blend states in constants, and pass one to blend(...) of the RenderState. The calls of DrawUtils set the blending they need; a blend of yours applies to the vertices you send with the Tessellator.

ReturnsSignatureSummary
BlendStateof(Equation equation, Factor source, Factor destination) factoryCreates an enabled blend state with the same source and destination factors for the color and for the alpha.
BlendStateof(Equation equation, Factor sourceColor, Factor destinationColor, Factor sourceAlpha, Factor destinationAlpha) factoryCreates an enabled blend state with separate factors: source and destination for the color channels, then source and destination for the alpha.

ReturnsSignatureSummary
booleanisEnabled()If false, the backend turns blending off; only DISABLED returns false.
EquationgetEquation()Returns the operation that combines the weighted source and destination.
FactorgetSourceColor()Returns the factor applied to the RGB channels of the color being drawn.
FactorgetDestinationColor()Returns the factor applied to the RGB channels already on the target.
FactorgetSourceAlpha()Returns the factor applied to the alpha of the color being drawn.
FactorgetDestinationAlpha()Returns the factor applied to the alpha already on the target.
booleanequals(Object other)If true, the other object is of the same class with the same switch, equation and factors.
inthashCode()Returns a hash of the values that equals compares.
TypeNameValueSummary
BlendStateNORMALThe usual transparency: the color covers what is under it in proportion to its alpha, and the alpha of the target adds up.
BlendStateDISABLEDNo blending: the color replaces the pixel, alpha included.
BlendStatePREMULTIPLIEDBlendState.of(Equation.ADD, Factor.ONE, Factor.ONE_MINUS_SRC_ALPHA)Blending for colors already multiplied by their alpha, such as the content of a framebuffer drawn over the screen.

BlendState of(Equation equation, Factor source, Factor destination) factory

Creates an enabled blend state with the same source and destination factors for the color and for the alpha.

BlendState of(Equation equation, Factor sourceColor, Factor destinationColor, Factor sourceAlpha, Factor destinationAlpha) factory

Creates an enabled blend state with separate factors: source and destination for the color channels, then source and destination for the alpha.

boolean isEnabled()

If false, the backend turns blending off; only DISABLED returns false.

Equation getEquation()

Returns the operation that combines the weighted source and destination.

Factor getSourceColor()

Returns the factor applied to the RGB channels of the color being drawn.

Factor getDestinationColor()

Returns the factor applied to the RGB channels already on the target.

Factor getSourceAlpha()

Returns the factor applied to the alpha of the color being drawn.

Factor getDestinationAlpha()

Returns the factor applied to the alpha already on the target.

boolean equals(Object other)

If true, the other object is of the same class with the same switch, equation and factors.

int hashCode()

Returns a hash of the values that equals compares.

BlendState NORMAL

The usual transparency: the color covers what is under it in proportion to its alpha, and the alpha of the target adds up. The drawing of JOID uses it for shapes, text and images.

BlendState DISABLED

No blending: the color replaces the pixel, alpha included. It is the blending of a fresh render state.

BlendState PREMULTIPLIED

Blending for colors already multiplied by their alpha, such as the content of a framebuffer drawn over the screen.


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