看类Graphics2D的文档:
public abstract void rotate(double theta)
Concatenates the current Graphics2D Transform with a rotation transform. Subsequent rendering is rotated by the specified radians relative to the previous origin. This is equivalent to calling transform(R), where R is an AffineTransform represented by the following matrix:
[ cos(theta) -sin(theta) 0 ]
[ sin(theta) cos(theta) 0 ]
[ 0 0 1 ]
Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis.
Parameters:
theta - the angle of rotation in radians
public abstract void rotate(double theta)
Concatenates the current Graphics2D Transform with a rotation transform. Subsequent rendering is rotated by the specified radians relative to the previous origin. This is equivalent to calling transform(R), where R is an AffineTransform represented by the following matrix:
[ cos(theta) -sin(theta) 0 ]
[ sin(theta) cos(theta) 0 ]
[ 0 0 1 ]
Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis.
Parameters:
theta - the angle of rotation in radians
选择只需要
[ cosx -sinx]
[ sinx cosx]
即可,默认中心点为width/2, height/2
你可以自己随便定义的!