0

I need to convert the rotated canvas image to drawable.

Conversely, there are many ways to convert from drawable to canvas, but I could not find what I wanted.

Is it not common to convert from Canvas to Drawable?

Should I use another method?

Please let me know, Thank you.

박진홍
  • 5
  • 5

2 Answers2

0

You can create a bitmap from your canvas as described in this asnwer, hen you can generate your BitmapDrawable this way new BitmapDrawable(getResources(), yourBitmap)

Jameido
  • 1,344
  • 1
  • 11
  • 21
0
View v = new View(this);
v.setDrawingCacheEnabled(true);
v.draw(canvas);
Bitmap b = v.getDrawingCache();
Drawable drawable = new BitmapDrawable(getResources(), b);
Johey
  • 275
  • 1
  • 8