# Painter

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/painter/Painter.kt+class:androidx.compose.ui.graphics.painter.Painter) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/All
- Cmn

  ```
  abstract class Painter
  ```
Known direct subclasses [BitmapPainter](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/BitmapPainter), [BrushPainter](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/BrushPainter), [ColorPainter](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/ColorPainter), [DropShadowPainter](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/DropShadowPainter), [InnerShadowPainter](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/InnerShadowPainter), [MeshGradientPainter](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/MeshGradientPainter), [VectorPainter](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/VectorPainter)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/BitmapPainter` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` implementation used to draw an `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmap` into the provided canvas This implementation can handle applying alpha and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ColorFilter` to it's drawn result |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/BrushPainter` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` implementation used to fill the provided bounds with the specified `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/ColorPainter` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` implementation used to fill the provided bounds with the specified color |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/DropShadowPainter` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` implementation that draws a drop shadow with the geometry defined by the specified shape and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/Shadow`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/InnerShadowPainter` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` implementation that draws an inner shadow with the geometry defined by the specified shape and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/Shadow`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/MeshGradientPainter` | A MeshGradient is a 2D grid of patches defined by vertices. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/vector/VectorPainter` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` implementation that abstracts the drawing of a Vector graphic. |

*** ** * ** ***

Abstraction for something that can be drawn. In addition to providing the ability to draw into a specified bounded area, `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` provides a few high level mechanisms that consumers can use to configure how the content is drawn. These include alpha, ColorFilter, and RTL

Implementations should provide a meaningful equals method that compares values of different `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` subclasses and not rely on just referential equality

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter#Painter()()` | Cmn |

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/DrawScope.https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter#(androidx.compose.ui.graphics.drawscope.DrawScope).draw(androidx.compose.ui.geometry.Size,kotlin.Float,androidx.compose.ui.graphics.ColorFilter)(size: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size, alpha: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, colorFilter: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ColorFilter?)` | Cmn |

| ### Protected functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter#applyAlpha(kotlin.Float)(alpha: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Apply the provided alpha value returning true if it was applied successfully, or false if it could not be applied | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter#applyColorFilter(androidx.compose.ui.graphics.ColorFilter)(colorFilter: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ColorFilter?)` Apply the provided color filter returning true if it was applied successfully, or false if it could not be applied | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter#applyLayoutDirection(androidx.compose.ui.unit.LayoutDirection)(layoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection)` Apply the appropriate internal configuration to positioning content with the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection` | Cmn |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/DrawScope.https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter#(androidx.compose.ui.graphics.drawscope.DrawScope).onDraw()()` Implementation of drawing logic for instances of `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter`. | Cmn |

| ### Public properties |
|---|---|---|
| `abstract https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter#intrinsicSize()` Return the intrinsic size of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter`. | Cmn |

## Public constructors

### Painter

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

```
Painter()
```

## Public functions

### DrawScope.draw

Cmn 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/painter/Painter.kt+function:draw) Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun DrawScope.draw(
    size: Size,
    alpha: Float = DefaultAlpha,
    colorFilter: ColorFilter? = null
): Unit
```

## Protected functions

### applyAlpha

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

```
protected open fun applyAlpha(alpha: Float): Boolean
```

Apply the provided alpha value returning true if it was applied successfully, or false if it could not be applied

### applyColorFilter

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

```
protected open fun applyColorFilter(colorFilter: ColorFilter?): Boolean
```

Apply the provided color filter returning true if it was applied successfully, or false if it could not be applied

### applyLayoutDirection

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

```
protected open fun applyLayoutDirection(layoutDirection: LayoutDirection): Boolean
```

Apply the appropriate internal configuration to positioning content with the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection`

### DrawScope.onDraw

Cmn 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/painter/Painter.kt+function:onDraw) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
protected abstract fun DrawScope.onDraw(): Unit
```

Implementation of drawing logic for instances of `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter`. This is invoked internally within `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter#(androidx.compose.ui.graphics.drawscope.DrawScope).draw(androidx.compose.ui.geometry.Size,kotlin.Float,androidx.compose.ui.graphics.ColorFilter)` after the positioning and configuring the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter`

## Public properties

### intrinsicSize

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

```
abstract val intrinsicSize: Size
```

Return the intrinsic size of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter`. If the there is no intrinsic size (i.e. filling bounds with an arbitrary color) return `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size#Unspecified()`. If there is no intrinsic size in a single dimension, return `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Size` with `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/-companion/-na-n.html` in the desired dimension. If a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/painter/Painter` does not have an intrinsic size, it will always draw within the full bounds of the destination