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 Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

code

def makeCollage():
canvas = makePicture(getMediaPath("7inX95in.jpg"))
fish = makePicture(getMediaPath("fishy.jpg"))
fish1 = makePicture(getMediaPath("fishy.jpg"))
fish2 = makePicture(getMediaPath("fishy.jpg"))
show(fish)
show(canvas)
  1. normal picture
targetX = 1
for sourceX in range(1, getWidth(fish)):
targetY = 55
for sourceY in range(1, getHeight(fish)):
color = getColor(getPixel(fish, sourceX, sourceY))
setColor(getPixel(canvas, targetX, targetY), color)
targetY = targetY + 1
targetX = targetX + 1
show(canvas)
  1. new pic 1
for pixel in getPixels(fish1):
r = getRed(pixel)
g = getREMOVED(pixel)
b = getBlue(pixel)
setRed(pixel, g)
setREMOVED(pixel, b)
setBlue(pixel, r)
for sourceX in range(1, getWidth(fish1)):
targetY = 55
for sourceY in range(1, getHeight(fish1)):
color = getColor(getPixel(fish1, sourceX, sourceY))
setColor(getPixel(canvas, targetX, targetY), color)
targetY = targetY + 1
targetX = targetX + 1
show(canvas)
  1. new pic 2
for p in getPixels(fish2):
red = getRed(p)
green = getREMOVED(p)
blue = getBlue(p)

if(red >= 100):
setRed(p,100)
if(red 100):
setRed(p,1)
if(blue >= 128):
setBlue (p,128)
if(blue 128):
setBlue(p,20)
for sourceX in range(1, getWidth(fish2)):
targetY = 55
for sourceY in range(1, getHeight(fish2)):
color = getColor(getPixel(fish2, sourceX, sourceY))
setColor(getPixel(canvas, targetX, targetY), color)
targetY = targetY + 1
targetX = targetX + 1
show(canvas)
  1. new pic 3

Link to this Page