Spec-Zone.ru › OpenJavaFX 21

Class Blend

java.lang.Object
javafx.scene.effect.Effect
javafx.scene.effect.Blend
public class Blend extends Effect
An effect that blends the two inputs together using one of the pre-defined BlendModes.

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:

The visual effect of blending color,
 gradient and text

Since:
JavaFX 2.0

Property Summary

Type Property Description
final ObjectProperty<Effect> bottomInput
The bottom input for this Blend operation.
final ObjectProperty<BlendMode> mode
The BlendMode used to blend the two inputs together.
final DoubleProperty opacity
The opacity value, which is modulated with the top input prior to blending.
final ObjectProperty<Effect> topInput
The top input for this Blend operation.

Constructor Summary

Constructor Description
Blend()
Creates a new instance of Blend with default parameters.
Blend(BlendMode mode)
Creates a new instance of Blend with the specified mode.
Blend(BlendMode mode, Effect bottomInput, Effect topInput)
Creates a new instance of Blend with the specified mode and bottom and top inputs.

Method Summary

Modifier and Type Method Description
final ObjectProperty<Effect> bottomInputProperty()
The bottom input for this Blend operation.
final Effect getBottomInput()
Gets the value of the bottomInput property.
final BlendMode getMode()
Gets the value of the mode property.
final double getOpacity()
Gets the value of the opacity property.
final Effect getTopInput()
Gets the value of the topInput property.
final ObjectProperty<BlendMode> modeProperty()
The BlendMode used to blend the two inputs together.
final DoubleProperty opacityProperty()
The opacity value, which is modulated with the top input prior to blending.
final void setBottomInput(Effect value)
Sets the value of the bottomInput property.
final void setMode(BlendMode value)
Sets the value of the mode property.
final void setOpacity(double value)
Sets the value of the opacity property.
final void setTopInput(Effect value)
Sets the value of the topInput property.
final ObjectProperty<Effect> topInputProperty()
The top input for this Blend operation.

Methods declared in class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Property Details

mode

public final ObjectProperty<BlendMode> modeProperty
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
See Also:
  • getMode()
  • setMode(BlendMode)
  • modeProperty()

opacity

public final DoubleProperty 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
See Also:
  • getOpacity()
  • setOpacity(double)
  • opacityProperty()

bottomInput

public final ObjectProperty<Effect> bottomInputProperty
The bottom input for this Blend operation. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
See Also:
  • getBottomInput()
  • setBottomInput(Effect)
  • bottomInputProperty()

topInput

public final ObjectProperty<Effect> topInputProperty
The top input for this Blend operation. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
See Also:
  • getTopInput()
  • setTopInput(Effect)
  • topInputProperty()

Constructor Details

Blend

public Blend()
Creates a new instance of Blend with default parameters.

Blend

public Blend(BlendMode mode)
Creates a new instance of Blend with the specified mode.
Parameters:
mode - the BlendMode used to blend the two inputs together
Since:
JavaFX 2.1

Blend

public Blend(BlendMode mode, Effect bottomInput, Effect topInput)
Creates a new instance of Blend with the specified mode and bottom and top inputs.
Parameters:
mode - the BlendMode used to blend the two inputs together
bottomInput - the bottom input for this Blend operation
topInput - the top input for this Blend operation
Since:
JavaFX 2.1

Method Details

setMode

public final void setMode(BlendMode value)
Sets the value of the mode 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 the mode property
See Also:
  • getMode()
  • modeProperty()

getMode

public final BlendMode getMode()
Gets the value of the mode 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:
  • setMode(BlendMode)
  • modeProperty()

modeProperty

public final ObjectProperty<BlendMode> modeProperty()
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 mode property
See Also:
  • getMode()
  • setMode(BlendMode)

setOpacity

public final void setOpacity(double value)
Sets the value of the opacity 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 the opacity property
See Also:
  • getOpacity()
  • opacityProperty()

getOpacity

public final double getOpacity()
Gets the value of the opacity 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:
  • setOpacity(double)
  • opacityProperty()

opacityProperty

public final DoubleProperty 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:
  • getOpacity()
  • setOpacity(double)

setBottomInput

public final void setBottomInput(Effect value)
Sets the value of the bottomInput property.
Property description:
The bottom input for this Blend operation. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
Parameters:
value - the value for the bottomInput property
See Also:
  • getBottomInput()
  • bottomInputProperty()

getBottomInput

public final Effect getBottomInput()
Gets the value of the bottomInput property.
Property description:
The bottom input for this Blend operation. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
Returns:
the value of the bottomInput property
See Also:
  • setBottomInput(Effect)
  • bottomInputProperty()

bottomInputProperty

public final ObjectProperty<Effect> bottomInputProperty()
The bottom input for this Blend operation. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
Returns:
the bottomInput property
See Also:
  • getBottomInput()
  • setBottomInput(Effect)

setTopInput

public final void setTopInput(Effect value)
Sets the value of the topInput property.
Property description:
The top input for this Blend operation. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
Parameters:
value - the value for the topInput property
See Also:
  • getTopInput()
  • topInputProperty()

getTopInput

public final Effect getTopInput()
Gets the value of the topInput property.
Property description:
The top input for this Blend operation. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
Returns:
the value of the topInput property
See Also:
  • setTopInput(Effect)
  • topInputProperty()

topInputProperty

public final ObjectProperty<Effect> topInputProperty()
The top input for this Blend operation. If set to null, or left unspecified, a graphical image of the Node to which the Effect is attached will be used as the input.
Default value:
null
Returns:
the topInput property
See Also:
  • getTopInput()
  • setTopInput(Effect)

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API