我在网上看到了这段代码:
Bitmap grayscaleBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
Canvas c = new Canvas(grayscaleBitmap);
Paint p = new Paint();
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(cm);
p.setColorFilter(filter);
c.drawBitmap(bmp, 0, 0, p);
我的问题是: 1.'bmp'应该是我想要影响的颜色位图吗? 2.如何获得灰度的0-255值?
感谢。