450 likes | 550 Views
Joshua Cuneo CS 1315 Spring 2008. pic. def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y)
E N D
Joshua Cuneo CS 1315 Spring 2008
pic def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
x = 1 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
x = 1 y = 1 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = x = 1 y = 1 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 1 y = 1 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 1 y = 1 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 1 y = 2 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 1 y = 2 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 1 y = 2 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 1 y = 2 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 1 y = 3 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 1 y = 3 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 1 y = 3 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 1 y = 3 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 2 y = 1 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 2 y = 1 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 2 y = 1 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 2 y = 1 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 2 y = 1 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = x = 2 y = 2 pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
fromPixel = toPixel = pic canvas def copyPicture(pic): canvas = makeEmptyPicture(getWidth(pic), getHeight(pic)) for x in range(1, getWidth(pic) + 1): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(canvas, x, y) setColor(toPixel, getColor(fromPixel)) writePictureTo(canvas, getMediaPath("copy.jpg"))
pic def mirrorLR(pic): for x in range(1, (getWidth(pic) + 1) / 2): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(pic, getWidth(pic)+1-x, y) setColor(toPixel, getColor(fromPixel))
pic def mirrorLR(pic): for x in range(1, (getWidth(pic) + 1) / 2): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(pic, getWidth(pic)+1-x, y) setColor(toPixel, getColor(fromPixel))
pic def mirrorLR(pic): for x in range(1, (getWidth(pic) + 1) / 2): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(pic, getWidth(pic)+1-x, y) setColor(toPixel, getColor(fromPixel))
pic def mirrorLR(pic): for x in range(1, (getWidth(pic) + 1) / 2): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(pic, getWidth(pic)+1-x, y) setColor(toPixel, getColor(fromPixel))
pic def mirrorLR(pic): for x in range(1. (getWidth(pic) + 1) / 2): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(pic, getWidth(pic)+1-x, y) setColor(toPixel, getColor(fromPixel))
pic def mirrorLR(pic): for x in range(1, (getWidth(pic) + 1) / 2): for y in range(1, getHeight(pic) + 1): fromPixel = getPixel(pic, x, y) toPixel = getPixel(pic, getWidth(pic)+1-x, y) setColor(toPixel, getColor(fromPixel))
pic def flipLR(pic): for x in range(1, (getWidth(pic) + 1) / 2): for y in range(1, getHeight(pic) + 1): leftPixel = getPixel(pic, x, y) leftColor = getColor(leftPixel) rightPixel = getPixel(pic, getWidth(pic)+1-x, y) rightColor = getColor(rightPixel) setColor(leftPixel, rightColor) setColor(rightPixel, leftColor)
pic def flipLR(pic): for x in range(1, (getWidth(pic) + 1) / 2): for y in range(1, getHeight(pic) + 1): leftPixel = getPixel(pic, x, y) leftColor = getColor(leftPixel) rightPixel = getPixel(pic, getWidth(pic)+1-x, y) rightColor = getColor(rightPixel) setColor(leftPixel, rightColor) setColor(rightPixel, leftColor)
pic def flipLR(pic): for x in range(1, (getWidth(pic) + 1) / 2): for y in range(1, getHeight(pic) + 1): leftPixel = getPixel(pic, x, y) leftColor = getColor(leftPixel) rightPixel = getPixel(pic, getWidth(pic)+1-x, y) rightColor = getColor(rightPixel) setColor(leftPixel, rightColor) setColor(rightPixel, leftColor)
pic def flipLR(pic): for x in range(1, (getWidth(pic) + 1) / 2): for y in range(1, getHeight(pic) + 1): leftPixel = getPixel(pic, x, y) leftColor = getColor(leftPixel) rightPixel = getPixel(pic, getWidth(pic)+1-x, y) rightColor = getColor(rightPixel) setColor(leftPixel, rightColor) setColor(rightPixel, leftColor)
pic def upsideDown(pic): for x in range(1, getWidth(pic) + 1): for y in range(1, (getHeight(pic) + 1) / 2): topPixel = getPixel(pic, x, y) topColor = getColor(topPixel) bottomPixel = getPixel(pic, x, getHeight(pic)+1-y) bottomColor = getColor(bottomPixel) setColor(topPixel, bottomColor) setColor(bottomPixel, topColor)
pic def upsideDown(pic): for x in range(1, getWidth(pic) + 1): for y in range(1, (getHeight(pic) + 1) / 2): topPixel = getPixel(pic, x, y) topColor = getColor(topPixel) bottomPixel = getPixel(pic, x, getHeight(pic)+1-y) bottomColor = getColor(bottomPixel) setColor(topPixel, bottomColor) setColor(bottomPixel, topColor)
pic def upsideDown(pic): for x in range(1, getWidth(pic) + 1): for y in range(1, (getHeight(pic) + 1) / 2): topPixel = getPixel(pic, x, y) topColor = getColor(topPixel) bottomPixel = getPixel(pic, x, getHeight(pic)+1-y) bottomColor = getColor(bottomPixel) setColor(topPixel, bottomColor) setColor(bottomPixel, topColor)
pic def upsideDown(pic): for x in range(1, getWidth(pic) + 1): for y in range(1, (getHeight(pic) + 1) / 2): topPixel = getPixel(pic, x, y) topColor = getColor(topPixel) bottomPixel = getPixel(pic, x, getHeight(pic)+1-y) bottomColor = getColor(bottomPixel) setColor(topPixel, bottomColor) setColor(bottomPixel, topColor)
pic def rot180(pic): show(pic) flipLR(pic) upsideDown(pic) repaint(pic)
pic def rot180(pic): show(pic) flipLR(pic) upsideDown(pic) repaint(pic)