Code example for ColorMatrix

Methods: getArraysetsetSaturation

0
    	canvas.drawBitmap(canvas_bitmap, 0, 0, new Paint());
    	 
    	if (filterName.equalsIgnoreCase("stark")) {
 
			Paint spaint = new Paint();
			ColorMatrix scm = new ColorMatrix();
 
			scm.setSaturation(0);
			final float m[] = scm.getArray();
			final float c = 1;
			scm.set(new float[] { m[0] * c, m[1] * c, m[2] * c, m[3] * c, m[4] * c + 15, m[5] * c, m[6] * c,
					m[7] * c, m[8] * c, m[9] * c + 8, m[10] * c, m[11] * c, m[12] * c, m[13] * c, m[14] * c + 10,
					m[15], m[16], m[17], m[18], m[19] });
 
			spaint.setColorFilter(new ColorMatrixColorFilter(scm));
			Matrix smatrix = new Matrix();
			canvas.drawBitmap(canvas_bitmap, smatrix, spaint);
 
			cm.set(new float[] { 1, 0, 0, 0, -90, 0, 1, 0, 0, -90, 0, 0, 1, 0, -90, 0, 0, 0, 1, 0 });
 
Stop searching for code, let great code find you!  Add Codota to your java IDE