androidx.compose.ui.draw
drawWithCache
Function · from org.jetbrains.compose.ui:ui:1.12.2
No hand-written docs yet.
Draw into a DrawScope with content that is persisted across draw calls as long as the size of the drawing area is the same or any state objects that are read have not changed. In the event that the drawing area changes, or the underlying state values that are being read change, this method is invoked again to recreate objects to be used during drawing
Parameters
fun Modifier.drawWithCache(
onBuildDrawCache: CacheDrawScope.() -> DrawResult,
)
onBuildDrawCache: CacheDrawScope.() -> DrawResultRequired
onBuildDrawCache: CacheDrawScope.() -> DrawResultRequiredNot described.
Library docs
Draw into a DrawScope with content that is persisted across draw calls as long as the size of
the drawing area is the same or any state objects that are read have not changed. In the event
that the drawing area changes, or the underlying state values that are being read change, this
method is invoked again to recreate objects to be used during drawing
For example, a androidx.compose.ui.graphics.LinearGradient that is to occupy the full bounds of
the drawing area can be created once the size has been defined and referenced for subsequent draw
calls without having to re-allocate.