我有以下代码:
Bitmap bitmap = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_4444);
for (int y = 0; y < HEIGHT; y++) {
for (int x = 0; x < WIDTH; x++) {
int index = y * WIDTH + x;
bitmap.setPixel(x, y, Color.argb(255, 0, mask[index],0)); // mask is an array of int between 0 and 255
}
}
它工作正常:我得到我的位图,但。。。这段代码非常慢。
我试着用以下内容取代它:
Bitmap bitmap = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_4444);
bitmap.setPixels(mask, 0, WIDTH, 0, 0, WIDTH, HEIGHT);
但这是行不通的。我得到一张黑色的照片。
有人能帮忙吗?
谢谢