Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw elevation shadows to canvas

I use the code below to draw a view on to a bitmap/canvas.

Bitmap bitmap = Bitmap.createBitmap(
    viewGroup.getWidth (), viewGroup.getHeight (), Bitmap.Config.ARGB_8888);
viewGroup.draw(new Canvas(bitmap));

It works great, with one small problem: it doesn't draw elevation shadows. I assume that the shadows aren't drawn in the draw method. So where are they drawn and how can I transfer them to my canvas?

like image 342
RedHatter Avatar asked Jan 10 '16 21:01

RedHatter


1 Answers

No, shadows are drawn for Views at a lower level than that. You're using the software rendering pipeline which does not support shadows.

like image 80
Chris Banes Avatar answered Oct 18 '22 14:10

Chris Banes