-
public final class CanvasKt
-
-
Method Summary
Modifier and Type Method Description final static UnitdrawToBitmap(Bitmap bitmap, Density density, Size size, Function1<DrawScope, Unit> onDraw)Render an element normally drawn within a Compose Canvas into a Bitmap. final static ResourceBuilders.ImageResourcecanvasToImageResource(Size size, Density density, Function1<DrawScope, Unit> onDraw)Render an element normally drawn within a Compose Canvas into a Bitmap and then convert to a Tiles ImageResource. -
-
Method Detail
-
drawToBitmap
final static Unit drawToBitmap(Bitmap bitmap, Density density, Size size, Function1<DrawScope, Unit> onDraw)
Render an element normally drawn within a Compose Canvas into a Bitmap.
This allows shared elements between the app and tiles.
- Parameters:
bitmap- the destination to draw into.density- the compose density to use when drawing.size- bounds relative to the current canvas to draw within.onDraw- the render logic.
-
canvasToImageResource
@RequiresApi(value = 26) final static ResourceBuilders.ImageResource canvasToImageResource(Size size, Density density, Function1<DrawScope, Unit> onDraw)
Render an element normally drawn within a Compose Canvas into a Bitmap and then convert to a Tiles ImageResource.
- Parameters:
size- the size of the bitmap desired in pixels.density- the compose density to use when drawing.onDraw- the render logic.
-
-
-
-