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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
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. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
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. |
Constants and fields
Section titled “Constants and fields”| Type | Name | Value | Summary |
|---|---|---|---|
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. | |
BlendState | DISABLED | No blending: the color replaces the pixel, alpha included. | |
BlendState | PREMULTIPLIED | BlendState.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. |
Creation details
Section titled “Creation details”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.
Method details
Section titled “Method details”isEnabled
Section titled “isEnabled”boolean isEnabled()
If false, the backend turns blending off; only DISABLED returns false.
getEquation
Section titled “getEquation”Equation getEquation()
Returns the operation that combines the weighted source and destination.
getSourceColor
Section titled “getSourceColor”Factor getSourceColor()
Returns the factor applied to the RGB channels of the color being drawn.
getDestinationColor
Section titled “getDestinationColor”Factor getDestinationColor()
Returns the factor applied to the RGB channels already on the target.
getSourceAlpha
Section titled “getSourceAlpha”Factor getSourceAlpha()
Returns the factor applied to the alpha of the color being drawn.
getDestinationAlpha
Section titled “getDestinationAlpha”Factor getDestinationAlpha()
Returns the factor applied to the alpha already on the target.
equals
Section titled “equals”boolean equals(Object other)
If true, the other object is of the same class with the same switch, equation and factors.
hashCode
Section titled “hashCode”int hashCode()
Returns a hash of the values that equals compares.
Constant and field details
Section titled “Constant and field details”NORMAL
Section titled “NORMAL”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.
DISABLED
Section titled “DISABLED”BlendState DISABLED
No blending: the color replaces the pixel, alpha included. It is the blending of a fresh render state.
PREMULTIPLIED
Section titled “PREMULTIPLIED”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
