Make Bitmap instance from Drawable

March 22, 2011
zemna@zemna.net
Category:

[code lang="java"]
// Create empty bitmap
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

// Create canvas to draw drawable
Canvas canvas = new Canvas(bitmap);

// Set bounds
d.setBounds(0, 0, 48, 48);

// Draw drawable to canvas
d.draw(canvas);

// Save canvas
canvas.save();
[/code]

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram