{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

Brush

public sealed class Brush

Known direct subclasses
ShaderBrush

Brush implementation that wraps and applies a the provided shader to a Paint The shader can be lazily created based on a given size, or provided directly as a parameter

SolidColor
Known indirect subclasses
LinearGradient

Brush implementation used to apply a linear gradient on a given Paint

RadialGradient

Brush implementation used to apply a radial gradient on a given Paint

SweepGradient

Brush implementation used to apply a sweep gradient on a given Paint


Summary

Nested types

public static class Brush.Companion

Protected constructors

Public methods

abstract void
applyTo(@NonNull Size size, @NonNull Paint p, float alpha)
@NonNull Size

Return the intrinsic size of the Brush.

Protected constructors

Brush

protected Brush()

Public methods

applyTo

public abstract void applyTo(@NonNull Size size, @NonNull Paint p, float alpha)

getIntrinsicSize

public @NonNull Size getIntrinsicSize()

Return the intrinsic size of the Brush. If the there is no intrinsic size (i.e. filling bounds with an arbitrary color) return Size.Unspecified. If there is no intrinsic size in a single dimension, return Size with Float.NaN in the desired dimension.