由网友(挽梦亦清歌)分享简介:我想创建一个空的位图,并设置画布的位图,然后绘制任何形状的位图。I'd like to create an empty bitmap and set canvas to that bitmap and then draw any shape on bitmap.推荐答案这是可能比你想更简单:This is pr...
我想创建一个空的位图,并设置画布的位图,然后绘制任何形状的位图。
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
相关推荐
最新文章