JavaFX ColorAdjust Effect

JavaFX allows us to adjust the color of an image by adjusting the properties like hue, saturation, brightness and contrast of the color of image. The class javafx.scene.effect.ColorAdjust contains various properties and methods that can be used to apply the ColorAdjust effect on the node.

Properties

The properties of the class javafx.scene.effect.ColorAdjust along with their setter methods are described below.

PropertyDescriptionSetter Methods
brightnessAdjustment made in brightness of the color. It is a double type property.setBrightness(double value)
contrastAdjustment made in contrast of the color. It is of double type property.setContrast(double value)
hueAdjustment made in hue of the color. It is of double type property.setHue(double value)
inputInput value for the effect. It is of double type property.setInput(double value)
saturationAdjustment made in saturation of the color. It is of double type property.setSaturation(double value)

Constructors

The class contains two constructors given below.

  1. public ColorAdjust() : creates the new instance of ColorAdjust with the default parameters.
  2. public ColorAdjust(double hue, double saturation, double brightness, double contrast) : Creates the new instance of the ColorAdjust with the specified parameters.

Example:

In the below example, the ColorAdjust Effect has been applied to the image with the certain properties. The comparison is being shown between the effected image and the original image as the output.


JavaFX ColorAdjust Effect



Latest Courses