The gradient starts from 3 o'clock - however I want it to start from 12.
int color1 = Color.RED;
int color2 = Color.BLUE;
int[] colors = {color1, color2};
Shader gradient = new SweepGradient(width / 2, height / 2, colors, null);
mArcPaint.setShader(gradient);
Any suggestions on how to rotate the start to 12? I tried with
Matrix matrix = new Matrix();
matrix.postRotate(270f);
gradient.setLocalMatrix(matrix);
but it did not work for me.
You need to specify Rotate pointX, pointY
In your case:
Matrix matrix = new Matrix();
matrix.postRotate(270f,width / 2, height / 2);
gradient.setLocalMatrix(matrix);
I use shader draw Circle for showing different case below