Google is committed to advancing racial equity for Black communities. See how.

CacheDrawScope

class CacheDrawScope : Density
kotlin.Any
   ↳ androidx.compose.ui.CacheDrawScope

Handle to a drawing environment that enables caching of content based on the resolved size. Consumers define parameters and refer to them in the captured draw callback provided in onDraw or onDrawWithContent.

onDraw will draw behind the layout's drawing contents however, onDrawWithContent will provide the ability to draw before or after the layout's contents

Summary

Public methods
DrawResult
onDraw(block: DrawScope.() -> Unit)

Issue drawing commands to be executed before the layout content is drawn

DrawResult
onDrawBehind(block: DrawScope.() -> Unit)

Issue drawing commands to be executed before the layout content is drawn

DrawResult

Issue drawing commands before or after the layout's drawing contents

Inherited functions
Properties
Float

The logical density of the display.

Float

Current user preference for the scaling factor for fonts.

Size

Provides the dimensions of the current drawing environment

Public methods

onDraw

fun onDraw(block: DrawScope.() -> Unit): DrawResult

Deprecated.

Issue drawing commands to be executed before the layout content is drawn

onDrawBehind

fun onDrawBehind(block: DrawScope.() -> Unit): DrawResult

Issue drawing commands to be executed before the layout content is drawn

onDrawWithContent

fun onDrawWithContent(block: ContentDrawScope.() -> Unit): DrawResult

Issue drawing commands before or after the layout's drawing contents

Properties

density

val density: Float

The logical density of the display. This is a scaling factor for the Dp unit.

fontScale

val fontScale: Float

Current user preference for the scaling factor for fonts.

size

var size: Size

Provides the dimensions of the current drawing environment