Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ribV(pict):
- #@param pict: Picture
- allPix = getPixels(pict) # prendo tutti i pixel
- w,h = getWidth(pict), getHeight(pict)
- mirrorPoint = w/2
- for j in range(h):
- for i in range(mirrorPoint):
- leftP = getPixel(pict,i,j) # pixel attuale
- rightP = getPixel(pict,(w-i-1),j) # pixel specchiato
- #swap tra pixel: attraverso lo scambio dei colori
- colorL,colorR = getColor(leftP),getColor(rightP)
- setColor(rightP, colorL)
- setColor(leftP, colorR)
- show(pict)
- def ribH(pict):
- #@param pict: Picture
- allPix = getPixels(pict) # prendo tutti i pixel
- w,h = getWidth(pict), getHeight(pict)
- mirrorPoint = h/2
- for i in range(w):
- for j in range(mirrorPoint):
- leftP = getPixel(pict,i,j) # pixel attuale
- rightP = getPixel(pict,i,(h-j-1)) # pixel specchiato
- #swap tra pixel: attraverso lo scambio dei colori
- colorL,colorR = getColor(leftP),getColor(rightP)
- setColor(rightP, colorL)
- setColor(leftP, colorR)
- show(pict)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement