JavaFX Effects Blend - JavaFX

What is JavaFX Effects Blend?

In preferred, blend method aggregate of or greater different things or materials. If we apply the blend impact, it will take the pixels of two unique inputs. this may be finished at the equal place and it produces a combined output based at the blend mode.

For example, if we draw items the top object covers the bottom one. On applying the blend impact, the pixels of the two items in the overlap area are mixed and displayed based at the enter mode.

JavaFX Effects - Blend


The class Named Blendof the package javafx.scene.effect represents the blend impact, this class includes four properties, which are −

  • Bottom Input − This assets is of the sort impact and it represents the lowest enter to the blend impact.
  • Top Input − This assets is of the kind effect and it represents the top input to the blend impact.
  • Opacity − This assets is of double type and it represents the opacity value modulated with the top enter.
  • Mode − This assets is of the kind BlendMode and it represents the mode used to blend the two inputs together.

Example

Following is an example demonstrating the blend impact. In here, we are drawing a circle filled with BROWN color, on top of it lies a BLUEVIOLET ColorInput.

We have carried out the blend impact selecting a multiply mode inside the overlap location, the colors of the two objects were improved and displayed.

Save this code in a file with the call BlendEffectExample.java.

Collect and execute the saved java file from the command prompt using the following commands.

On executing, the above program generates a JavaFX window as shown below.

JavaFX Effects - Blend


Blend Modes

S.NO Mode & Description Output
1

ADD

In this mode, the color values of the top and bottom inputs are added and displayed.

Add Mode
2

MULTIPLY

In this mode, the color values of the top and bottom inputs are multiplied and displayed.

MULTIPLY Mode
3

DIFFERENCE

In this mode, among the color values of the top and bottom inputs, the darker one is subtracted from the lighter one and displayed.

DIFFERENCE Mode
4

RED

In this mode, the red components of the bottom input were replaced by the red components of the top input.

RED Mode
5

BLUE

In this mode, the blue components of the bottom input were replaced by the blue components of the top input.

BLUE Mode
6

GREEN

In this mode, the green components of the bottom input were replaced by the green components of the top input.

GREEN MODE
7

EXCLUSION

In this mode, the color components of the two inputs were multiplied and doubled. Then they are subtracted from the sum of the color components of the bottom input. The resultant is then displayed.

EXCLUSION Mode
8

COLOR_BURN

In this mode, the inverse of the bottom input color component was divided by the top input color component. Thus, the obtained value is inverted and displayed.

COLOR BURN
9

COLOR_DODGE

In this mode, the bottom input color components were divided by the inverse of the top input color components and thus obtained value is inverted and displayed.

COLOR DODGE
10

LIGHTEN

In this mode, the lighter color component, among the both inputs are displayed.

Lighten
11

DARKEN

In this mode, the darker color component, among the top and bottom inputs is displayed.

Darken
12

SCREEN

In this mode, the color components of the top and bottom inputs were inverted, multiplied and thus obtained value is inverted and displayed.

Screen
13

OVERLAY

In this mode, based on the bottom input color, the color components of the two input values were multiplied or screened and the resultant is displayed.

Overlay
14

HARD_LIGHT

In this mode, based on the top input color, the color components of the two input values were multiplied or screened and the resultant is displayed.

Hard Light
15

SOFT_LIGH

In this mode, based on the top input color, the color components of the two input values were softened or lightened and the resultant is displayed.

Soft Light
16

SRC_ATOP

In this mode, the over lapping area is filled with the color component of the bottom input. While the nonoverlapping area is filled with the color component of the top input.

SRC ATOP
17

SRC_OVER

In this mode, the top input is drawn over the bottom input.

SRC OVER

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JavaFX Topics