Package 

Class CanvasKt

    • Method Summary

      Modifier and Type Method Description
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.