androidx.compose.remote.creation.compose.shaders

Classes

RemoteBrush

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

Objects

Extension functions summary

RemoteBrush
RemoteBrush.Companion.horizontalGradient(
    colors: List<RemoteColor>,
    startX: RemoteFloat?,
    endX: RemoteFloat?,
    tileMode: TileMode
)

Creates a horizontal gradient with the given colors evenly dispersed within the gradient

RemoteBrush
RemoteBrush.Companion.linearGradient(
    colors: List<RemoteColor>,
    start: RemoteOffset?,
    end: RemoteOffset?,
    tileMode: TileMode
)

Creates a linear gradient with the provided colors along the given start and end coordinates.

RemoteBrush
RemoteBrush
RemoteBrush.Companion.verticalGradient(
    colors: List<RemoteColor>,
    startY: RemoteFloat?,
    endY: RemoteFloat?,
    tileMode: TileMode
)

Creates a vertical gradient with the given colors evenly dispersed within the gradient Ex:

Extension functions

RemoteBrush.Companion.horizontalGradient

fun RemoteBrush.Companion.horizontalGradient(
    colors: List<RemoteColor>,
    startX: RemoteFloat? = null,
    endX: RemoteFloat? = null,
    tileMode: TileMode = ComposeTileMode.Clamp
): RemoteBrush

Creates a horizontal gradient with the given colors evenly dispersed within the gradient

Ex:

 Brush.horizontalGradient(
listOf(Color.Red.rc, Color.Green.rc, Color.Blue.rc),
startX = 10.rf,
endX = 20.rf
)
Parameters
colors: List<RemoteColor>

colors to be rendered as part of the gradient

startX: RemoteFloat? = null

Starting x position of the horizontal gradient. Defaults to 0 which represents the left of the drawing area

endX: RemoteFloat? = null

Ending x position of the horizontal gradient. Defaults to Float.POSITIVE_INFINITY which indicates the right of the specified drawing area

tileMode: TileMode = ComposeTileMode.Clamp

Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to ComposeTileMode.Clamp to repeat the edge pixels

RemoteBrush.Companion.linearGradient

fun RemoteBrush.Companion.linearGradient(
    colors: List<RemoteColor>,
    start: RemoteOffset? = null,
    end: RemoteOffset? = null,
    tileMode: TileMode = ComposeTileMode.Clamp
): RemoteBrush

Creates a linear gradient with the provided colors along the given start and end coordinates.

 Brush.linearGradient(
listOf(Color.Red.rc, Color.Blue.rc),
start = Offset(0.rf, 50.rf)
end = Offset(0.rf, 100.rf)
)
Parameters
colors: List<RemoteColor>

Colors to be rendered as part of the gradient

start: RemoteOffset? = null

Starting position of the linear gradient. This can be set to RemoteOffset.Zero to position at the far left and top of the drawing area

end: RemoteOffset? = null

Ending position of the linear gradient. This can be set to RemoteOffset Infinite to position at the far right and bottom of the drawing area

tileMode: TileMode = ComposeTileMode.Clamp

Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to ComposeTileMode.Clamp to repeat the edge pixels

RemoteBrush.Companion.verticalGradient

fun RemoteBrush.Companion.verticalGradient(
    colors: List<RemoteColor>,
    startY: RemoteFloat? = null,
    endY: RemoteFloat? = null,
    tileMode: TileMode = ComposeTileMode.Clamp
): RemoteBrush

Creates a vertical gradient with the given colors evenly dispersed within the gradient Ex:

 Brush.verticalGradient(
listOf(Color.Red.rc, Color.Green.rc, Color.Blue.rc),
startY = 0.rf,
endY = 100.rf
)
Parameters
colors: List<RemoteColor>

colors to be rendered as part of the gradient

startY: RemoteFloat? = null

Starting y position of the vertical gradient. Defaults to 0 which represents the top of the drawing area

endY: RemoteFloat? = null

Ending y position of the vertical gradient. Defaults to Float.POSITIVE_INFINITY which indicates the bottom of the specified drawing area

tileMode: TileMode = ComposeTileMode.Clamp

Determines the behavior for how the shader is to fill a region outside its bounds. Defaults to ComposeTileMode.Clamp to repeat the edge pixels