0PricingLogin
Jetpack Compose Academy · Lesson

DrawScope: Lines, Rects & Circles

Draw primitives onto the canvas.

Meet the Canvas

The Canvas Composable hands you a blank drawing surface. Inside it you paint pixels directly instead of stacking other Composables.

Canvas(modifier = Modifier.size(200.dp)) {
    // drawing goes here
}

Inside DrawScope

The lambda you pass to Canvas runs inside a DrawScope. That receiver gives you draw functions and the current size to work with.

All lessons in this course

  1. DrawScope: Lines, Rects & Circles
  2. Paths, Gradients & Blend Modes
  3. drawWithCache & Performance
  4. Build a Live Progress Ring
← Back to Jetpack Compose Academy