The bitmap only contain the text so the width and the height of the bitmap are determined by text's width and height and some math. now when i rotate the text using
canvas.rotate(tilt - 180, bitmap.getWidth() / 2, bitmap.getHeight() / 2);
//the seek bar has a range of 0 to 360 so in order to get the right tilt i need to use (tilt - 180) instead of (tilt)
this is what happen
well obviously center of the rotation is wrong. I'v tried to use canvas.translate and the result have got better but they are yet not correct:
float actualTilt = Math.abs(tilt - 180);
actualTilt = (actualTilt >= 90 && actualTilt != 180) ? 90 - actualTilt % 90 : actualTilt;
if (actualTilt == 180) actualTilt = 0;
// by above statements i make sure actualTilt is less than 90 and it's values are 0,1,...89,90,89,88,...0
float v = actualTilt / 90;
canvas.translate((-(textWidth / 2) * v), (textHeight / 2) * v);
//i don't understand the above statement either but this is the result
if texts get longer the result get even worst