0

我有一个应用程序。这可以将图像视图中的图片从彩色更改为灰度。但是,我想改变相反的,灰度到彩色。你能帮助我吗?我只有代码 Colored to Greyscale :

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) { }
4

0 回答 0