我有一个应用程序。这可以将图像视图中的图像从彩色更改为灰度。但是,我希望改变相反,灰度到彩色。你能帮助我吗? 我只是将代码着色为灰度:
try {
ImageView image = (ImageView) findViewById(R.id.imgView);
Bitmap bMap = mPhoto;
int width, height;
height = bMap.getHeight();
width = bMap.getWidth();
mPhoto = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(mPhoto);
Paint paint = new Paint();
ColorMatrix colorMatrix = new ColorMatrix();
colorMatrix.setSaturation(0);
ColorMatrixColorFilter colorMatrixFilter = new ColorMatrixColorFilter(colorMatrix);
paint.setColorFilter(colorMatrixFilter);
canvas.drawBitmap(bMap, 0, 0, paint);
image.setImageBitmap(mPhoto);
} catch (Exception e) { }