APIdia Launch Partner
Top Description Fields Constructors Methods
javafx.scene.effect

public Class ColorAdjust

extends Effect
Class Inheritance
Imports
javafx.beans.property.DoubleProperty, .DoublePropertyBase, .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

An effect that allows for per-pixel adjustments of hue, saturation, brightness, and contrast.

Example:

ColorAdjust colorAdjust = new ColorAdjust();
colorAdjust.setContrast(0.1);
colorAdjust.setHue(-0.05);
colorAdjust.setBrightness(0.1);
colorAdjust.setSaturation(0.2);

Image image = new Image("boat.jpg");
ImageView imageView = new ImageView(image);
imageView.setFitWidth(200);
imageView.setPreserveRatio(true);
imageView.setEffect(colorAdjust);

The code above applied on this image:

A photo

produces the following:

The visual effect of ColorAdjust on
photo

Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private DoubleProperty
brightness

The brightness adjustment value.

private DoubleProperty
contrast

The contrast adjustment value.

private DoubleProperty
hue

The hue adjustment value.

private ObjectProperty<Effect>
input

The input for this Effect.

private DoubleProperty
saturation

The saturation adjustment value.

Constructor Summary

AccessConstructor and Description
public
ColorAdjust()

Creates a new instance of ColorAdjust with default parameters.

public
ColorAdjust(double
the hue adjustment value
hue
,
double
the saturation adjustment value
saturation
,
double
the brightness adjustment value
brightness
,
double
the contrast adjustment value
contrast
)

Creates a new instance of ColorAdjust with the specified hue, saturation, brightness, and contrast.

Method Summary

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

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

pack-priv ColorAdjust
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 double
public final double
public final double
public final Effect
public final double
public final DoubleProperty
public final ObjectProperty<Effect>
public final DoubleProperty
public final void
setBrightness(double value)

public final void
setContrast(double value)

public final void
setHue(double value)

public final void
public final void
setSaturation(double value)

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

Field Detail

brightnessback to summary
private DoubleProperty brightness

The brightness adjustment value.

      Min: -1.0
      Max: +1.0
  Default:  0.0
 Identity:  0.0
Default Value
0.0
contrastback to summary
private DoubleProperty contrast

The contrast adjustment value.

      Min: -1.0
      Max: +1.0
  Default:  0.0
 Identity:  0.0
Default Value
0.0
hueback to summary
private DoubleProperty hue

The hue adjustment value.

      Min: -1.0
      Max: +1.0
  Default:  0.0
 Identity:  0.0
Default Value
0.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
saturationback to summary
private DoubleProperty saturation

The saturation adjustment value.

      Min: -1.0
      Max: +1.0
  Default:  0.0
 Identity:  0.0
Default Value
0.0

Constructor Detail

ColorAdjustback to summary
public ColorAdjust()

Creates a new instance of ColorAdjust with default parameters.

ColorAdjustback to summary
public ColorAdjust(double hue, double saturation, double brightness, double contrast)

Creates a new instance of ColorAdjust with the specified hue, saturation, brightness, and contrast.

Parameters
hue:double

the hue adjustment value

saturation:double

the saturation adjustment value

brightness:double

the brightness adjustment value

contrast:double

the contrast adjustment value

Since
JavaFX 2.1

Method Detail

brightnessPropertyback to summary
public final DoubleProperty brightnessProperty()
checkChainContainsback to summary
pack-priv boolean checkChainContains(Effect e)

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

Annotations
@Override
contrastPropertyback to summary
public final DoubleProperty contrastProperty()
copyback to summary
pack-priv Effect copy()

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

Annotations
@Override
createPeerback to summary
pack-priv ColorAdjust 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
getBrightnessback to summary
public final double getBrightness()
getContrastback to summary
public final double getContrast()
getHueback to summary
public final double getHue()
getInputback to summary
public final Effect getInput()
getSaturationback to summary
public final double getSaturation()
huePropertyback to summary
public final DoubleProperty hueProperty()
inputPropertyback to summary
public final ObjectProperty<Effect> inputProperty()
saturationPropertyback to summary
public final DoubleProperty saturationProperty()
setBrightnessback to summary
public final void setBrightness(double value)
setContrastback to summary
public final void setContrast(double value)
setHueback to summary
public final void setHue(double value)
setInputback to summary
public final void setInput(Effect value)
setSaturationback to summary
public final void setSaturation(double value)
updateback to summary
pack-priv void update()

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

Annotations
@Override