Top Description Fields Constructors Methods
javafx.scene.effect

public Class Blend

extends Effect
Class Inheritance
Imports
javafx.beans.property.DoubleProperty, .DoublePropertyBase, .ObjectProperty, .ObjectPropertyBase, javafx.scene.Node, com.sun.javafx.util.Utils, com.sun.javafx.effect.EffectDirtyBits, com.sun.javafx.geom.BaseBounds, .RectBounds, com.sun.javafx.geom.transform.BaseTransform, com.sun.javafx.scene.BoundsAccessor, com.sun.scenario.effect.Blend.Mode

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

Field Summary

Modifier and TypeField and Description
private ObjectProperty<Effect>
bottomInput

The bottom input for this Blend operation.

private ObjectProperty<BlendMode>
mode

The BlendMode used to blend the two inputs together.

private DoubleProperty
opacity

The opacity value, which is modulated with the top input prior to blending.

private ObjectProperty<Effect>
topInput

The top input for this Blend operation.

Constructor Summary

AccessConstructor and Description
public
Blend()

Creates a new instance of Blend with default parameters.

public
Blend(BlendMode
the BlendMode used to blend the two inputs together
mode
)

Creates a new instance of Blend with the specified mode.

public
Blend(BlendMode
the BlendMode used to blend the two inputs together
mode
,
Effect
the bottom input for this Blend operation
bottomInput
,
Effect
the top input for this Blend operation
topInput
)

Creates a new instance of Blend with the specified mode and bottom and top inputs.

Method Summary

Modifier and TypeMethod and Description
public final ObjectProperty<Effect>
pack-priv boolean
pack-priv Effect
copy()

Implements abstract javafx.scene.effect.Effect.copy.

pack-priv Blend
public final Effect
pack-priv BaseBounds
getBounds(BaseBounds bounds, BaseTransform tx, Node node, BoundsAccessor boundsAccessor)

Implements abstract javafx.scene.effect.Effect.getBounds.

Returns bounds of given node with applied effect.

public final BlendMode
public final double
pack-priv static Blend.Mode
getToolkitMode(BlendMode mode)

Used by Group to convert the FX BlendMode enum value into a Decora value.

public final Effect
public final ObjectProperty<BlendMode>
public final DoubleProperty
public final void
public final void
public final void
setOpacity(double value)

public final void
private static Blend.Mode
public final ObjectProperty<Effect>
pack-priv void
Inherited from javafx.scene.effect.Effect:
containsCycleseffectBoundsChangedgetInputBoundsgetKernelSizegetPeergetShadowBoundsmarkDirtysynctransformBounds

Field Detail

bottomInputback to summary
private ObjectProperty<Effect> bottomInput

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
modeback to summary
private ObjectProperty<BlendMode> mode

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
opacityback to summary
private DoubleProperty 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
topInputback to summary
private ObjectProperty<Effect> topInput

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

Constructor Detail

Blendback to summary
public Blend()

Creates a new instance of Blend with default parameters.

Blendback to summary
public Blend(BlendMode mode)

Creates a new instance of Blend with the specified mode.

Parameters
mode:BlendMode

the BlendMode used to blend the two inputs together

Since
JavaFX 2.1
Blendback to summary
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:BlendMode

the BlendMode used to blend the two inputs together

bottomInput:Effect

the bottom input for this Blend operation

topInput:Effect

the top input for this Blend operation

Since
JavaFX 2.1

Method Detail

bottomInputPropertyback to summary
public final ObjectProperty<Effect> bottomInputProperty()
checkChainContainsback to summary
pack-priv boolean checkChainContains(Effect e)

Implements abstract javafx.scene.effect.Effect.checkChainContains.

Annotations
@Override
copyback to summary
pack-priv Effect copy()

Implements abstract javafx.scene.effect.Effect.copy.

Annotations
@Override
createPeerback to summary
pack-priv Blend createPeer()

Implements abstract javafx.scene.effect.Effect.createPeer.

Annotations
@Override
getBottomInputback to summary
public final Effect getBottomInput()
getBoundsback to summary
pack-priv BaseBounds getBounds(BaseBounds bounds, BaseTransform tx, Node node, BoundsAccessor boundsAccessor)

Implements abstract javafx.scene.effect.Effect.getBounds.

Doc from javafx.scene.effect.Effect.getBounds.

Returns bounds of given node with applied effect. We *never* pass null in as a bounds. This method will NOT take a null bounds object. The returned value may be the same bounds object passed in, or it may be a new object.

Annotations
@Override
getModeback to summary
public final BlendMode getMode()
getOpacityback to summary
public final double getOpacity()
getToolkitModeback to summary
pack-priv static Blend.Mode getToolkitMode(BlendMode mode)

Used by Group to convert the FX BlendMode enum value into a Decora value.

getTopInputback to summary
public final Effect getTopInput()
modePropertyback to summary
public final ObjectProperty<BlendMode> modeProperty()
opacityPropertyback to summary
public final DoubleProperty opacityProperty()
setBottomInputback to summary
public final void setBottomInput(Effect value)
setModeback to summary
public final void setMode(BlendMode value)
setOpacityback to summary
public final void setOpacity(double value)
setTopInputback to summary
public final void setTopInput(Effect value)
toPGModeback to summary
private static Blend.Mode toPGMode(BlendMode mode)
topInputPropertyback to summary
public final ObjectProperty<Effect> topInputProperty()
updateback to summary
pack-priv void update()

Implements abstract javafx.scene.effect.Effect.update.

Annotations
@Override