java.lang.Object
javafx.scene.effect.Effect
javafx.scene.effect.Blend
An effect that blends the two inputs together using one of the
pre-defined
BlendMode
s.
Example:
Blend blend = new Blend();
blend.setMode(BlendMode.COLOR_BURN);
ColorInput colorInput = new ColorInput();
colorInput.setPaint(Color.STEELBLUE);
colorInput.setX(10);
colorInput.setY(10);
colorInput.setWidth(100);
colorInput.setHeight(180);
blend.setTopInput(colorInput);
Rectangle rect = new Rectangle();
rect.setWidth(220);
rect.setHeight(100);
Stop[] stops = new Stop[]{new Stop(0, Color.LIGHTSTEELBLUE), new Stop(1, Color.PALEGREEN)};
LinearGradient lg = new LinearGradient(0, 0, 0.25, 0.25, true, CycleMethod.REFLECT, stops);
rect.setFill(lg);
Text text = new Text();
text.setX(15);
text.setY(65);
text.setFill(Color.PALEVIOLETRED);
text.setText("COLOR_BURN");
text.setFont(Font.font(null, FontWeight.BOLD, 30));
Group g = new Group();
g.setEffect(blend);
g.getChildren().addAll(rect, text);
The code above produces the following:
- Since:
- JavaFX 2.0
-
Property Summary
TypePropertyDescriptionfinal ObjectProperty
<Effect> The bottom input for thisBlend
operation.final ObjectProperty
<BlendMode> TheBlendMode
used to blend the two inputs together.final DoubleProperty
The opacity value, which is modulated with the top input prior to blending.final ObjectProperty
<Effect> The top input for thisBlend
operation. -
Constructor Summary
ConstructorDescriptionBlend()
Creates a new instance of Blend with default parameters.Creates a new instance of Blend with the specified mode.Creates a new instance of Blend with the specified mode and bottom and top inputs. -
Method Summary
Modifier and TypeMethodDescriptionfinal ObjectProperty
<Effect> The bottom input for thisBlend
operation.final Effect
Gets the value of thebottomInput
property.final BlendMode
getMode()
Gets the value of themode
property.final double
Gets the value of theopacity
property.final Effect
Gets the value of thetopInput
property.final ObjectProperty
<BlendMode> TheBlendMode
used to blend the two inputs together.final DoubleProperty
The opacity value, which is modulated with the top input prior to blending.final void
setBottomInput
(Effect value) Sets the value of thebottomInput
property.final void
Sets the value of themode
property.final void
setOpacity
(double value) Sets the value of theopacity
property.final void
setTopInput
(Effect value) Sets the value of thetopInput
property.final ObjectProperty
<Effect> The top input for thisBlend
operation.
-
Property Details
-
mode
TheBlendMode
used to blend the two inputs together.Min: n/a Max: n/a Default: BlendMode.SRC_OVER Identity: n/a
- Default value:
- SRC_OVER
- See Also:
-
opacity
The opacity value, which is modulated with the top input prior to blending.Min: 0.0 Max: 1.0 Default: 1.0 Identity: 1.0
- Default value:
- 1.0
- See Also:
-
bottomInput
The bottom input for thisBlend
operation. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input.- Default value:
- null
- See Also:
-
topInput
The top input for thisBlend
operation. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input.- Default value:
- null
- See Also:
-
-
Constructor Details
-
Blend
public Blend()Creates a new instance of Blend with default parameters. -
Blend
Creates a new instance of Blend with the specified mode.- Parameters:
mode
- theBlendMode
used to blend the two inputs together- Since:
- JavaFX 2.1
-
Blend
Creates a new instance of Blend with the specified mode and bottom and top inputs.- Parameters:
mode
- theBlendMode
used to blend the two inputs togetherbottomInput
- the bottom input for thisBlend
operationtopInput
- the top input for thisBlend
operation- Since:
- JavaFX 2.1
-
-
Method Details
-
setMode
Sets the value of themode
property.- Property description:
- The
BlendMode
used to blend the two inputs together.Min: n/a Max: n/a Default: BlendMode.SRC_OVER Identity: n/a
- Default value:
- SRC_OVER
- Parameters:
value
- the value for themode
property- See Also:
-
getMode
Gets the value of themode
property.- Property description:
- The
BlendMode
used to blend the two inputs together.Min: n/a Max: n/a Default: BlendMode.SRC_OVER Identity: n/a
- Default value:
- SRC_OVER
- Returns:
- the value of the
mode
property - See Also:
-
modeProperty
TheBlendMode
used to blend the two inputs together.Min: n/a Max: n/a Default: BlendMode.SRC_OVER Identity: n/a
- Default value:
- SRC_OVER
- Returns:
- the
mode
property - See Also:
-
setOpacity
public final void setOpacity(double value) Sets the value of theopacity
property.- Property description:
- The opacity value, which is modulated with the top input prior
to blending.
Min: 0.0 Max: 1.0 Default: 1.0 Identity: 1.0
- Default value:
- 1.0
- Parameters:
value
- the value for theopacity
property- See Also:
-
getOpacity
public final double getOpacity()Gets the value of theopacity
property.- Property description:
- The opacity value, which is modulated with the top input prior
to blending.
Min: 0.0 Max: 1.0 Default: 1.0 Identity: 1.0
- Default value:
- 1.0
- Returns:
- the value of the
opacity
property - See Also:
-
opacityProperty
The opacity value, which is modulated with the top input prior to blending.Min: 0.0 Max: 1.0 Default: 1.0 Identity: 1.0
- Default value:
- 1.0
- Returns:
- the
opacity
property - See Also:
-
setBottomInput
Sets the value of thebottomInput
property.- Property description:
- The bottom input for this
Blend
operation. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input. - Default value:
- null
- Parameters:
value
- the value for thebottomInput
property- See Also:
-
getBottomInput
Gets the value of thebottomInput
property.- Property description:
- The bottom input for this
Blend
operation. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input. - Default value:
- null
- Returns:
- the value of the
bottomInput
property - See Also:
-
bottomInputProperty
The bottom input for thisBlend
operation. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input.- Default value:
- null
- Returns:
- the
bottomInput
property - See Also:
-
setTopInput
Sets the value of thetopInput
property.- Property description:
- The top input for this
Blend
operation. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input. - Default value:
- null
- Parameters:
value
- the value for thetopInput
property- See Also:
-
getTopInput
Gets the value of thetopInput
property.- Property description:
- The top input for this
Blend
operation. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input. - Default value:
- null
- Returns:
- the value of the
topInput
property - See Also:
-
topInputProperty
The top input for thisBlend
operation. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input.- Default value:
- null
- Returns:
- the
topInput
property - See Also:
-