Support for new blend modes: CLEAR, ALPHA_MAX

Michael Strauß michaelstrau2 at gmail.com
Wed Jun 25 00:53:12 UTC 2025


The CLEAR blend mode seems to be an obvious addition.

The case for ALPHA_MAX is a bit more difficult to justify, as it seems
like a special-purpose mode. You need this particular blend mode, but
the next developer might need COLOR_DODGE_WITH_ALPHA_MAX or
LIGHTEN_WITH_ALPHA_ATOP.

Maybe we can prevent a combinatorial explosion by separating color
blending and alpha blending. Right now, all blend modes listed in
BlendMode use one of three alpha blending modes: "source over",
"source atop", or "add". We can add "max" to this list, and have a new
AlphaMode enumeration with the following constants: DEFAULT, SRC_OVER,
SRC_ATOP, ADD, MAX.

The value DEFAULT means: use the alpha mode that is specified for the
BlendMode. For example, BlendMode.SRC_ADD will use AlphaMode.SRC_ADD;
similarly, BlendMode.SCREEN will use AlphaMode.SRC_OVER.

But now, you can change that! Your special-purpose mode would be
BlendMode.SRC_OVER + AlphaMode.MAX. My special-purpose mode will be
BlendMode.LIGHTEN + AlphaMode.SRC_ATOP.


More information about the openjfx-dev mailing list