PaNaVTEC / DrawableView

A view that allows to paint and saves the result as a bitmap
http://panavtec.me
Apache License 2.0
585 stars 99 forks source link

Can we set a bitmap as the canvas background? #19

Open ankitbatra11 opened 7 years ago

ankitbatra11 commented 7 years ago

Sorry, did not have much time now to go through but does it provide a method to set an image as the canvas background so we can draw over that image?

liuyangping commented 5 years ago

I have a solution.

  1. You can set background like this: drawableView.setBackground(new BitmapDrawable(bitmap));
  2. Paint others on the background.
  3. Then obtain bitmap call: drawableView.obtainBitmap(bitmap.copy(Bitmap.Config.ARGB_8888, true)); Note: If you want clear the canvas, you can call: drawableView.setBackground(null); drawableView.clear(); Hope to help you.