🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

CompositingStrategy

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

Source set: Common
public class CompositingStrategy internal constructor(@Suppress("unused") private val value: Int)

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

Members

Companion

Source set: Common
public companion object

Properties

Auto

Source set: Common
public val Auto: CompositingStrategy

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 androidx.compose.ui.graphics.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 androidx.compose.ui.graphics.RenderEffect on the graphicsLayer will also render into an intermediate offscreen buffer before being drawn into the destination.

Offscreen

Source set: Common
public val Offscreen: 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. 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 androidx.compose.ui.graphics.BlendMode.Clear

ModulateAlpha

Source set: Common
public val ModulateAlpha: CompositingStrategy

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.