1 / 45

Joshua Cuneo CS 1315 Spring 2008

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)

cruz
Download Presentation

Joshua Cuneo CS 1315 Spring 2008

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Joshua Cuneo CS 1315 Spring 2008

  2. 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"))

  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"))

  4. 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"))

  5. 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"))

  6. 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"))

  7. 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"))

  8. 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"))

  9. 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"))

  10. 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"))

  11. 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"))

  12. 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"))

  13. 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"))

  14. 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"))

  15. 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"))

  16. 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"))

  17. 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"))

  18. 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"))

  19. 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"))

  20. 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"))

  21. 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"))

  22. 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"))

  23. 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"))

  24. 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))

  25. 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))

  26. 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))

  27. 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))

  28. 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))

  29. 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))

  30. 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)

  31. 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)

  32. 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)

  33. 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)

  34. 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)

  35. 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)

  36. 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)

  37. 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)

  38. pic def rot180(pic): show(pic) flipLR(pic) upsideDown(pic) repaint(pic)

  39. pic def rot180(pic): show(pic) flipLR(pic) upsideDown(pic) repaint(pic)

More Related