Code example for ColorMatrix

Methods: getArray, postConcat, setRGB2YUV

0
			float deg = rad * 180 / 3.1415927f;
			int r = Color.red(color);
			int g = Color.green(color);
			int b = Color.blue(color);
 
			ColorMatrix cm = new ColorMatrix();
			ColorMatrix tmp = new ColorMatrix();
 
			cm.setRGB2YUV();
			tmp.setRotate(0, deg);
			cm.postConcat(tmp);
			tmp.setYUV2RGB();
			cm.postConcat(tmp);
 
			final float[] a = cm.getArray();
 
			int ir = floatToByte(a[0] * r + a[1] * g + a[2] * b);
			int ig = floatToByte(a[5] * r + a[6] * g + a[7] * b);
			int ib = floatToByte(a[10] * r + a[11] * g + a[12] * b);
 
			return Color.argb(Color.alpha(color), pinToByte(ir), pinToByte(ig),