Wednesday, July 19, 2006

11

today we did modifying pieces of an image, copying, and mirroring

before&after pictures





here is the code for it:
def mirrorVertical(pic):
mid=getWidth(pic)/2
for x in range(1, mid + 1):
for y in range(1,getHeight(pic) + 1):
basePix=getPixel(pic, x,y)
changePix=getPixel(pic, getWidth(pic)-x, y)
setColor(changePix, getColor(basePix))

def mirrorHorizontal(pic):
mid=getHeight(pic)/2
for x in range(1,getWidth(pic) + 1):
for y in range(1, mid+1):
basePix=getPixel(pic, x,y)
changePix=getPixel(pic, x, getHeight(pic)-y)
setColor(changePix, getColor(basePix))

def doIt():
file=pickAFile()
pic=makePicture(file)
mirror(pic, 1)
show(pic)

def mirror(pic, axis):
if axis==1:
mirrorHorizontal(pic)
if axis==2:
mirrorVertical(pic)


Comments:
U ROCK! saved my life cuz i do NOT understand ANY of this!
 
i'm pretty sure i don't beat Korean girls...i'm not sure about chinese girls >:)
 
thanks very much; i love you forever for putting on the code :)
 
Really amazing! Useful information. All the best.
»
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?