Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

darkenPicture.py

# Open a picture file, showing it before and after some transformation.
def classDemo(fileName):
  picture = makePicture(fileName)
  show(picture)
  transformPicture(picture)
  repaint(picture)


# Transform a picture by changing all pixels in some way
def transformPicture(pic):
  for pixel in getPixels(pic):
    darken(pixel)

def darken(px):
  setRed(px, getRed(px) * 0.5)
  setGreen(px, getGreen(px) * 0.5)
  setBlue(px, getBlue(px) * 0.5)


Link to this Page