com.sun.scenario.effect
Enum Blend.Mode

java.lang.Object
  extended by java.lang.Enum<Blend.Mode>
      extended by com.sun.scenario.effect.Blend.Mode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Blend.Mode>
Enclosing class:
Blend

public static enum Blend.Mode
extends java.lang.Enum<Blend.Mode>

A blending mode that defines the manner in which the inputs are composited together. Each Mode describes a mathematical equation that combines premultiplied inputs to produce some premultiplied result.


Enum Constant Summary
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
          REMIND: cross check this formula with OpenVG spec...
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
          REMIND: cross check this formula with OpenVG spec...
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
          REMIND: this is a complicated formula, TBD...
SRC_ATOP
          The part of the top input lying inside of the bottom input is blended with the bottom input.
SRC_IN
          The part of the top input lying inside of the bottom input is kept in the resulting image.
SRC_OUT
          The part of the top input lying outside of the bottom input is kept in the resulting image.
SRC_OVER
          The top input is blended over the bottom input.
 
Method Summary
static Blend.Mode valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Blend.Mode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

SRC_OVER

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

Thus:

      Ar = Atop + Abot*(1-Atop)
      Cr = Ctop + Cbot*(1-Atop)
 


SRC_IN

public static final Blend.Mode SRC_IN
The part of the top input lying inside of the bottom input is kept in the resulting image. (Equivalent to the Porter-Duff "source in destination" rule.)

Thus:

        Ar = Atop*Abot
        Cr = Ctop*Abot
 


SRC_OUT

public static final Blend.Mode SRC_OUT
The part of the top input lying outside of the bottom input is kept in the resulting image. (Equivalent to the Porter-Duff "source held out by destination" rule.)

Thus:

      Ar = Atop*(1-Abot)
      Cr = Ctop*(1-Abot)
 


SRC_ATOP

public static final Blend.Mode 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.)

Thus:

      Ar = Atop*Abot + Abot*(1-Atop) = Abot
      Cr = Ctop*Abot + Cbot*(1-Atop)
 


ADD

public static final Blend.Mode 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.

Thus:

        Ar = min(1, Atop+Abot)
        Cr = min(1, Ctop+Cbot)
 

Notes:


MULTIPLY

public static final Blend.Mode 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
        Cr = Ctop * Cbot
 

Notes:


SCREEN

public static final Blend.Mode 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
        Cr = 1 - ((1-Ctop) * (1-Cbot))
 

Notes:


OVERLAY

public static final Blend.Mode 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
      REMIND: not sure how to express this succinctly yet...
 

Notes:


DARKEN

public static final Blend.Mode DARKEN
REMIND: cross check this formula with OpenVG spec... 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
        Cr = min(Ctop, Cbot)
 

Notes:


LIGHTEN

public static final Blend.Mode LIGHTEN
REMIND: cross check this formula with OpenVG spec... 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
        Cr = max(Ctop, Cbot)
 

Notes:


COLOR_DODGE

public static final Blend.Mode 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
        Cr = Cbot / (1-Ctop)
 


COLOR_BURN

public static final Blend.Mode 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
        Cr = 1-((1-Cbot) / Ctop)
 


HARD_LIGHT

public static final Blend.Mode 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
      REMIND: not sure how to express this succinctly yet...
 

Notes:


SOFT_LIGHT

public static final Blend.Mode SOFT_LIGHT
REMIND: this is a complicated formula, TBD...


DIFFERENCE

public static final Blend.Mode 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
        Cr = abs(Ctop-Cbot)
 

Notes:


EXCLUSION

public static final Blend.Mode 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
        Cr = Ctop + Cbot - (2*Ctop*Cbot)
 

Notes:


RED

public static final Blend.Mode 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
        Rr = Rtop
        Gr = Gbot
        Br = Bbot
 


GREEN

public static final Blend.Mode 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
        Rr = Rbot
        Gr = Gtop
        Br = Bbot
 


BLUE

public static final Blend.Mode 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.

Thus:

        Ar = Atop + Abot*(1-Atop)
        Rr = Rbot
        Gr = Gbot
        Br = Btop
 

Method Detail

values

public static Blend.Mode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Blend.Mode c : Blend.Mode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Blend.Mode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null