# BrushPaint.TextureLayer.BlendMode

Artifact: [androidx.ink:ink-brush](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/brush/BrushPaint.kt+class:androidx.ink.brush.BrushPaint.TextureLayer.BlendMode) Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

*** ** * ** ***


```
public final class BrushPaint.TextureLayer.BlendMode
```

<br />

*** ** * ** ***

The method by which the combined texture layers (index \<= i) are blended with the next layer. The blend mode on the final layer controls how the combined texture is blended with the brush color, and should typically be a mode whose output alpha is proportional to the destination alpha, so that it can be adjusted by anti-aliasing.

## Summary

| ### Public fields |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#DST()` Keeps the destination pixels and discards the source pixels. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#DST_ATOP()` Discards destination pixels that aren't covered by source pixels. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#DST_IN()` Keeps destination pixels that cover source pixels. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#DST_OUT()` Keeps the destination pixels not covered by source pixels. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#DST_OVER()` The source pixels are drawn behind the destination pixels. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#MODULATE()` Source and destination are component-wise multiplied, including opacity. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#SRC()` Keeps the source pixels and discards the destination pixels. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#SRC_ATOP()` Discards source pixels that do not cover destination pixels. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#SRC_IN()` Keeps the source pixels that cover destination pixels. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#SRC_OUT()` Keeps the source pixels that do not cover destination pixels. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#SRC_OVER()` The source pixels are drawn over the destination pixels. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#XOR()` Discards source and destination pixels that intersect; keeps source and destination pixels that do not intersect. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Version` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#calculateMinimumRequiredVersion()()` Returns the minimum required `https://developer.android.com/reference/androidx/ink/brush/Version` for this `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode#toString()()` |

## Public fields

### DST

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode DST
```

Keeps the destination pixels and discards the source pixels.

```
Alpha = Alpha_dst
Color = Color_dst
```

This mode is unlikely to be useful, since it effectively causes the renderer to just ignore this `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer` and all layers before it, but it is included for completeness.

### DST_ATOP

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode DST_ATOP
```

Discards destination pixels that aren't covered by source pixels. Remaining destination pixels are drawn over source pixels.

```
Alpha = Alpha_src
Color = Alpha_src * Color_dst + (1 - Alpha_dst) * Color_src
```

This mode shouldn't normally be used for the final `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer`, since its output alpha is not proportional to the destination alpha (so it wouldn't preserve alpha adjustments from anti-aliasing).

### DST_IN

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode DST_IN
```

Keeps destination pixels that cover source pixels. Discards remaining source and destination pixels.

```
Alpha = Alpha_src * Alpha_dst
Color = Alpha_src * Color_dst
```

### DST_OUT

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode DST_OUT
```

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

```
Alpha = (1 - Alpha_src) * Alpha_dst
Color = (1 - Alpha_src) * Color_dst
```

### DST_OVER

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode DST_OVER
```

The source pixels are drawn behind the destination pixels.

```
Alpha = Alpha_dst + (1 - Alpha_dst) * Alpha_src
Color = Color_dst + (1 - Alpha_dst) * Color_src
```

This mode shouldn't normally be used for the final `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer`, since its output alpha is not proportional to the destination alpha (so it wouldn't preserve alpha adjustments from anti-aliasing).

### MODULATE

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode MODULATE
```

Source and destination are component-wise multiplied, including opacity.

```
Alpha = Alpha_src * Alpha_dst
Color = Color_src * Color_dst
```

### SRC

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode SRC
```

Keeps the source pixels and discards the destination pixels.

```
Alpha = Alpha_src
Color = Color_src
```

This mode shouldn't normally be used for the final `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer`, since its output alpha is not proportional to the destination alpha (so it wouldn't preserve alpha adjustments from anti-aliasing).

### SRC_ATOP

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode SRC_ATOP
```

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

```
Alpha = Alpha_dst
Color = Alpha_dst * Color_src + (1 - Alpha_src) * Color_dst
```

### SRC_IN

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode SRC_IN
```

Keeps the source pixels that cover destination pixels. Discards remaining source and destination pixels.

```
Alpha = Alpha_src * Alpha_dst
Color = Color_src * Alpha_dst
```

### SRC_OUT

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode SRC_OUT
```

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

```
Alpha = (1 - Alpha_dst) * Alpha_src
Color = (1 - Alpha_dst) * Color_src
```

This mode shouldn't normally be used for the final `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer`, since its output alpha is not proportional to the destination alpha (so it wouldn't preserve alpha adjustments from anti-aliasing).

### SRC_OVER

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode SRC_OVER
```

The source pixels are drawn over the destination pixels.

```
Alpha = Alpha_src + (1 - Alpha_src) * Alpha_dst
Color = Color_src + (1 - Alpha_src) * Color_dst
```

This mode shouldn't normally be used for the final `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer`, since its output alpha is not proportional to the destination alpha (so it wouldn't preserve alpha adjustments from anti-aliasing).

### XOR

```
public static final @NonNull BrushPaint.TextureLayer.BlendMode XOR
```

Discards source and destination pixels that intersect; keeps source and destination pixels that do not intersect.

```
Alpha = (1 - Alpha_dst) * Alpha_src + (1 - Alpha_src) * Alpha_dst
Color = (1 - Alpha_dst) * Color_src + (1 - Alpha_src) * Color_dst
```

This mode shouldn't normally be used for the final `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer`, since its output alpha is not proportional to the destination alpha (so it wouldn't preserve alpha adjustments from anti-aliasing).

## Public methods

### calculateMinimumRequiredVersion

Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
public final @NonNull Version calculateMinimumRequiredVersion()
```

Returns the minimum required `https://developer.android.com/reference/androidx/ink/brush/Version` for this `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode`.

By default, decoding a `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` containing a `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TextureLayer.BlendMode` with a minimum required version higher than `https://developer.android.com/reference/androidx/ink/brush/Version#MAX_SUPPORTED()` will fail.

### toString

```
public @NonNull String toString()
```