Daniel
In addition to providing the ability to draw into a specified bounded area, Painter provides a few high level mechanisms that consumers can use to configure how the content is drawn.
Painter
intrinsicSize
DrawScope.draw
draw
val painter = painterResource(R.drawable.marker) val size = painter.intrinsicSize val image = ImageBitmap(size.width.roundToInt(), size.height.roundToInt()) val canvas = Canvas(image) CanvasDrawScope().draw(LocalDensity.current, LocalLayoutDirection.current, canvas, size) { }
Nader Jawad
DrawScope
CanvasDrawScope().draw(LocalDensity.current, LocalLayoutDirection.current, canvas, size) { with(painter) { draw(size) // using default alpha and no colorfilter tinting }
with
A modern programming language that makes developers happier.