private int rotateColor(int color, float rad) { float deg = rad * 180 / (float)Math.PI; int r = Color.GetRedComponent(color); int g = Color.GetGreenComponent(color); int b = Color.GetBlueComponent(color); ColorMatrix cm = new ColorMatrix(); ColorMatrix tmp = new ColorMatrix(); cm.SetRGB2YUV(); tmp.SetRotate(0, deg); cm.PostConcat(tmp); tmp.SetYUV2RGB(); cm.PostConcat(tmp); 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.GetAlphaComponent(color), pinToByte(ir), pinToByte(ig), pinToByte(ib))); }