# Stroke

Artifact: [androidx.compose.ui:ui-graphics](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/graphics/drawscope/DrawScope.kt+class:androidx.compose.ui.graphics.drawscope.Stroke) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/All
- Cmn

  ```
  class Stroke : DrawStyle
  ```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.compose.ui.graphics.drawscope.DrawStyle](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/DrawStyle) ||
|   | ↳ | [androidx.compose.ui.graphics.drawscope.Stroke](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke) |

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/DrawStyle` that provides information for drawing content with a stroke

## Summary

| ### Constants |
|---|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#DefaultMiter() = 4.0f` Default miter length used in combination with joins | Cmn |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#HairlineWidth() = 0.0f` Width to indicate a hairline stroke of 1 pixel | Cmn |

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#DefaultCap()` Default cap used for line endings | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeJoin` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#DefaultJoin()` Default join style used for connections between line and curve segments | Cmn |

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#Stroke(kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.StrokeCap,androidx.compose.ui.graphics.StrokeJoin,androidx.compose.ui.graphics.PathEffect)( width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, miter: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, cap: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap, join: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeJoin, pathEffect: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathEffect? )` | Cmn |

| ### Public functions |
|---|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#hashCode()()` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#cap()` Return the paint's Cap, controlling how the start and end of stroked lines and paths are treated. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeJoin` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#join()` Set's the treatment where lines and curve segments join on a stroked path. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#miter()` Set the stroke miter value. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathEffect?` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#pathEffect()` Effect to apply to the stroke, null indicates a solid stroke line is to be drawn | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/Stroke#width()` Configure the width of the stroke in pixels | Cmn |

## Constants

### DefaultMiter

Cmn

```
const val DefaultMiter = 4.0f: Float
```

Default miter length used in combination with joins

### HairlineWidth

Cmn

```
const val HairlineWidth = 0.0f: Float
```

Width to indicate a hairline stroke of 1 pixel

## Public companion properties

### DefaultCap

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val DefaultCap: StrokeCap
```

Default cap used for line endings

### DefaultJoin

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val DefaultJoin: StrokeJoin
```

Default join style used for connections between line and curve segments

## Public constructors

### Stroke

Cmn Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.9.0)

```
Stroke(
    width: Float = 0.0f,
    miter: Float = DefaultMiter,
    cap: StrokeCap = DefaultCap,
    join: StrokeJoin = DefaultJoin,
    pathEffect: PathEffect? = null
)
```

| Parameters |
|---|---|
| `width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.0f` | Configure the width of the stroke in pixels |
| `miter: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = DefaultMiter` | Set the stroke miter value. This is used to control the behavior of miter joins when the joins angle is sharp. This value must be \>= 0 |
| `cap: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap = DefaultCap` | Return the paint's Cap, controlling how the start and end of stroked lines and paths are treated. The default is `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap#Butt()` |
| `join: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeJoin = DefaultJoin` | Set's the treatment where lines and curve segments join on a stroked path. The default is `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeJoin#Miter()` |
| `pathEffect: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/PathEffect? = null` | Effect to apply to the stroke, null indicates a solid stroke line is to be drawn |

## Public functions

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

Cmn

```
open fun hashCode(): Int
```

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### cap

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val cap: StrokeCap
```

Return the paint's Cap, controlling how the start and end of stroked lines and paths are treated. The default is `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeCap#Butt()`

### join

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val join: StrokeJoin
```

Set's the treatment where lines and curve segments join on a stroked path. The default is `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/StrokeJoin#Miter()`

### miter

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val miter: Float
```

Set the stroke miter value. This is used to control the behavior of miter joins when the joins angle is sharp. This value must be \>= 0

### pathEffect

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val pathEffect: PathEffect?
```

Effect to apply to the stroke, null indicates a solid stroke line is to be drawn

### width

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val width: Float
```

Configure the width of the stroke in pixels