Module javafx.graphics
Package javafx.scene.effect

# Enum Class BlendMode

java.lang.Object
java.lang.Enum<BlendMode>
javafx.scene.effect.BlendMode

All Implemented Interfaces:
  `Serializable`, `Comparable<BlendMode>`, `Constable`

public enum BlendMode extends Enum<BlendMode>
A blending mode defines the manner in which the inputs of a Blend effect are composited together or how a Node is blended into the background of a scene.

    import javafx.scene.*;
    import javafx.scene.effect.*;
    import javafx.scene.paint.*;
    import javafx.scene.shape.*;

    Rectangle r = new Rectangle();
    r.setX(50);
    r.setY(50);
    r.setWidth(50);
    r.setHeight(50);
    r.setFill(Color.BLUE);

    Circle c = new Circle();
    c.setFill(Color.rgb(255, 0, 0, 0.5));
    c.setCenterX(50);
    c.setCenterY(50);
    c.setRadius(25);
    c.setBlendMode(BlendMode.MULTIPLY);

    Group g = new Group();
    g.getChildren().add(r);
    g.getChildren().add(c);

Since:
  JavaFX 2.0

- ## Nested Class Summary

  ## Nested classes/interfaces declared in class java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `ADD`
  The color and alpha components from the top input are added to those from the bottom input.
  `BLUE`
  The blue component of the bottom input is replaced with the blue component of the top input; the other color components are unaffected.
  `COLOR_BURN`
  The inverse of the bottom input color components are divided by the top input color components, all of which is then inverted to produce the resulting color.
  `COLOR_DODGE`
  The bottom input color components are divided by the inverse of the top input color components to produce the resulting color.
  `DARKEN`
  The darker of the color components from the two inputs are selected to produce the resulting color.
  `DIFFERENCE`
  The darker of the color components from the two inputs are subtracted from the lighter ones to produce the resulting color.
  `EXCLUSION`
  The color components from the two inputs are multiplied and doubled, and then subtracted from the sum of the bottom input color components, to produce the resulting color.
  `GREEN`
  The green component of the bottom input is replaced with the green component of the top input; the other color components are unaffected.
  `HARD_LIGHT`
  The input color components are either multiplied or screened, depending on the top input color.
  `LIGHTEN`
  The lighter of the color components from the two inputs are selected to produce the resulting color.
  `MULTIPLY`
  The color components from the first input are multiplied with those from the second input.
  `OVERLAY`
  The input color components are either multiplied or screened, depending on the bottom input color.
  `RED`
  The red component of the bottom input is replaced with the red component of the top input; the other color components are unaffected.
  `SCREEN`
  The color components from both of the inputs are inverted, multiplied with each other, and that result is again inverted to produce the resulting color.
  `SOFT_LIGHT`
  The input color components are either darkened or lightened, depending on the top input color.
  `SRC_ATOP`
  The part of the top input lying inside of the bottom input is blended with the bottom input.
  `SRC_OVER`
  The top input is blended over the bottom input.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static BlendMode`
  `valueOf(String name)`
  Returns the enum constant of this class with the specified name.
  `static BlendMode[]`
  `values()`
  Returns an array containing the constants of this enum class, in the order they are declared.

  ### Methods declared in class java.lang.Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods declared in class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### SRC_OVER

    public static final BlendMode SRC_OVER
    The top input is blended over the bottom input. (Equivalent to the Porter-Duff "source over destination" rule.)

  - ### SRC_ATOP

    public static final BlendMode SRC_ATOP
    The part of the top input lying inside of the bottom input is blended with the bottom input. (Equivalent to the Porter-Duff "source atop destination" rule.)

  - ### ADD

    public static final BlendMode ADD
    The color and alpha components from the top input are added to those from the bottom input. The result is clamped to 1.0 if it exceeds the logical maximum of 1.0.

    Notes:

    - This mode is commutative (ordering of inputs does not matter).
    - This mode is sometimes referred to as "linear dodge" in imaging software packages.

  - ### MULTIPLY

    public static final BlendMode MULTIPLY
    The color components from the first input are multiplied with those from the second input. The alpha components are blended according to the `SRC_OVER` equation.

    Notes:

    - This mode is commutative (ordering of inputs does not matter).
    - This mode is the mathematical opposite of the `SCREEN` mode.
    - The resulting color is always at least as dark as either of the input colors.
    - Rendering with a completely black top input produces black; rendering with a completely white top input produces a result equivalent to the bottom input.

  - ### SCREEN

    public static final BlendMode SCREEN
    The color components from both of the inputs are inverted, multiplied with each other, and that result is again inverted to produce the resulting color. The alpha components are blended according to the `SRC_OVER` equation.

    Notes:

    - This mode is commutative (ordering of inputs does not matter).
    - This mode is the mathematical opposite of the `MULTIPLY` mode.
    - The resulting color is always at least as light as either of the input colors.
    - Rendering with a completely white top input produces white; rendering with a completely black top input produces a result equivalent to the bottom input.

  - ### OVERLAY

    public static final BlendMode OVERLAY
    The input color components are either multiplied or screened, depending on the bottom input color. The alpha components are blended according to the `SRC_OVER` equation.

    Notes:

    - This mode is a combination of `SCREEN` and `MULTIPLY`, depending on the bottom input color.
    - This mode is the mathematical opposite of the `HARD_LIGHT` mode.
    - In this mode, the top input colors "overlay" the bottom input while preserving highlights and shadows of the latter.

  - ### DARKEN

    public static final BlendMode DARKEN
    The darker of the color components from the two inputs are selected to produce the resulting color. The alpha components are blended according to the `SRC_OVER` equation.

    Notes:

    - This mode is commutative (ordering of inputs does not matter).
    - This mode is the mathematical opposite of the `LIGHTEN` mode.

  - ### LIGHTEN

    public static final BlendMode LIGHTEN
    The lighter of the color components from the two inputs are selected to produce the resulting color. The alpha components are blended according to the `SRC_OVER` equation.

    Notes:

    - This mode is commutative (ordering of inputs does not matter).
    - This mode is the mathematical opposite of the `DARKEN` mode.

  - ### COLOR_DODGE

    public static final BlendMode COLOR_DODGE
    The bottom input color components are divided by the inverse of the top input color components to produce the resulting color. The alpha components are blended according to the `SRC_OVER` equation.

  - ### COLOR_BURN

    public static final BlendMode COLOR_BURN
    The inverse of the bottom input color components are divided by the top input color components, all of which is then inverted to produce the resulting color. The alpha components are blended according to the `SRC_OVER` equation.

  - ### HARD_LIGHT

    public static final BlendMode HARD_LIGHT
    The input color components are either multiplied or screened, depending on the top input color. The alpha components are blended according to the `SRC_OVER` equation.

    Notes:

    - This mode is a combination of `SCREEN` and `MULTIPLY`, depending on the top input color.
    - This mode is the mathematical opposite of the `OVERLAY` mode.

  - ### SOFT_LIGHT

    public static final BlendMode SOFT_LIGHT
    The input color components are either darkened or lightened, depending on the top input color. The alpha components are blended according to the `SRC_OVER` equation.

    Notes:

    - This mode is similar to `OVERLAY`, but generally produces "lighter" results than `OVERLAY`.

  - ### DIFFERENCE

    public static final BlendMode DIFFERENCE
    The darker of the color components from the two inputs are subtracted from the lighter ones to produce the resulting color. The alpha components are blended according to the `SRC_OVER` equation.

    Notes:

    - This mode is commutative (ordering of inputs does not matter).
    - This mode can be used to invert parts of the bottom input image, or to quickly compare two images (equal pixels will result in black).
    - Rendering with a completely white top input inverts the bottom input; rendering with a completely black top input produces a result equivalent to the bottom input.

  - ### EXCLUSION

    public static final BlendMode EXCLUSION
    The color components from the two inputs are multiplied and doubled, and then subtracted from the sum of the bottom input color components, to produce the resulting color. The alpha components are blended according to the `SRC_OVER` equation.

    Notes:

    - This mode is commutative (ordering of inputs does not matter).
    - This mode can be used to invert parts of the bottom input.
    - This mode produces results that are similar to those of `DIFFERENCE`, except with lower contrast.
    - Rendering with a completely white top input inverts the bottom input; rendering with a completely black top input produces a result equivalent to the bottom input.

  - ### RED

    public static final BlendMode RED
    The red component of the bottom input is replaced with the red component of the top input; the other color components are unaffected. The alpha components are blended according to the `SRC_OVER` equation.

  - ### GREEN

    public static final BlendMode GREEN
    The green component of the bottom input is replaced with the green component of the top input; the other color components are unaffected. The alpha components are blended according to the `SRC_OVER` equation.

  - ### BLUE

    public static final BlendMode BLUE
    The blue component of the bottom input is replaced with the blue component of the top input; the other color components are unaffected. The alpha components are blended according to the `SRC_OVER` equation.

- ## Method Details

  - ### values

    public static BlendMode[] values()
    Returns an array containing the constants of this enum class, in the order they are declared.
    Returns:
      an array containing the constants of this enum class, in the order they are declared

  - ### valueOf

    public static BlendMode valueOf(String name)
    Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
    Parameters:
      `name` - the name of the enum constant to be returned.
    Returns:
      the enum constant with the specified name
    Throws:
      `IllegalArgumentException` - if this enum class has no constant with the specified name
      `NullPointerException` - if the argument is null