private Bitmap drawCupBitmap(Bitmap bitmap, int desColor) {
int w = bitmap.getWidth();
int h = bitmap.getHeight();
int array[] = new int[w * h];
int n = 0;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
int color = bitmap.getPixel(j, i);
if (color != 0) {
color = desColor;
}
array[n] = color;
n++;
}
}
return bitmap = Bitmap.createBitmap(array, w, h,
Bitmap.Config.ARGB_8888);
}
网友评论