DrawingCanvas-Library
DrawingCanvas-Library copied to clipboard
Saving the image.
Hi, thank you for this library it is very useful. I have one question, how can we create bitmap drawable from this drawing ? Thank you.
Hey, Gald to know that you found this helpful. This is the code for getting:
private fun getBitmapFromView(view: View):Bitmap{
val bitmapUsed = Bitmap.createBitmap(view.width,view.height,Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmapUsed)
canvas.drawColor(Color.WHITE) // adding a Background color, can be anything
view.draw(canvas)
return bitmapUsed
Here view can be a parent view to the library view. In my use case I had a parent Frame Layout.
PS: This is an old code and not sure if it works,