Top Description Fields Constructors Methods
javafx.scene.effect

public Class BoxBlur

extends Effect
Class Inheritance
Imports
javafx.beans.property.DoubleProperty, .DoublePropertyBase, .IntegerProperty, .IntegerPropertyBase, .ObjectProperty, javafx.scene.Node, com.sun.javafx.util.Utils, com.sun.javafx.effect.EffectDirtyBits, com.sun.javafx.geom.BaseBounds, com.sun.javafx.geom.transform.BaseTransform, com.sun.javafx.scene.BoundsAccessor

A blur effect using a simple box filter kernel, with separately configurable sizes in both dimensions, and an iteration parameter that controls the quality of the resulting blur.

Example:

BoxBlur boxBlur = new BoxBlur();
boxBlur.setWidth(10);
boxBlur.setHeight(3);
boxBlur.setIterations(3);

Text text = new Text();
text.setText("Blurry Text!");
text.setFill(Color.web("0x3b596d"));
text.setFont(Font.font(null, FontWeight.BOLD, 50));
text.setX(10);
text.setY(50);
text.setEffect(boxBlur);

The code above produces the following:

The visual effect of BoxBlur on text

Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private DoubleProperty
height

The vertical dimension of the blur effect.

private ObjectProperty<Effect>
input

The input for this Effect.

private IntegerProperty
iterations

The number of times to iterate the blur effect to improve its "quality" or "smoothness".

private DoubleProperty
width

The horizontal dimension of the blur effect.

Constructor Summary

AccessConstructor and Description
public
BoxBlur()

Creates a new instance of BoxBlur with default parameters.

public
BoxBlur(double
the horizontal dimension of the blur effect
width
,
double
the vertical dimension of the blur effect
height
,
int
the number of times to iterate the blur effect to improve its "quality" or "smoothness"
iterations
)

Creates a new instance of BoxBlur with specified width, height and iterations.

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
pack-priv Effect
copy()

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

pack-priv BoxBlur
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.

private int
private int
private int
public final double
public final Effect
public final int
public final double
public final DoubleProperty
public final ObjectProperty<Effect>
public final IntegerProperty
public final void
setHeight(double value)

public final void
public final void
setIterations(int value)

public final void
setWidth(double value)

pack-priv void
public final DoubleProperty
Inherited from javafx.scene.effect.Effect:
containsCycleseffectBoundsChangedgetInputBoundsgetKernelSizegetPeergetShadowBoundsmarkDirtysynctransformBounds

Field Detail

heightback to summary
private DoubleProperty height

The vertical dimension of the blur effect. The color information for a given pixel will be spread across a Box of the indicated height centered over the pixel. Values less than or equal to 1 will not spread the color data beyond the pixel where it originated from and so will have no effect.

      Min:   0.0
      Max: 255.0
  Default:   5.0
 Identity:  <1.0
Default Value
5.0
inputback to summary
private ObjectProperty<Effect> input

The input for this Effect. 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
iterationsback to summary
private IntegerProperty iterations

The number of times to iterate the blur effect to improve its "quality" or "smoothness". Iterating the effect 3 times approximates the quality of a Gaussian Blur to within 3%.

      Min:   0
      Max:   3
  Default:   1
 Identity:   0
Default Value
1
widthback to summary
private DoubleProperty width

The horizontal dimension of the blur effect. The color information for a given pixel will be spread across a Box of the indicated width centered over the pixel. Values less than or equal to 1 will not spread the color data beyond the pixel where it originated from and so will have no effect.

      Min:   0.0
      Max: 255.0
  Default:   5.0
 Identity:  <1.0
Default Value
5.0

Constructor Detail

BoxBlurback to summary
public BoxBlur()

Creates a new instance of BoxBlur with default parameters.

BoxBlurback to summary
public BoxBlur(double width, double height, int iterations)

Creates a new instance of BoxBlur with specified width, height and iterations.

Parameters
width:double

the horizontal dimension of the blur effect

height:double

the vertical dimension of the blur effect

iterations:int

the number of times to iterate the blur effect to improve its "quality" or "smoothness"

Method Detail

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 BoxBlur createPeer()

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

Annotations
@Override
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
getClampedHeightback to summary
private int getClampedHeight()
getClampedIterationsback to summary
private int getClampedIterations()
getClampedWidthback to summary
private int getClampedWidth()
getHeightback to summary
public final double getHeight()
getInputback to summary
public final Effect getInput()
getIterationsback to summary
public final int getIterations()
getWidthback to summary
public final double getWidth()
heightPropertyback to summary
public final DoubleProperty heightProperty()
inputPropertyback to summary
public final ObjectProperty<Effect> inputProperty()
iterationsPropertyback to summary
public final IntegerProperty iterationsProperty()
setHeightback to summary
public final void setHeight(double value)
setInputback to summary
public final void setInput(Effect value)
setIterationsback to summary
public final void setIterations(int value)
setWidthback to summary
public final void setWidth(double value)
updateback to summary
pack-priv void update()

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

Annotations
@Override
widthPropertyback to summary
public final DoubleProperty widthProperty()