Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. def mirroringVerticale():
  2.     pict=makePicture(pickAFile())
  3.     width=getWidth(pict)
  4.     mirrorPoint=width/2
  5.     for y in range(getHeight(pict)):
  6.        for x in range(mirrorPoint):
  7.           leftPixel=getPixel(pict, x, y)
  8.           rightPixel=getPixel(pict, width-x-1, y)
  9.           color=getColor(leftPixel)
  10.           setColor(rightPixel, color)
  11.     repaint(pict)
  12.  
  13. def mirroringOrizzontale():
  14.    pict=makePicture(pickAFile())
  15.    height=getHeight(pict)
  16.    mirrorPoint=height/2
  17.    for x in range(getWidth(pict)):
  18.       for y in range(mirrorPoint):
  19.          uppixel=getPixel(pict, x, y)
  20.          downpixel=getPixel(pict, x, height-y-1)
  21.          color=getColor(uppixel)
  22.          setColor(downpixel, color)
  23.    repaint(pict)
  24.  
  25. def speculare():
  26.    pict=makePicture(pickAFile())
  27.    h=getHeight(pict)
  28.    w=getWidth(pict)
  29.    for x in range(w/2):
  30.       for y in range(h):
  31.          pixel=getPixel(pict, x, y)
  32.          pixel2=getPixel(pict, w-x-1, y)
  33.          color=getColor(pixel)
  34.          color2=getColor(pixel2)
  35.          setColor(pixel2, color)
  36.          setColor(pixel, color2)    
  37.    repaint(pict)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement