Advertisement
MaxDvc

func_verticalFlip_horizontalFlip

Oct 17th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. def horizontalFlip():
  2.   pict = makePicture(pickAFile())
  3.   width = getWidth(pict)
  4.   height = getHeight(pict)
  5.   pict2 = makeEmptyPicture(width,height)
  6.   for y in range(0,height):
  7.     for x in range(0,width):
  8.       pix1 = getPixel(pict,x,y)
  9.       pix2 = getPixel(pict2,width-x-1,y)
  10.       c = getColor(pix1)
  11.       setColor(pix2,c)
  12.   show(pict2)
  13.  
  14. def verticalFlip():
  15.   pict = makePicture(pickAFile())
  16.   width = getWidth(pict)
  17.   height = getHeight(pict)
  18.   pict2 = makeEmptyPicture(width,height)
  19.   for y in range(0,height):
  20.     for x in range(0,width):
  21.       pix1 = getPixel(pict,x,y)
  22.       pix2 = getPixel(pict2,x,height-y-1)
  23.       c = getColor(pix1)
  24.       setColor(pix2,c)
  25.   show(pict2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement