Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def horizontalFlip():
- pict = makePicture(pickAFile())
- width = getWidth(pict)
- height = getHeight(pict)
- pict2 = makeEmptyPicture(width,height)
- for y in range(0,height):
- for x in range(0,width):
- pix1 = getPixel(pict,x,y)
- pix2 = getPixel(pict2,width-x-1,y)
- c = getColor(pix1)
- setColor(pix2,c)
- show(pict2)
- def verticalFlip():
- pict = makePicture(pickAFile())
- width = getWidth(pict)
- height = getHeight(pict)
- pict2 = makeEmptyPicture(width,height)
- for y in range(0,height):
- for x in range(0,width):
- pix1 = getPixel(pict,x,y)
- pix2 = getPixel(pict2,x,height-y-1)
- c = getColor(pix1)
- setColor(pix2,c)
- show(pict2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement