Class

RemoteBrush

A remote representation of a Brush that can be serialized and reconstructed on a remote surface.

Source set: Android
public abstract class RemoteBrush internal constructor()

A remote representation of a Brush that can be serialized and reconstructed on a remote surface.

This class provides a mechanism to intercept standard Compose Brush instances, such as linear gradients or solid colors, and convert them into a format suitable for remote rendering.

Properties

intrinsicSize

Source set: Android
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) public val intrinsicSize: Size

Return the intrinsic size of the RemoteBrush. If the there is no intrinsic size (i.e. filling bounds with an arbitrary color) return Size.Unspecified. If there is no intrinsic size in a single dimension, return Size with Float.NaN in the desired dimension.

hasShader

Source set: Android
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public open val hasShader: Boolean

Functions

createShader

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public abstract fun RemoteStateScope.createShader(size: RemoteSize): RemoteShader

applyTo

public open fun RemoteStateScope.applyTo(paint: RemotePaint, size: RemoteSize)

Applies this RemoteBrush to a paint.

Depending on whether the brush is a shader or a solid color, this method updates RemotePaint.shader and RemotePaint.color accordingly.

Parameters

paint The paint to apply to.
size The size of the area being drawn, used for shader calculation.

applyTo

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public open fun RemoteStateScope.applyTo(
    paint: RemotePaint,
    size: RemoteSize,
    matrix3x3: RemoteMatrix3x3? = null,
)

Applies this RemoteBrush to a paint.

Depending on whether the brush is a shader or a solid color, this method updates RemotePaint.shader and RemotePaint.color accordingly.

Parameters

paint The paint to apply to.
size The size of the area being drawn, used for shader calculation.
matrix3x3 An optional matrix to apply to the shader.

Companion Object

Methods

Source set: Android
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun fromComposeUi(brush: Brush): RemoteBrush

Last updated: