CompositingStrategy


Determines when to render the contents of a layer into an offscreen buffer before being drawn to the destination.

Summary

Public companion properties

CompositingStrategy

Rendering to an offscreen buffer will be determined automatically by the rest of the graphicsLayer parameters.

Cmn
CompositingStrategy

Modulates alpha for each of the drawing instructions recorded within the graphicsLayer.

Cmn
CompositingStrategy

Rendering of content will always be rendered into an offscreen buffer first then drawn to the destination regardless of the other parameters configured on the graphics layer.

Cmn

Public companion properties

Auto

val AutoCompositingStrategy

Rendering to an offscreen buffer will be determined automatically by the rest of the graphicsLayer parameters. This is the default behavior. For example, whenever an alpha value less than 1.0f is provided on Modifier.graphicsLayer, a compositing layer is created automatically to first render the contents fully opaque, then draw this offscreen buffer to the destination with the corresponding alpha. This is necessary for correctness otherwise alpha applied to individual drawing instructions that overlap will have a different result than expected. Additionally usage of RenderEffect on the graphicsLayer will also render into an intermediate offscreen buffer before being drawn into the destination.

ModulateAlpha

val ModulateAlphaCompositingStrategy

Modulates alpha for each of the drawing instructions recorded within the graphicsLayer. This avoids usage of an offscreen buffer for purposes of alpha rendering. ModulateAlpha is more efficient than Auto in performance in scenarios where an alpha value less than 1.0f is provided. Otherwise the performance is similar to that of Auto. However, this can provide different results than Auto if there is overlapping content within the layer and alpha is applied. This should only be used if the contents of the layer are known well in advance and are expected to not be overlapping.

Offscreen

val OffscreenCompositingStrategy

Rendering of content will always be rendered into an offscreen buffer first then drawn to the destination regardless of the other parameters configured on the graphics layer. This is useful for leveraging different blending algorithms for masking content. For example, the contents can be drawn into this graphics layer and masked out by drawing additional shapes with BlendMode.Clear