ContentDrawScope


Receiver scope for drawing content into a layout, where the content can be drawn between other canvas operations. If drawContent is not called, the contents of the layout will not be drawn.

Summary

Public functions

Unit

Causes child drawing operations to run during the onPaint lambda.

Cmn

Inherited functions

From androidx.compose.ui.unit.Density
open Int

Convert Dp to Int by rounding

Cmn
open Int

Convert Sp to Int by rounding

Cmn
open Dp

Convert an Int pixel value to Dp.

Cmn
open Dp

Convert a Float pixel value to a Dp

Cmn
open DpSize

Convert a Size to a DpSize.

Cmn
open Float

Convert Dp to pixels.

Cmn
open Float

Convert Sp to pixels.

Cmn
open Rect

Convert a DpRect to a Rect.

Cmn
open Size

Convert a DpSize to a Size.

Cmn
open TextUnit

Convert an Int pixel value to Sp.

Cmn
open TextUnit

Convert a Float pixel value to a Sp

Cmn
From androidx.compose.ui.graphics.drawscope.DrawScope
Unit
drawArc(
    brush: Brush,
    startAngle: Float,
    sweepAngle: Float,
    useCenter: Boolean,
    topLeft: Offset,
    size: Size,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draw an arc scaled to fit inside the given rectangle.

Cmn
Unit
drawArc(
    color: Color,
    startAngle: Float,
    sweepAngle: Float,
    useCenter: Boolean,
    topLeft: Offset,
    size: Size,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draw an arc scaled to fit inside the given rectangle.

Cmn
Unit
drawCircle(
    brush: Brush,
    radius: Float,
    center: Offset,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws a circle at the provided center coordinate and radius.

Cmn
Unit
drawCircle(
    color: Color,
    radius: Float,
    center: Offset,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws a circle at the provided center coordinate and radius.

Cmn
Unit
drawImage(
    image: ImageBitmap,
    topLeft: Offset,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

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

Cmn
open Unit
drawImage(
    image: ImageBitmap,
    srcOffset: IntOffset,
    srcSize: IntSize,
    dstOffset: IntOffset,
    dstSize: IntSize,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode,
    filterQuality: FilterQuality
)

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.

Cmn
Unit
drawLine(
    brush: Brush,
    start: Offset,
    end: Offset,
    strokeWidth: Float,
    cap: StrokeCap,
    pathEffect: PathEffect?,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws a line between the given points using the given paint.

Cmn
Unit
drawLine(
    color: Color,
    start: Offset,
    end: Offset,
    strokeWidth: Float,
    cap: StrokeCap,
    pathEffect: PathEffect?,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws a line between the given points using the given paint.

Cmn
Unit
drawOval(
    brush: Brush,
    topLeft: Offset,
    size: Size,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws an oval with the given offset and size.

Cmn
Unit
drawOval(
    color: Color,
    topLeft: Offset,
    size: Size,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws an oval with the given offset and size.

Cmn
Unit
drawPath(
    path: Path,
    brush: Brush,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws the given Path with the given Color.

Cmn
Unit
drawPath(
    path: Path,
    color: Color,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws the given Path with the given Color.

Cmn
Unit
drawPoints(
    points: List<Offset>,
    pointMode: PointMode,
    brush: Brush,
    strokeWidth: Float,
    cap: StrokeCap,
    pathEffect: PathEffect?,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws a sequence of points according to the given PointMode.

Cmn
Unit
drawPoints(
    points: List<Offset>,
    pointMode: PointMode,
    color: Color,
    strokeWidth: Float,
    cap: StrokeCap,
    pathEffect: PathEffect?,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws a sequence of points according to the given PointMode.

Cmn
Unit
drawRect(
    brush: Brush,
    topLeft: Offset,
    size: Size,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws a rectangle with the given offset and size.

Cmn
Unit
drawRect(
    color: Color,
    topLeft: Offset,
    size: Size,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws a rectangle with the given offset and size.

Cmn
Unit
drawRoundRect(
    brush: Brush,
    topLeft: Offset,
    size: Size,
    cornerRadius: CornerRadius,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    style: DrawStyle,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws a rounded rectangle with the provided size, offset and radii for the x and y axis respectively.

Cmn
Unit
drawRoundRect(
    color: Color,
    topLeft: Offset,
    size: Size,
    cornerRadius: CornerRadius,
    style: DrawStyle,
    alpha: @FloatRange(from = 0.0, to = 1.0) Float,
    colorFilter: ColorFilter?,
    blendMode: BlendMode
)

Draws a rounded rectangle with the given Paint.

Cmn
From androidx.compose.ui.unit.FontScaling
open Dp

Convert Sp to Dp.

Cmn
open TextUnit

Convert Dp to Sp.

Cmn

Inherited properties

From androidx.compose.ui.unit.Density
Float

The logical density of the display.

Cmn
From androidx.compose.ui.graphics.drawscope.DrawScope
open Offset

Center of the current bounds of the drawing environment

Cmn
DrawContext

The current DrawContext that contains the dependencies needed to create the drawing environment

Cmn
LayoutDirection

The layout direction of the layout being drawn in.

Cmn
open Size

Provides the dimensions of the current drawing environment

Cmn
From androidx.compose.ui.unit.FontScaling
Float

Current user preference for the scaling factor for fonts.

Cmn

Public functions

drawContent

fun drawContent(): Unit

Causes child drawing operations to run during the onPaint lambda.