创建一个空的位图和图纸虽然Android的画布 [英] creating an empty bitmap and drawing though canvas in android
本文介绍了创建一个空的位图和图纸虽然Android的画布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个空的位图,并设置画布的位图,然后绘制任何形状的位图。
I'd like to create an empty bitmap and set canvas to that bitmap and then draw any shape on bitmap.
推荐答案
这是可能比你想更简单:
This is probably more simple than you're thinking:
int w = WIDTH_PX, h = HEIGHT_PX;
Bitmap.Config conf = Bitmap.Config.ARGB_8888; // see other conf types
Bitmap bmp = Bitmap.createBitmap(w, h, conf); // this creates a MUTABLE bitmap
Canvas canvas = new Canvas(bmp);
// ready to draw on that bitmap through that canvas
下面是一个系列教程,我的话题发现:用帆布系列<绘图/一>
Here's a series of tutorial I've found on the topic: Drawing with Canvas Series
这篇关于创建一个空的位图和图纸虽然Android的画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文