Code example for ColorMatrix

Methods: set

0
		// black and white 
 
		int width = bmp.getWidth();
		int height = bmp.getHeight();
 
		ColorMatrix matrix = new ColorMatrix();
		float[] src = { 0.308F, 0.609F, 0.082F, 0, 0, 0.308F, 0.609F, 0.082F,
				0, 0, 0.308F, 0.609F, 0.082F, 0, 0, 0, 0, 0, 1, 0 }; 
		matrix.set(src);
		ColorMatrixColorFilter filter = new ColorMatrixColorFilter(matrix);
		Paint p = new Paint();
		p.setColorFilter(filter);
		Bitmap colorBmp = Bitmap.createBitmap(width, height, bmp.getConfig());
		Canvas c = new Canvas(colorBmp);
		c.drawBitmap(bmp, 0, 0, p);
		return colorBmp;
	} 
 
	public static Bitmap rotateBmp(Bitmap bmp, int angle) {
 
		int width = bmp.getWidth();