Source set: Common
public class CanvasDrawScope : DrawScope
Implementation of DrawScope that issues drawing commands into the specified canvas and bounds via CanvasDrawScope.draw
Properties
layoutDirection
Source set: Common
override val layoutDirection: LayoutDirection
density
Source set: Common
override val density: Float
fontScale
Source set: Common
override val fontScale: Float
drawContext
Source set: Common
override val drawContext: DrawContext =
object : DrawContext {
override var canvas: Canvas
get() = drawParams.canvas
set(value) {
drawParams.canvas = value
}
override var size: Size
get() = drawParams.size
set(value) {
drawParams.size = value
}
override val transform: DrawTransform = asDrawTransform()
override var layoutDirection: LayoutDirection
get() = drawParams.layoutDirection
set(value) {
drawParams.layoutDirection = value
}
override var density: Density
get() = drawParams.density
set(value) {
drawParams.density = value
}
override var graphicsLayer: GraphicsLayer? = null
}
Functions
drawLine
Source set: Common
override fun drawLine(
brush: Brush,
start: Offset,
end: Offset,
strokeWidth: Float,
cap: StrokeCap,
pathEffect: PathEffect?,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawLine
Source set: Common
override fun drawLine(
color: Color,
start: Offset,
end: Offset,
strokeWidth: Float,
cap: StrokeCap,
pathEffect: PathEffect?,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawRect
Source set: Common
override fun drawRect(
brush: Brush,
topLeft: Offset,
size: Size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawRect
Source set: Common
override fun drawRect(
color: Color,
topLeft: Offset,
size: Size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawImage
Source set: Common
override fun drawImage(
image: ImageBitmap,
topLeft: Offset,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawImage
Source set: Common
override fun drawImage(
image: ImageBitmap,
srcOffset: IntOffset,
srcSize: IntSize,
dstOffset: IntOffset,
dstSize: IntSize,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
filterQuality: FilterQuality,
): Unit
drawRoundRect
Source set: Common
override fun drawRoundRect(
brush: Brush,
topLeft: Offset,
size: Size,
cornerRadius: CornerRadius,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawRoundRect
Source set: Common
override fun drawRoundRect(
color: Color,
topLeft: Offset,
size: Size,
cornerRadius: CornerRadius,
style: DrawStyle,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawCircle
Source set: Common
override fun drawCircle(
brush: Brush,
radius: Float,
center: Offset,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawCircle
Source set: Common
override fun drawCircle(
color: Color,
radius: Float,
center: Offset,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawOval
Source set: Common
override fun drawOval(
brush: Brush,
topLeft: Offset,
size: Size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawOval
Source set: Common
override fun drawOval(
color: Color,
topLeft: Offset,
size: Size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawArc
Source set: Common
override fun drawArc(
brush: Brush,
startAngle: Float,
sweepAngle: Float,
useCenter: Boolean,
topLeft: Offset,
size: Size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawArc
Source set: Common
override fun drawArc(
color: Color,
startAngle: Float,
sweepAngle: Float,
useCenter: Boolean,
topLeft: Offset,
size: Size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawPath
Source set: Common
override fun drawPath(
path: Path,
color: Color,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawPath
Source set: Common
override fun drawPath(
path: Path,
brush: Brush,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
style: DrawStyle,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawPoints
Source set: Common
override fun drawPoints(
points: List<Offset>,
pointMode: PointMode,
color: Color,
strokeWidth: Float,
cap: StrokeCap,
pathEffect: PathEffect?,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
drawPoints
Source set: Common
override fun drawPoints(
points: List<Offset>,
pointMode: PointMode,
brush: Brush,
strokeWidth: Float,
cap: StrokeCap,
pathEffect: PathEffect?,
@FloatRange(from = 0.0, to = 1.0) alpha: Float,
colorFilter: ColorFilter?,
blendMode: BlendMode,
): Unit
draw
Source set: Common
public inline fun draw(
density: Density,
layoutDirection: LayoutDirection,
canvas: Canvas,
size: Size,
block: DrawScope.() -> Unit,
)
Draws into the provided Canvas with the commands specified in the lambda with this DrawScope as a receiver
Parameters
| density | Density used to assist in conversions of density independent pixels to raw pixels to draw |
| layoutDirection | LayoutDirection of the layout being drawn in. |
| canvas | target canvas to render into |
| size | bounds relative to the current canvas translation in which the DrawScope should draw within |
| block | lambda that is called to issue drawing commands on this DrawScope |