Code example for ColorMatrix

Methods: set

0
		width = bmpOriginal.getWidth();
		Bitmap bmpGrayscale = Bitmap.createBitmap(width, height,
				Bitmap.Config.RGB_565);
		Canvas c = new Canvas(bmpGrayscale);
		Paint paint = new Paint();
		ColorMatrix cm1 = new ColorMatrix();
		float scale1 = scaleonly + 1.f;
		cm1.set(new float[] {
			scale1, 0, 0, 0, 0,
			0, scale1, 0, 0, 0,
			0, 0, scale1, 0, 0,
			0, 0, 0, 1, 0 }); 
		ColorMatrixColorFilter f1 = new ColorMatrixColorFilter(cm1);
		paint.setColorFilter(f1);
		c.drawBitmap(bmpOriginal, 0, 0, paint);
		ColorMatrix cm2 = new ColorMatrix();
		float scale2 = scaletrans + 1.f;
		float translate = (-.5f * scale2 + .5f) * 255.f;
		cm2.set(new float[] {
			scale2, 0, 0, 0, translate,
Connect your IDE to all the code out there  Get Codota for Java