Mini Lab 4 Rotating Pictures

 

Function:

def copyCounterClockwise(picture):
...canvas = makeEmptyPicture(getHeight(picture),getWidth(picture))
...# The picture on the canvas will be filled in from bottom
...# to top, with the left-most column of the picture copied to the bottom
...# row of the canvas. The upper-left corner of the picture gets copied
...# to the lower-left corner of the canvas.
...targetY = getWidth(picture)
...for sourceX in range(1, getWidth(picture)+1):
......targetX = 1
......for sourceY in range(1, getHeight(picture)+1):
.........color = getColor(getPixel(picture, sourceX, sourceY))
.........setColor(getPixel(canvas, targetX, targetY), color)
......targetX = targetX + 1
...targetY = targetY - 1

...# Display the results and return the canvas
...show(canvas)
...return canvas