androidx.compose.ui.graphics.painter

Painter

Abstract class · from org.jetbrains.compose.ui:ui-graphics:1.12.2

No hand-written docs yet.

Abstraction for something that can be drawn. In addition to providing the ability to draw into a specified bounded area, Painter provides a few high level mechanisms that consumers can use to configure how the content is drawn. These include alpha, ColorFilter, and RTL

abstract class Painter

Kinds of Painter

Anywhere a Painter is expected, you can pass any of these.

How to get one

Used by

Parameters that take a Painter.

Properties

intrinsicSize

val intrinsicSize: Size

Return the intrinsic size of the Painter. 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. If a Painter does not have an intrinsic size, it will always draw within the full bounds of the destination

Functions

draw

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

Abstraction for something that can be drawn. In addition to providing the ability to draw into a specified bounded area, 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 Painter subclasses and not rely on just referential equality