# SelfOverlap

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/SelfOverlap.kt+class:androidx.ink.brush.SelfOverlap) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

*** ** * ** ***


```
public final class SelfOverlap
```

<br />

*** ** * ** ***

Specifies how parts of the stroke that intersect itself should be treated during the rendering process. The simplest example of this is with translucent, solid-color strokes - such as `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#highlighter(androidx.ink.brush.SelfOverlap,androidx.ink.brush.StockBrushes.HighlighterVersion)` or `https://developer.android.com/reference/androidx/ink/brush/StockBrushes#emojiHighlighter(kotlin.String,kotlin.Boolean,androidx.ink.brush.SelfOverlap,androidx.ink.brush.StockBrushes.EmojiHighlighterVersion)`.

## Summary

| ### Public fields |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/SelfOverlap` | `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap#ACCUMULATE()` Self overlap will be accumulated, meaning that both the overlapped content and the overlapping content will be drawn. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/SelfOverlap` | `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap#ANY()` Any of the options listed below may be used, depending on what would be most efficient and feature-complete for the brush and the device. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/SelfOverlap` | `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap#DISCARD()` Self overlap will be drawn in a way that discards the overlapping content. |

| ### 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/SelfOverlap#calculateMinimumRequiredVersion()()` Returns the minimum required `https://developer.android.com/reference/androidx/ink/brush/Version` for this `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap`. |
| `@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/SelfOverlap#toString()()` |

## Public fields

### ACCUMULATE

```
public static final @NonNull SelfOverlap ACCUMULATE
```

Self overlap will be accumulated, meaning that both the overlapped content and the overlapping content will be drawn. For a translucent color stroke, this typically means that the overlapping portion will appear with double the opacity of the non-overlapping portions. This option is most analogous to physical writing and drawing, and it is the option that best matches the appearance as if the stroke were drawn as separate, shorter strokes. This is the default behavior for Android U and above when `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap#ANY()` is used because it leads to the most performant rendering. This cannot be rendered on Android devices before API level U.

### ANY

```
public static final @NonNull SelfOverlap ANY
```

Any of the options listed below may be used, depending on what would be most efficient and feature-complete for the brush and the device.

### DISCARD

```
public static final @NonNull SelfOverlap DISCARD
```

Self overlap will be drawn in a way that discards the overlapping content. This can be used to make the stroke appear as if it's drawn as a PDF page object or annotation, where a stroke can be filled only with a solid color or textures using `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.TilingTexture`. This is the default behavior for Android T and below when `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap#ANY()` is used, and can also be used on Android U and above if desired.

This is incompatible with `https://developer.android.com/reference/androidx/ink/brush/BrushBehavior`s which target opacity or color, and with `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.StampingTexture`. This is because `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap#DISCARD()` forces usage of the path renderer, and the aforementioned features require the mesh renderer. In the case where both are specified on the same `https://developer.android.com/reference/androidx/ink/brush/BrushCoat`, the effects of the `https://developer.android.com/reference/androidx/ink/brush/BrushBehavior` or `https://developer.android.com/reference/androidx/ink/brush/BrushPaint.StampingTexture` will not be rendered.

## 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/SelfOverlap`.

By default, decoding a `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` containing a `https://developer.android.com/reference/androidx/ink/brush/SelfOverlap` 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()
```