Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. def ribaltamentoOrizz(pict):
  2. #@param pict: picture
  3.   widht=getWidth(pict)
  4.   mirror=widht/2
  5.   for x in range (0,mirror):
  6.     for y in range (0,getHeight(pict)):
  7.       leftPixel=getPixel(pict,x,y)
  8.       rightPixel=getPixel(pict,widht-1-x,y)
  9.       swap1=getColor(leftPixel)
  10.       swap2=getColor(rightPixel)
  11.       setColor(leftPixel,swap2)
  12.       setColor(rightPixel,swap1)  
  13.  
  14.  
  15. def ribaltamentoVert(pict):
  16. #@param pict: picture
  17.   height=getHeight(pict)
  18.   mirror=height/2
  19.   for x in range (0,getWidth(pict)):
  20.     for y in range (0,mirror):
  21.       topPixel=getPixel(pict,x,y)
  22.       bottomPixel=getPixel(pict,x,height-1-y)
  23.       swap1=getColor(topPixel)
  24.       swap2=getColor(bottomPixel)
  25.       setColor(topPixel,swap2)
  26.       setColor(bottomPixel,swap1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement