Android 12 Developer Preview is here! Try it out, and give us your feedback!

Canvas

interface Canvas
androidx.compose.ui.graphics.Canvas

Summary

Public methods
abstract Unit
clipPath(path: Path, clipOp: ClipOp = ClipOp.Intersect)

Reduces the clip region to the intersection of the current clip and the given Path.

open Unit
clipRect(rect: Rect, clipOp: ClipOp = ClipOp.Intersect)

Reduces the clip region to the intersection of the current clip and the given rectangle.

abstract Unit
clipRect(left: Float, top: Float, right: Float, bottom: Float, clipOp: ClipOp = ClipOp.Intersect)

Reduces the clip region to the intersection of the current clip and the given bounds.

abstract Unit
concat(matrix: Matrix)

Multiply the current transform by the specified 4⨉4 transformation matrix specified as a list of values in column-major order.

abstract Unit

Disables Z support, preventing any layers drawn after this point from being visually reordered or having shadows rendered.

open Unit
drawArc(rect: Rect, startAngle: Float, sweepAngle: Float, useCenter: Boolean, paint: Paint)

Draw an arc scaled to fit inside the given rectangle.

abstract Unit
drawArc(left: Float, top: Float, right: Float, bottom: Float, startAngle: Float, sweepAngle: Float, useCenter: Boolean, paint: Paint)

Draw an arc scaled to fit inside the given rectangle.

open Unit
drawArcRad(rect: Rect, startAngleRad: Float, sweepAngleRad: Float, useCenter: Boolean, paint: Paint)

Draw an arc scaled to fit inside the given rectangle.

abstract Unit
drawCircle(center: Offset, radius: Float, paint: Paint)

Draws a circle centered at the point given by the first argument and that has the radius given by the second argument, with the Paint given in the third argument.

abstract Unit
drawImage(image: ImageBitmap, topLeftOffset: Offset, paint: Paint)

Draws the given ImageBitmap into the canvas with its top-left corner at the given Offset.

abstract Unit
drawImageRect(image: ImageBitmap, srcOffset: IntOffset = IntOffset.Zero, srcSize: IntSize = IntSize(image.width, image.height), dstOffset: IntOffset = IntOffset.Zero, dstSize: IntSize = srcSize, paint: Paint)

Draws the subset of the given image described by the src argument into the canvas in the axis-aligned rectangle given by the dst argument.

abstract Unit