Class

RemoteBrush

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

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
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.

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 shader and 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 shader and 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


fromComposeUi

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