JavaFX Blend Effect

In general, blend effect produces the output that is generated as a result of the mixture of two or more different input nodes. It takes the pixels of two or more nodes, mix them according to the applied blend mode and produces the output node at the same location.

If the two images are overlapping each other then the blend mode is applied on the overlapped area of both the images.

Properties

The class contains four properties which are described along with their setter methods in the following table.

Property Description Setter Methods
bottomInput The bottom input for the blend operation. This is a object type property. setBottomInput(Effect value)
mode The mode according to which, the inputs are blend together. setMode(BlendMode value)
opacity This is the opacity value of double type. setOpacity(double value)
topInput The top input for the blend operation. setTopInput(Effect Value)

Constructors

There are three constructors in this class.

  1. Blend() : Instantiate Blend class with the default values.
  2. Blend(BlendMode mode): Instantiate Blend class with the specified mode
  3. Blend(BlendMode mode, Effect BottomInput, Effect TopInput): Instantiate Blend class with the specified blend mode, Bottom Input effect and Top Input effect

Example:


JavaFX Blend Effect

Blend Mode

JavaFX provides various blendmodes which can be applied in order to modify the Blend Effect.

Blend Mode Description Output
Add The color components of the top input are added to that from the bottom input. JavaFX Blend Mode Add Output
Blue Only Blue components of the bottom input gets replaced by the blue component of top input. JavaFX Blend Mode Blue Output
COLOR_BURN The bottom input color gets inverted and divided by the top input color components. The result is again inverted to get the output color. JavaFX Blend Mode COLORBURN Output
COLOR_DODGE The top color components gets inverted and divide the bottom color components to produce the output color. JavaFX Blend Mode COLOR DODGE Output
DARKEN The color which is darker of the two input component colors is selected to produce the resulting color. JavaFX Blend Mode DARKEN Output
DIFFERENCE The darker of the two input color is subtracted from the lighter color to produce the resulting color. JavaFX Blend Mode DIFFERENCE Output
EXCLUSION The two input color components are multiplied and doubled and then subtracted from the sum of bottom color components to produce the desired color. JavaFX Blend Mode EXCLUSION Output
GREEN The green component from the bottom input is replaced by the green input of top component. JavaFX Blend Mode GREEN Output
HARD_LIGHT The input color components are either multiplied or screened depending upon the bottom color. JavaFX Blend Mode HARD LIGHT Output
LIGHTEN The lighter color of the two color components is produced as output. JavaFX Blend Mode LIGHTEN Output
MULTIPLY Both the color components get multiplied to produce the output color. JavaFX Blend Mode MULTIPLY Output
OVERLAY The input color components gets either screened or multiplied depending upon the bottom color. JavaFX Blend Mode OVERLAY Output
RED The red components of bottom input gets replaced with the red components of top input. JavaFX Blend Mode RED Output
SCREEN Both color components are inverted, multiplied and again inverted to produce the desired result. JavaFX Blend Mode SCREEN Output
SOFT_LIGHT The input color components become lighten or darken. JavaFX Blend Mode SOFT LIGHT Output
SRC_ATOP The part of the top input that is lying over the bottom input gets blended. JavaFX Blend Mode SRC ATOP Output
SRC_OVER Top input gets blended over bottom input. JavaFX Blend Mode SRC OVER Output





Contact US

Email:[email protected]

JavaFX Blend
10/30