def _matrix(rotate=0, scale=1, rev=False):
"Create a 2x2 matrix (as a 4-tuple) to perform a scale transformation and a rotation"
sx, sy = (scale, scale) if type(scale) in (float, int) else scale
if rotate:
rotate *= DEG
c, s = cos(rotate), sin(rotate)
else: c, s = 1, 0
if rev: # Rotate before scaling
return sx * c, -sx * s, sy * s, sy * c
else: # Scale before rotating
return sx * c, -sy * s, sx * s, sy * c
评论列表
文章目录