2011-03-18 68 views

回答

8

像這樣的東西應該工作:

public Bitmap greyScaler(Bitmap b) {  
    Bitmap grayscaleBitmap = Bitmap.createBitmap(b.getWidth(), 
      b.getHeight(), 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(b, 0, 0, p); 
    return grayscaleBitmap; 
} 
+0

如果我想爲相同的效果設置相機屏幕? – 2011-10-12 04:42:31