Android 12 Developer Preview is here! Try it out, and give us your feedback!

Brush

@Immutable sealed class Brush
kotlin.Any
   ↳ androidx.compose.ui.graphics.Brush

Summary

Public methods
abstract Unit
applyTo(size: Size, p: Paint, alpha: Float)

Companion functions
Brush
horizontalGradient(colors: List<Color>, startX: Float = 0.0f, endX: Float = Float.POSITIVE_INFINITY, tileMode: TileMode = TileMode.Clamp)

Creates a horizontal gradient with the given colors evenly dispersed within the gradient

Brush
horizontalGradient(vararg colorStops: Pair<Float, Color>, startX: Float = 0.0f, endX: Float = Float.POSITIVE_INFINITY, tileMode: TileMode = TileMode.Clamp)

Creates a horizontal gradient with the given colors dispersed at the provided offset defined in the colorstop pair.

Brush
linearGradient(vararg colorStops: Pair<Float, Color>, start: Offset = Offset.Zero, end: Offset = Offset.Infinite, tileMode: TileMode = TileMode.Clamp)

Creates a linear gradient with the provided colors along the given start and end coordinates.

Brush
linearGradient(colors: List<Color>, start: Offset = Offset.Zero, end: Offset = Offset.Infinite, tileMode: TileMode = TileMode.Clamp)

Creates a linear gradient with the provided colors along the given start and end coordinates.

Brush
radialGradient(vararg colorStops: Pair<Float, Color>, center: Offset = Offset.Unspecified, radius: Float = Float.POSITIVE_INFINITY, tileMode: TileMode = TileMode.Clamp)

Creates a radial gradient with the given colors at the provided offset defined in the colorstop pair.

Brush
radialGradient(colors: List<Color>, center: Offset = Offset.Unspecified, radius: Float = Float.POSITIVE_INFINITY, tileMode: TileMode = TileMode.Clamp)

Creates a radial gradient with the given colors evenly dispersed within the gradient

Brush
sweepGradient(vararg colorStops: Pair<