CacheDrawScope
-
Cmn
class CacheDrawScope : Density
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 onDrawBehind or onDrawWithContent.
onDrawBehind 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 functions |
||
|---|---|---|
GraphicsLayer |
Returns a managed |
Cmn
|
ShadowContext |
Returns the |
Cmn
|
DrawResult |
onDrawBehind(block: DrawScope.() -> Unit)Issue drawing commands to be executed before the layout content is drawn |
Cmn
|
DrawResult |
onDrawWithContent(block: ContentDrawScope.() -> Unit)Issue drawing commands before or after the layout's drawing contents |
Cmn
|
Unit |
GraphicsLayer.record(Record the drawing commands into the |
Cmn
|
Public properties |
||
|---|---|---|
open Float |
The logical density of the display. |
Cmn
|
open Float |
Current user preference for the scaling factor for fonts. |
Cmn
|
LayoutDirection |
Provides the |
Cmn
|
Size |
Provides the dimensions of the current drawing environment |
Cmn
|
Inherited functions |
|||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|||||||||||||||||||||||||||||||||
Public functions
obtainGraphicsLayer
fun obtainGraphicsLayer(): GraphicsLayer
Returns a managed GraphicsLayer instance. This GraphicsLayer maybe newly created or return a previously allocated instance. Consumers are not expected to release this instance as it is automatically recycled upon invalidation of the CacheDrawScope and released when the DrawCacheModifier is detached.
obtainShadowContext
fun obtainShadowContext(): ShadowContext
Returns the ShadowContext used to create InnerShadowPainter and DropShadowPainter to render inner and drop shadows respectively
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
record
fun GraphicsLayer.record(
density: Density = this@CacheDrawScope,
layoutDirection: LayoutDirection = this@CacheDrawScope.layoutDirection,
size: IntSize = this@CacheDrawScope.size.toIntSize(),
block: ContentDrawScope.() -> Unit
): Unit
Record the drawing commands into the GraphicsLayer with the Density, LayoutDirection and Size are given from the provided CacheDrawScope