我需要编写一个函数 spin(pic,x) 它将拍照并逆时针旋转 90 度 X 次。我在一个函数中只有 90 度顺时针旋转:
def rotate(pic):
width = getWidth(pic)
height = getHeight(pic)
new = makeEmptyPicture(height,width)
tarX = 0
for x in range(0,width):
tarY = 0
for y in range(0,height):
p = getPixel(pic,x,y)
color = getColor(p)
setColor(getPixel(new,tarY,width-tarX-1),color)
tarY = tarY + 1
tarX = tarX +1
show(new)
return new
..但我不知道如何编写一个旋转X次的函数。有谁知道我该怎么做?