public open class RemoteDrawScope
internal constructor(
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) public val remoteCanvas: RemoteCanvas
) : RemoteStateScope by remoteCanvas
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.
Functions
usePaint
public fun usePaint(paint: RemotePaint, block: () -> Unit)
drawRect
public fun drawRect(
paint: RemotePaint?,
topLeft: RemoteOffset = RemoteOffset.Zero,
size: RemoteSize = [email protected],
)
drawRoundRect
public fun drawRoundRect(
paint: RemotePaint?,
topLeft: RemoteOffset = RemoteOffset.Zero,
size: RemoteSize = [email protected],
cornerRadius: RemoteOffset = RemoteOffset.Zero,
)
drawCircle
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawCircle(
paint: RemotePaint?,
center: RemoteOffset = [email protected],
radius: RemoteFloat,
)
Draws a circle.
drawOval
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawOval(
paint: RemotePaint?,
topLeft: RemoteOffset = RemoteOffset.Zero,
size: RemoteSize = [email protected],
)
drawArc
public fun drawArc(
paint: RemotePaint?,
startAngle: RemoteFloat,
sweepAngle: RemoteFloat,
useCenter: Boolean,
topLeft: RemoteOffset = RemoteOffset.Zero,
size: RemoteSize = [email protected],
)
drawLine
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawLine(paint: RemotePaint?, start: RemoteOffset, end: RemoteOffset)
Draws a line.
drawImage
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawImage(
image: RemoteBitmap,
topLeft: RemoteOffset = RemoteOffset.Zero,
paint: RemotePaint? = RemotePaint(),
)
drawScaledBitmap
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawScaledBitmap(
image: RemoteBitmap,
srcOffset: RemoteOffset = RemoteOffset.Zero,
srcSize: RemoteSize = RemoteSize(image.width, image.height),
dstOffset: RemoteOffset = RemoteOffset.Zero,
dstSize: RemoteSize = size,
scaleType: ContentScale = ContentScale.Fit,
scaleFactor: RemoteFloat = 1f.rf,
contentDescription: String? = null,
)
Draws a bitmap scaled to the destination rectangle.
drawPath
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawPath(path: RemotePath, paint: RemotePaint?)
Draws a path.
drawRoundedPolygon
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawRoundedPolygon(roundedPolygon: RoundedPolygon, paint: RemotePaint?)
Draws a rounded polygon.
drawRoundedPolygonMorph
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawRoundedPolygonMorph(
from: RoundedPolygon,
to: RoundedPolygon,
progress: RemoteFloat,
paint: RemotePaint?,
)
Draws a morph between two rounded polygons.
drawTweenPath
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawTweenPath(
path1: RemotePath,
path2: RemotePath,
tween: RemoteFloat,
start: RemoteFloat = 0f.rf,
stop: RemoteFloat = 1f.rf,
paint: RemotePaint?,
)
Draws a tween path.
drawText
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawText(text: RemoteString, x: RemoteFloat, y: RemoteFloat, paint: RemotePaint?)
Draws text.
drawAnchoredText
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawAnchoredText(
text: RemoteString,
anchorX: RemoteFloat,
anchorY: RemoteFloat,
panX: RemoteFloat = 0f.rf,
panY: RemoteFloat = 0f.rf,
flags: Int = 0,
paint: RemotePaint?,
)
drawTextOnPath
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawTextOnPath(
text: RemoteString,
path: RemotePath,
hOffset: RemoteFloat = 0f.rf,
vOffset: RemoteFloat = 0f.rf,
paint: RemotePaint?,
)
rotate
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun rotate(degrees: RemoteFloat, block: RemoteDrawScope.() -> Unit)
Performs a rotation.
rotate
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun rotate(
degrees: RemoteFloat,
pivot: RemoteOffset,
block: RemoteDrawScope.() -> Unit,
)
Performs a rotation.
translate
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun translate(left: RemoteFloat, top: RemoteFloat, block: RemoteDrawScope.() -> Unit)
Performs a translation.
scale
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun scale(scale: RemoteFloat, block: RemoteDrawScope.() -> Unit)
Performs a scaling.
scale
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun scale(scaleX: RemoteFloat, scaleY: RemoteFloat, block: RemoteDrawScope.() -> Unit)
Performs a scaling.
scale
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun scale(
scaleX: RemoteFloat,
scaleY: RemoteFloat,
pivot: RemoteOffset,
block: RemoteDrawScope.() -> Unit,
)
Performs a scaling.
withTransform
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun withTransform(
transformBlock: RemoteCanvas.() -> Unit,
drawBlock: RemoteDrawScope.() -> Unit,
)
Executes drawBlock with the specified transformation applied.
Parameters
| transformBlock | The block defining the transformations to apply. |
| drawBlock | The block containing drawing operations to execute with the transformations applied. |
drawTextOnCircle
public fun drawTextOnCircle(
text: RemoteString,
centerX: RemoteFloat,
centerY: RemoteFloat,
radius: RemoteFloat,
startAngle: RemoteFloat,
warpRadiusOffset: RemoteFloat,
paint: RemotePaint? = null,
)
Draws text along a circle.
Parameters
| text | The text to draw. |
| centerX | The x-coordinate of the circle's center. |
| centerY | The y-coordinate of the circle's center. |
| radius | The radius of the circle. |
| startAngle | The starting angle for the text. |
| warpRadiusOffset | the offset of the text from the circle. |
| paint | The RemotePaint to use for drawing. |
clipRect
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun clipRect(
left: RemoteFloat,
top: RemoteFloat,
right: RemoteFloat,
bottom: RemoteFloat,
clipOp: ClipOp = ClipOp.Intersect,
block: RemoteDrawScope.() -> Unit,
)
Clips the drawing area to the specified rectangle and executes block within it.
clipPath
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun clipPath(
path: RemotePath,
clipOp: ClipOp = ClipOp.Intersect,
block: RemoteDrawScope.() -> Unit,
)
Clips the drawing area to the specified path and executes block within it.
drawConditionally
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawConditionally(condition: RemoteBoolean, body: RemoteDrawScope.() -> Unit)
Executes body if condition evaluates to true.
drawToOffscreenBitmap
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun drawToOffscreenBitmap(bitmap: RemoteBitmap, body: RemoteDrawScope.() -> Unit)
Draws into an offscreen bitmap and executes body.
loop
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public fun loop(
from: RemoteFloat,
until: RemoteFloat,
step: RemoteFloat,
body: RemoteDrawScope.(index: RemoteFloat) -> Unit,
)
Executes body commands in a loop.