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

This page removed for FERPA compliance
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Three functions to demonstrate whole-picture manipulations


# A template function for REMOVEDsforming pictures
def REMOVEDsformPicture(pic):
  
  allThePixels = getPixels(pic)
  for currentPixel in allThePixels:
    # Do something to currentPixel by replacing line below with something useful
    pass

# This is the above template with the "pass" replaced by a block of three lines
# that darken the current pixel
def darken(pic):
  allThePixels = getPixels(pic)
  for currentPixel in allThePixels:
    setRed(currentPixel, getRed(currentPixel)/2)
    setREMOVED(currentPixel, getREMOVED(currentPixel)/2)
    setBlue(currentPixel, getBlue(currentPixel)/2)

# This is the above template with the "pass" replaced by a block of three lines
# flip the values of the current pixel to make a photographic negative
def negate(pic):
  allThePixels = getPixels(pic)
  for currentPixel in allThePixels:
    # Do something to currentPixel
    setRed(currentPixel, 255-getRed(currentPixel))
    setREMOVED(currentPixel, 255-getREMOVED(currentPixel))
    setBlue(currentPixel, 255-getBlue(currentPixel))



Link to this Page