BlendMode


public final enum BlendMode
extends Enum<BlendMode>

java.lang.Object
   ↳ java.lang.Enum<android.graphics.BlendMode>
     ↳ android.graphics.BlendMode


Summary

Enum values

BlendMode  CLEAR

Destination pixels covered by the source are cleared to 0. 

BlendMode  COLOR

Replaces hue and saturation of destination with hue and saturation of source, leaving luminosity unchanged. 

BlendMode  COLOR_BURN

Makes destination darker to reflect source. 

BlendMode  COLOR_DODGE

Makes destination brighter to reflect source. 

BlendMode  DARKEN

Retains the smallest component of the source and destination pixels. 

BlendMode  DIFFERENCE

Subtracts darker from lighter with higher contrast. 

BlendMode  DST

The source pixels are discarded, leaving the destination intact. 

BlendMode  DST_ATOP

Discards the destination pixels that are not covered by source pixels. 

BlendMode  DST_IN

Keeps the destination pixels that cover source pixels, discards the remaining source and destination pixels. 

BlendMode  DST_OUT

Keeps the destination pixels that are not covered by source pixels. 

BlendMode  DST_OVER

The source pixels are drawn behind the destination pixels. 

BlendMode  EXCLUSION

Subtracts darker from lighter with lower contrast. 

BlendMode  HARD_LIGHT

Makes destination lighter or darker, depending on source. 

BlendMode  HUE

Replaces hue of destination with hue of source, leaving saturation and luminosity unchanged. 

BlendMode  LIGHTEN

Retains the largest component of the source and destination pixel. 

BlendMode  LUMINOSITY

Replaces luminosity of destination with luminosity of source, leaving hue and saturation unchanged. 

BlendMode  MODULATE

Multiplies the source and destination pixels. 

BlendMode  MULTIPLY

Multiplies the source and destination pixels. 

BlendMode  OVERLAY

Multiplies or screens the source and destination depending on the destination color. 

BlendMode  PLUS

Adds the source pixels to the destination pixels and saturates the result. 

BlendMode  SATURATION

Replaces saturation of destination saturation hue of source, leaving hue and luminosity unchanged. 

BlendMode  SCREEN

Adds the source and destination pixels, then subtracts the source pixels multiplied by the destination. 

BlendMode  SOFT_LIGHT

Makes destination lighter or darker, depending on source. 

BlendMode  SRC

The source pixels replace the destination pixels. 

BlendMode  SRC_ATOP

Discards the source pixels that do not cover destination pixels. 

BlendMode  SRC_IN

Keeps the source pixels that cover the destination pixels, discards the remaining source and destination pixels. 

BlendMode  SRC_OUT

Keeps the source pixels that do not cover destination pixels. 

BlendMode  SRC_OVER

The source pixels are drawn over the destination pixels. 

BlendMode  XOR

Discards the source and destination pixels where source pixels cover destination pixels. 

Public methods

static BlendMode valueOf(String name)
static final BlendMode[] values()

Inherited methods

final Object clone()

Throws CloneNotSupportedException.

final int compareTo(BlendMode o)

Compares this enum with the specified object for order.

final boolean equals(Object other)

Returns true if the specified object is equal to this enum constant.

final void finalize()

enum classes cannot have finalize methods.

final Class<BlendMode> getDeclaringClass()

Returns the Class object corresponding to this enum constant's enum type.

final int hashCode()

Returns a hash code for this enum constant.

final String name()

Returns the name of this enum constant, exactly as declared in its enum declaration.

final int ordinal()

Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).

String toString()

Returns the name of this enum constant, as contained in the declaration.

static <T extends Enum<T>> T valueOf(Class<T> enumClass, String name)

Returns the enum constant of the specified enum class with the specified name.

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

abstract int compareTo(BlendMode o)

Compares this object with the specified object for order.

Enum values

CLEAR

Added in API level 29
public static final BlendMode CLEAR

Destination pixels covered by the source are cleared to 0.

αout=0

Cout=0

COLOR

Added in API level 29
public static final BlendMode COLOR

Replaces hue and saturation of destination with hue and saturation of source, leaving luminosity unchanged.

COLOR_BURN

Added in API level 29
public static final BlendMode COLOR_BURN

Makes destination darker to reflect source.

αout=αsrc+αdstαsrcαdst

Cout={Cdst+Csrc(1αdst)Cdst=αdstαdst(1αsrc)Csrc=0αsrc(αdstmin(αdst,(αdstCdst)αsrc/Csrc))+Csrc(1αdst)+αdst(1αsrc)otherwise

COLOR_DODGE

Added in API level 29
public static final BlendMode COLOR_DODGE

Makes destination brighter to reflect source.

αout=αsrc+αdstαsrcαdst

Cout={Csrc(1αdst)Cdst=0Csrc+αdst(1αsrc)Csrc=αsrcαsrcmin(αdst,Cdstαsrc/(αsrcCsrc))+Csrc(1αdst+αdst(1αsrc)otherwise

DARKEN

Added in API level 29
public static final BlendMode DARKEN

Retains the smallest component of the source and destination pixels.

αout=αsrc+αdstαsrcαdst

Cout=(1αdst)Csrc+(1αsrc)Cdst+min(Csrc,Cdst)

DIFFERENCE

Added in API level 29
public static final BlendMode DIFFERENCE

Subtracts darker from lighter with higher contrast.

αout=αsrc+αdstαsrcαdst

Cout=Csrc+Cdst2min(Csrcαdst,Cdstαsrc)

DST

Added in API level 29
public static final BlendMode DST

The source pixels are discarded, leaving the destination intact.

αout=αdst

Cout=Cdst

DST_ATOP

Added in API level 29
public static final BlendMode DST_ATOP

Discards the destination pixels that are not covered by source pixels. Draws remaining destination pixels over source pixels.

αout=αsrc

Cout=αsrcCdst+(1αdst)Csrc

DST_IN

Added in API level 29
public static final BlendMode DST_IN

Keeps the destination pixels that cover source pixels, discards the remaining source and destination pixels.

αout=αsrcαdst

Cout=Cdstαsrc

DST_OUT

Added in API level 29
public static final BlendMode DST_OUT

Keeps the destination pixels that are not covered by source pixels. Discards destination pixels that are covered by source pixels. Discards all source pixels.

αout=(1αsrc)αdst

Cout=(1αsrc)Cdst

DST_OVER

Added in API level 29
public static final BlendMode DST_OVER

The source pixels are drawn behind the destination pixels.

αout=αdst+(1αdst)αsrc

Cout=Cdst+(1αdst)Csrc

EXCLUSION

Added in API level 29
public static final BlendMode EXCLUSION

Subtracts darker from lighter with lower contrast.

αout=αsrc+αdstαsrcαdst

Cout=Csrc+Cdst2CsrcCdst

HARD_LIGHT

Added in API level 29
public static final BlendMode HARD_LIGHT

Makes destination lighter or darker, depending on source.

αout=αsrc+αdstαsrcαdst

Cout={2CsrcCdstCsrc(1αdst)+Cdst(1αsrc)+2Csrcαsrcαsrcαdst2(αdstCdst)(αsrcCsrc)otherwise

HUE

Added in API level 29
public static final BlendMode HUE

Replaces hue of destination with hue of source, leaving saturation and luminosity unchanged.

LIGHTEN

Added in API level 29
public static final BlendMode LIGHTEN

Retains the largest component of the source and destination pixel.

αout=αsrc+αdstαsrcαdst

Cout=(1αdst)Csrc+(1αsrc)Cdst+max(Csrc,Cdst)

LUMINOSITY

Added in API level 29
public static final BlendMode LUMINOSITY

Replaces luminosity of destination with luminosity of source, leaving hue and saturation unchanged.

MODULATE

Added in API level 29
public static final BlendMode MODULATE

Multiplies the source and destination pixels.

αout=αsrcαdst

Cout=CsrcCdst

MULTIPLY

Added in API level 29
public static final BlendMode MULTIPLY

Multiplies the source and destination pixels.

αout=αsrc+αdstαsrcαdst

Cout=Csrc(1αdst)+Cdst(1αsrc)+(CsrcCdst)

OVERLAY

Added in API level 29
public static final BlendMode OVERLAY

Multiplies or screens the source and destination depending on the destination color.

αout=αsrc+αdstαsrcαdst

Cout={2CsrcCdst2Cdst<αdstαsrcαdst2(αdstCsrc)(αsrcCdst)otherwise

PLUS

Added in API level 29
public static final BlendMode PLUS

Adds the source pixels to the destination pixels and saturates the result.

αout=max(0,min(αsrc+αdst,1))

Cout=max(0,min(Csrc+Cdst,1))

SATURATION

Added in API level 29
public static final BlendMode SATURATION

Replaces saturation of destination saturation hue of source, leaving hue and luminosity unchanged.

SCREEN

Added in API level 29
public static final BlendMode SCREEN

Adds the source and destination pixels, then subtracts the source pixels multiplied by the destination.

αout=αsrc+αdstαsrcαdst

Cout=Csrc+CdstCsrcCdst

SOFT_LIGHT

Added in API level 29
public static final BlendMode SOFT_LIGHT

Makes destination lighter or darker, depending on source.

Where m={Cdst/αdstαdst>00otherwise

g={(16mm+4m)(m1)+7m4Cdstαdstmmotherwise

f={Cdst(αsrc+(2Csrcαsrc)(1m))2CsrcαsrcCdstαsrc+αdst(2Csrcαsrc)gotherwise

αout=αsrc+αdstαsrcαdst

Cout=Csrc/αdst+Cdst/αsrc+f

SRC

Added in API level 29
public static final BlendMode SRC

The source pixels replace the destination pixels.

αout=αsrc

Cout=Csrc

SRC_ATOP

Added in API level 29
public static final BlendMode SRC_ATOP

Discards the source pixels that do not cover destination pixels. Draws remaining source pixels over destination pixels.

αout=αdst

Cout=αdstCsrc+(1αsrc)Cdst

SRC_IN

Added in API level 29
public static final BlendMode SRC_IN

Keeps the source pixels that cover the destination pixels, discards the remaining source and destination pixels.

αout=αsrcαdst

Cout=Csrcαdst

SRC_OUT

Added in API level 29
public static final BlendMode SRC_OUT

Keeps the source pixels that do not cover destination pixels. Discards source pixels that cover destination pixels. Discards all destination pixels.

αout=(1αdst)αsrc

Cout=(1αdst)Csrc

SRC_OVER

Added in API level 29
public static final BlendMode SRC_OVER

The source pixels are drawn over the destination pixels.

αout=αsrc+(1αsrc)αdst

Cout=Csrc+(1αsrc)Cdst

XOR

Added in API level 29
public static final BlendMode XOR

Discards the source and destination pixels where source pixels cover destination pixels. Draws remaining source pixels.

αout=(1αdst)αsrc+(1αsrc)αdst

Cout=(1αdst)Csrc+(1αsrc)Cdst

Public methods

valueOf

public static BlendMode valueOf (String name)

Parameters
name String

Returns
BlendMode

values

public static final BlendMode[] values ()

Returns
BlendMode[]