Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Enums](https://developer.android.com/reference/android/graphics/PorterDuff.Mode#enumconstants) \| [Methods](https://developer.android.com/reference/android/graphics/PorterDuff.Mode#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/graphics/PorterDuff.Mode#inhmethods)

# PorterDuff.Mode

*** ** * ** ***

` public static final enum PorterDuff.Mode `   
` ` ` extends https://developer.android.com/reference/java/lang/Enum<https://developer.android.com/reference/android/graphics/PorterDuff.Mode> ` ` `

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [java.lang.Enum](https://developer.android.com/reference/java/lang/Enum)\<[android.graphics.PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode)\> ||
|   | ↳ | android.graphics.PorterDuff.Mode |

<br />

*** ** * ** ***


The name of the parent class is an homage to the work of Thomas Porter and Tom Duff, presented in their seminal 1984 paper titled "Compositing Digital Images". In this paper, the authors describe 12 compositing operators that govern how to compute the color resulting of the composition of a source (the graphics object to render) with a destination (the content of the render target).

"Compositing Digital Images" was published in *Computer Graphics* Volume 18, Number 3 dated July 1984.

Because the work of Porter and Duff focuses solely on the effects of the alpha channel of the source and destination, the 12 operators described in the original paper are called alpha compositing modes here.

For convenience, this class also provides several blending modes, which similarly define the result of compositing a source and a destination but without being constrained to the alpha channel. These blending modes are not defined by Porter and Duff but have been included in this class for convenience purposes.

### Diagrams

All the example diagrams presented below use the same source and destination images:

|---|---|
| ![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC.png) Source image | ![](https://developer.android.com/static/reference/android/images/graphics/composite_DST.png) Destination image |

The order of drawing operations used to generate each diagram is shown in the following code snippet:

```
Paint paint = new Paint();
canvas.drawBitmap(destinationImage, 0, 0, paint);

PorterDuff.Mode mode = // choose a mode
paint.setXfermode(new PorterDuffXfermode(mode));

canvas.drawBitmap(sourceImage, 0, 0, paint);
```

### Alpha compositing modes

|---|---|---|---|
| ![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#SRC` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_OVER.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#SRC_OVER` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_IN.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#SRC_IN` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_ATOP.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#SRC_ATOP` |
| ![](https://developer.android.com/static/reference/android/images/graphics/composite_DST.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#DST` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_OVER.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#DST_OVER` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_IN.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#DST_IN` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_ATOP.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#DST_ATOP` |
| ![](https://developer.android.com/static/reference/android/images/graphics/composite_CLEAR.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#CLEAR` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_OUT.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#SRC_OUT` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_OUT.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#DST_OUT` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_XOR.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#XOR` |

### Blending modes

|---|---|---|
| ![](https://developer.android.com/static/reference/android/images/graphics/composite_DARKEN.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#DARKEN` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_LIGHTEN.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#LIGHTEN` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_MULTIPLY.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#MULTIPLY` |
| ![](https://developer.android.com/static/reference/android/images/graphics/composite_SCREEN.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#SCREEN` | ![](https://developer.android.com/static/reference/android/images/graphics/composite_OVERLAY.png) `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#OVERLAY` |

### Compositing equations

The documentation of each individual alpha compositing or blending mode below provides the exact equation used to compute alpha and color value of the result of the composition of a source and destination.

The result (or output) alpha value is noted \\(\\alpha_{out}\\). The result (or output) color value is noted \\(C_{out}\\).

<br />

## Summary

| ### Enum values ||
|---|---|
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `ADD` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_ADD.png) Adds the source pixels to the destination pixels and saturates the result. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `CLEAR` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_CLEAR.png) Destination pixels covered by the source are cleared to 0. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `DARKEN` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_DARKEN.png) Retains the smallest component of the source and destination pixels. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `DST` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_DST.png) The source pixels are discarded, leaving the destination intact. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `DST_ATOP` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_ATOP.png) Discards the destination pixels that are not covered by source pixels. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `DST_IN` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_IN.png) Keeps the destination pixels that cover source pixels, discards the remaining source and destination pixels. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `DST_OUT` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_OUT.png) Keeps the destination pixels that are not covered by source pixels. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `DST_OVER` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_OVER.png) The source pixels are drawn behind the destination pixels. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `LIGHTEN` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_LIGHTEN.png) Retains the largest component of the source and destination pixel. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `MULTIPLY` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_MULTIPLY.png) Multiplies the source and destination pixels. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `OVERLAY` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_OVERLAY.png) Multiplies or screens the source and destination depending on the destination color. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `SCREEN` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_SCREEN.png) Adds the source and destination pixels, then subtracts the source pixels multiplied by the destination. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `SRC` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC.png) The source pixels replace the destination pixels. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `SRC_ATOP` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_ATOP.png) Discards the source pixels that do not cover destination pixels. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `SRC_IN` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_IN.png) Keeps the source pixels that cover the destination pixels, discards the remaining source and destination pixels. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `SRC_OUT` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_OUT.png) Keeps the source pixels that do not cover destination pixels. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `SRC_OVER` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_OVER.png) The source pixels are drawn over the destination pixels. <br /> |
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | `XOR` <br /> ![](https://developer.android.com/static/reference/android/images/graphics/composite_XOR.png) Discards the source and destination pixels where source pixels cover destination pixels. <br /> |

| ### Public methods ||
|---|---|
| ` static https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | ` https://developer.android.com/reference/android/graphics/PorterDuff.Mode#valueOf(java.lang.String)(https://developer.android.com/reference/java/lang/String name) ` |
| ` static final https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | ` https://developer.android.com/reference/android/graphics/PorterDuff.Mode#values()() ` |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Enum ` ` final https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Enum#clone()() `

Throws CloneNotSupportedException.
` final int` ` https://developer.android.com/reference/java/lang/Enum#compareTo(E)(https://developer.android.com/reference/android/graphics/PorterDuff.Mode o) `

Compares this enum with the specified object for order.
` final boolean` ` https://developer.android.com/reference/java/lang/Enum#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object other) `

Returns true if the specified object is equal to this enum constant.
` final void` ` https://developer.android.com/reference/java/lang/Enum#finalize()() `

enum classes cannot have finalize methods.
` final https://developer.android.com/reference/java/lang/Class<https://developer.android.com/reference/android/graphics/PorterDuff.Mode>` ` https://developer.android.com/reference/java/lang/Enum#getDeclaringClass()() `

Returns the Class object corresponding to this enum constant's enum type.
` final int` ` https://developer.android.com/reference/java/lang/Enum#hashCode()() `

Returns a hash code for this enum constant.
` final https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Enum#name()() `

Returns the name of this enum constant, exactly as declared in its enum declaration.
` final int` ` https://developer.android.com/reference/java/lang/Enum#ordinal()() `

Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Enum#toString()() `

Returns the name of this enum constant, as contained in the declaration.
` static <T extends https://developer.android.com/reference/java/lang/Enum<T>> T` ` https://developer.android.com/reference/java/lang/Enum#valueOf(java.lang.Class<T>,%20java.lang.String)(https://developer.android.com/reference/java/lang/Class<T> enumClass, https://developer.android.com/reference/java/lang/String name) `

Returns the enum constant of the specified enum class with the specified name.
From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(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` ` https://developer.android.com/reference/java/lang/Object#wait(long)(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` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/java/lang/Comparable ` ` abstract int` ` https://developer.android.com/reference/java/lang/Comparable#compareTo(T)(https://developer.android.com/reference/android/graphics/PorterDuff.Mode o) `

Compares this object with the specified object for order.

## Enum values

### ADD

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode ADD
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_ADD.png)
Adds the source pixels to the destination pixels and saturates the result.

<br />

\\(\\alpha_{out} = max(0, min(\\alpha_{src} + \\alpha_{dst}, 1))\\)

\\(C_{out} = max(0, min(C_{src} + C_{dst}, 1))\\)

<br />

<br />

### CLEAR

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode CLEAR
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_CLEAR.png)
Destination pixels covered by the source are cleared to 0.

<br />

\\(\\alpha_{out} = 0\\)

\\(C_{out} = 0\\)

<br />

<br />

### DARKEN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode DARKEN
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_DARKEN.png)
Retains the smallest component of the source and destination pixels.

<br />

\\(\\alpha_{out} = \\alpha_{src} + \\alpha_{dst} - \\alpha_{src} \* \\alpha_{dst}\\)

\\(C_{out} = (1 - \\alpha_{dst}) \* C_{src} + (1 - \\alpha_{src}) \* C_{dst} + min(C_{src}, C_{dst})\\)

<br />

<br />

### DST

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode DST
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_DST.png)
The source pixels are discarded, leaving the destination intact.

<br />

\\(\\alpha_{out} = \\alpha_{dst}\\)

\\(C_{out} = C_{dst}\\)

<br />

<br />

### DST_ATOP

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode DST_ATOP
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_ATOP.png)
Discards the destination pixels that are not covered by source pixels. Draws remaining destination pixels over source pixels.

<br />

\\(\\alpha_{out} = \\alpha_{src}\\)

\\(C_{out} = \\alpha_{src} \* C_{dst} + (1 - \\alpha_{dst}) \* C_{src}\\)

<br />

<br />

### DST_IN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode DST_IN
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_IN.png)
Keeps the destination pixels that cover source pixels, discards the remaining source and destination pixels.

<br />

\\(\\alpha_{out} = \\alpha_{src} \* \\alpha_{dst}\\)

\\(C_{out} = C_{dst} \* \\alpha_{src}\\)

<br />

<br />

### DST_OUT

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode DST_OUT
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_OUT.png)
Keeps the destination pixels that are not covered by source pixels. Discards destination pixels that are covered by source pixels. Discards all source pixels.

<br />

\\(\\alpha_{out} = (1 - \\alpha_{src}) \* \\alpha_{dst}\\)

\\(C_{out} = (1 - \\alpha_{src}) \* C_{dst}\\)

<br />

<br />

### DST_OVER

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode DST_OVER
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_DST_OVER.png)
The source pixels are drawn behind the destination pixels.

<br />

\\(\\alpha_{out} = \\alpha_{dst} + (1 - \\alpha_{dst}) \* \\alpha_{src}\\)

\\(C_{out} = C_{dst} + (1 - \\alpha_{dst}) \* C_{src}\\)

<br />

<br />

### LIGHTEN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode LIGHTEN
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_LIGHTEN.png)
Retains the largest component of the source and destination pixel.

<br />

\\(\\alpha_{out} = \\alpha_{src} + \\alpha_{dst} - \\alpha_{src} \* \\alpha_{dst}\\)

\\(C_{out} = (1 - \\alpha_{dst}) \* C_{src} + (1 - \\alpha_{src}) \* C_{dst} + max(C_{src}, C_{dst})\\)

<br />

<br />

### MULTIPLY

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode MULTIPLY
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_MULTIPLY.png)
Multiplies the source and destination pixels.

<br />

\\(\\alpha_{out} = \\alpha_{src} \* \\alpha_{dst}\\)

\\(C_{out} = C_{src} \* C_{dst}\\)

<br />

<br />

### OVERLAY

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode OVERLAY
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_OVERLAY.png)
Multiplies or screens the source and destination depending on the destination color.

<br />

\\(\\alpha_{out} = \\alpha_{src} + \\alpha_{dst} - \\alpha_{src} \* \\alpha_{dst}\\)

\\(\\begin{equation} C_{out} = \\begin{cases} 2 \* C_{src} \* C_{dst} \& 2 \* C_{dst} \\lt \\alpha_{dst} \\\\ \\alpha_{src} \* \\alpha_{dst} - 2 (\\alpha_{dst} - C_{src}) (\\alpha_{src} - C_{dst}) \& otherwise \\end{cases} \\end{equation}\\)

<br />

<br />

### SCREEN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode SCREEN
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_SCREEN.png)
Adds the source and destination pixels, then subtracts the source pixels multiplied by the destination.

<br />

\\(\\alpha_{out} = \\alpha_{src} + \\alpha_{dst} - \\alpha_{src} \* \\alpha_{dst}\\)

\\(C_{out} = C_{src} + C_{dst} - C_{src} \* C_{dst}\\)

<br />

<br />

### SRC

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode SRC
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC.png)
The source pixels replace the destination pixels.

<br />

\\(\\alpha_{out} = \\alpha_{src}\\)

\\(C_{out} = C_{src}\\)

<br />

<br />

### SRC_ATOP

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode SRC_ATOP
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_ATOP.png)
Discards the source pixels that do not cover destination pixels. Draws remaining source pixels over destination pixels.

<br />

\\(\\alpha_{out} = \\alpha_{dst}\\)

\\(C_{out} = \\alpha_{dst} \* C_{src} + (1 - \\alpha_{src}) \* C_{dst}\\)

<br />

<br />

### SRC_IN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode SRC_IN
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_IN.png)
Keeps the source pixels that cover the destination pixels, discards the remaining source and destination pixels.

<br />

\\(\\alpha_{out} = \\alpha_{src} \* \\alpha_{dst}\\)

\\(C_{out} = C_{src} \* \\alpha_{dst}\\)

<br />

<br />

### SRC_OUT

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode SRC_OUT
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_OUT.png)
Keeps the source pixels that do not cover destination pixels. Discards source pixels that cover destination pixels. Discards all destination pixels.

<br />

\\(\\alpha_{out} = (1 - \\alpha_{dst}) \* \\alpha_{src}\\)

\\(C_{out} = (1 - \\alpha_{dst}) \* C_{src}\\)

<br />

<br />

### SRC_OVER

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode SRC_OVER
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_SRC_OVER.png)
The source pixels are drawn over the destination pixels.

<br />

\\(\\alpha_{out} = \\alpha_{src} + (1 - \\alpha_{src}) \* \\alpha_{dst}\\)

\\(C_{out} = C_{src} + (1 - \\alpha_{src}) \* C_{dst}\\)

<br />

<br />

### XOR

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final PorterDuff.Mode XOR
```

<br />

![](https://developer.android.com/static/reference/android/images/graphics/composite_XOR.png)
Discards the source and destination pixels where source pixels cover destination pixels. Draws remaining source pixels.

<br />

\\(\\alpha_{out} = (1 - \\alpha_{dst}) \* \\alpha_{src} + (1 - \\alpha_{src}) \* \\alpha_{dst}\\)

\\(C_{out} = (1 - \\alpha_{dst}) \* C_{src} + (1 - \\alpha_{src}) \* C_{dst}\\)

<br />

<br />

## Public methods

### valueOf

```
public static PorterDuff.Mode valueOf (String name)
```

<br />

<br />

| Parameters ||
|---|---|
| `name` | `String` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | <br /> |

### values

```
public static final Mode[] values ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | <br /> |