open class RemoteDrawScope : RemoteStateScope

Known direct subclasses
RemoteContentDrawScope

A remote-compatible drawing scope for RemoteCompose that provides access to the content of the component being drawn.


A remote-compatible drawing scope for RemoteCompose. Unlike DrawScope, this class uses remote types consistently and does not attempt to implement the standard DrawScope interface to avoid API incompatibilities.

Summary

Public functions

Unit
drawArc(
    paint: RemotePaint?,
    startAngle: RemoteFloat,
    sweepAngle: RemoteFloat,
    useCenter: Boolean,
    topLeft: RemoteOffset,
    size: RemoteSize
)
Unit
drawCircle(paint: RemotePaint?, radius: RemoteFloat, center: RemoteOffset)

Draws a circle.

Unit
drawLine(paint: RemotePaint?, start: RemoteOffset, end: RemoteOffset)

Draws a line.

Unit
drawOval(paint: RemotePaint?, topLeft: RemoteOffset, size: RemoteSize)
Unit
drawRect(paint: RemotePaint?, topLeft: RemoteOffset, size: RemoteSize)

Draws a rectangle with the given paint, topLeft offset, and size.

Unit
drawRoundRect(
    paint: RemotePaint?,
    topLeft: RemoteOffset,
    size: RemoteSize,
    cornerRadius: RemoteOffset
)
Unit
drawTextOnCircle(
    text: RemoteString,
    centerX: RemoteFloat,
    centerY: RemoteFloat,
    radius: RemoteFloat,
    startAngle: RemoteFloat,
    warpRadiusOffset: RemoteFloat,
    paint: RemotePaint?
)

Draws text along a circle.

Unit
usePaint(paint: RemotePaint, block: () -> Unit)

Public properties

RemoteOffset

The center of the drawing area as a RemoteOffset.

RemoteFloat

The height of the drawing area as a RemoteFloat.

RemoteSize

The size of the drawing area as a RemoteSize.

RemoteFloat

The width of the drawing area as a RemoteFloat.

Inherited properties

From androidx.compose.remote.creation.compose.state.RemoteStateScope
open LayoutDirection

The LayoutDirection associated with the document being drawn into.

open RemoteDensity

The RemoteDensity associated with the document being drawn into.

Public functions

drawArc

Added in 1.0.0-alpha19
fun drawArc(
    paint: RemotePaint?,
    startAngle: RemoteFloat,
    sweepAngle: RemoteFloat,
    useCenter: Boolean,
    topLeft: RemoteOffset = RemoteOffset.Zero,
    size: RemoteSize = this@RemoteDrawScope.size
): Unit

drawCircle

Added in 1.0.0-alpha19
fun drawCircle(
    paint: RemotePaint?,
    radius: RemoteFloat,
    center: RemoteOffset = this@RemoteDrawScope.center
): Unit

Draws a circle.

drawLine

Added in 1.0.0-alpha19
fun drawLine(paint: RemotePaint?, start: RemoteOffset, end: RemoteOffset): Unit

Draws a line.

drawOval

Added in 1.0.0-alpha19
fun drawOval(
    paint: RemotePaint?,
    topLeft: RemoteOffset = RemoteOffset.Zero,
    size: RemoteSize = this@RemoteDrawScope.size
): Unit

drawRect

Added in 1.0.0-alpha19
fun drawRect(
    paint: RemotePaint?,
    topLeft: RemoteOffset = RemoteOffset.Zero,
    size: RemoteSize = this@RemoteDrawScope.size
): Unit

Draws a rectangle with the given paint, topLeft offset, and size.

import androidx.compose.remote.creation.compose.layout.RemoteCanvas
import androidx.compose.remote.creation.compose.modifier.RemoteModifier
import androidx.compose.remote.creation.compose.modifier.size
import androidx.compose.remote.creation.compose.state.RemotePaint
import androidx.compose.remote.creation.compose.state.rc
import androidx.compose.remote.creation.compose.state.rdp
import androidx.compose.ui.graphics.Color

RemoteCanvas(modifier = RemoteModifier.size(100.rdp)) {
    val paint = RemotePaint().apply { color = Color.Blue.rc }
    drawRect(paint = paint)
}
Parameters
paint: RemotePaint?

The RemotePaint to use for drawing the rectangle.

topLeft: RemoteOffset = RemoteOffset.Zero

The top left offset of the rectangle.

size: RemoteSize = this@RemoteDrawScope.size

The size of the rectangle.

drawRoundRect

Added in 1.0.0-alpha19
fun drawRoundRect(
    paint: RemotePaint?,
    topLeft: RemoteOffset = RemoteOffset.Zero,
    size: RemoteSize = this@RemoteDrawScope.size,
    cornerRadius: RemoteOffset = RemoteOffset.Zero
): Unit

drawTextOnCircle

Added in 1.0.0-alpha19
fun drawTextOnCircle(
    text: RemoteString,
    centerX: RemoteFloat,
    centerY: RemoteFloat,
    radius: RemoteFloat,
    startAngle: RemoteFloat,
    warpRadiusOffset: RemoteFloat,
    paint: RemotePaint? = null
): Unit

Draws text along a circle.

Parameters
text: RemoteString

The text to draw.

centerX: RemoteFloat

The x-coordinate of the circle's center.

centerY: RemoteFloat

The y-coordinate of the circle's center.

radius: RemoteFloat

The radius of the circle.

startAngle: RemoteFloat

The starting angle for the text.

warpRadiusOffset: RemoteFloat

the offset of the text from the circle.

paint: RemotePaint? = null

paint of the text

usePaint

Added in 1.0.0-alpha19
fun usePaint(paint: RemotePaint, block: () -> Unit): Unit

Public properties

center

Added in 1.0.0-alpha19
val centerRemoteOffset

The center of the drawing area as a RemoteOffset.

height

Added in 1.0.0-alpha19
val heightRemoteFloat

The height of the drawing area as a RemoteFloat.

size

Added in 1.0.0-alpha19
val sizeRemoteSize

The size of the drawing area as a RemoteSize.

width

Added in 1.0.0-alpha19
val widthRemoteFloat

The width of the drawing area as a RemoteFloat.