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

Nested types

Alignment of text along a circular path.

Placement of text relative to the circular path.

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?,
    alignment: RemoteDrawScope.CircularAlignment,
    placement: RemoteDrawScope.CircularPlacement
)

Draws text along a circle.

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

Public properties

RemoteOffset

The center of the drawing area as a RemoteOffset.

open RemoteFloat

The height of the drawing area as a RemoteFloat.

RemoteSize

The size of the drawing area as a RemoteSize.

open RemoteFloat

The width of the drawing area as a RemoteFloat.

Extension functions

Unit

Draws the RemoteOutline on a RemoteDrawScope.

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-alpha21
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-alpha21
fun drawCircle(
    paint: RemotePaint?,
    radius: RemoteFloat,
    center: RemoteOffset = this@RemoteDrawScope.center
): Unit

Draws a circle.

drawLine

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

Draws a line.

drawOval

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

drawRect

Added in 1.0.0-alpha21
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-alpha21
fun drawRoundRect(
    paint: RemotePaint?,
    topLeft: RemoteOffset = RemoteOffset.Zero,
    size: RemoteSize = this@RemoteDrawScope.size,
    cornerRadius: RemoteOffset = RemoteOffset.Zero
): Unit

drawTextOnCircle

Added in 1.0.0-alpha21
fun drawTextOnCircle(
    text: RemoteString,
    centerX: RemoteFloat,
    centerY: RemoteFloat,
    radius: RemoteFloat,
    startAngle: RemoteFloat,
    warpRadiusOffset: RemoteFloat,
    paint: RemotePaint? = null,
    alignment: RemoteDrawScope.CircularAlignment = CircularAlignment.Center,
    placement: RemoteDrawScope.CircularPlacement = CircularPlacement.Outside
): 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.

alignment: RemoteDrawScope.CircularAlignment = CircularAlignment.Center

The alignment of the text relative to start.

placement: RemoteDrawScope.CircularPlacement = CircularPlacement.Outside

The placement inside or outside the circle.

usePaint

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

Public properties

center

Added in 1.0.0-alpha21
val center: RemoteOffset

The center of the drawing area as a RemoteOffset.

height

Added in 1.0.0-alpha21
open val height: RemoteFloat

The height of the drawing area as a RemoteFloat.

size

Added in 1.0.0-alpha21
val size: RemoteSize

The size of the drawing area as a RemoteSize.

width

Added in 1.0.0-alpha21
open val width: RemoteFloat

The width of the drawing area as a RemoteFloat.

Extension functions

RemoteDrawScope.drawOutline

fun RemoteDrawScope.drawOutline(outline: RemoteOutline, paint: RemotePaint): Unit

Draws the RemoteOutline on a RemoteDrawScope.

Parameters
outline: RemoteOutline

the outline to draw.

paint: RemotePaint

the paint used for the drawing.