28
Programing in JES (Jython) Kayla Dean & Patrick Baker

Programing in JES ( Jython )

  • Upload
    bono

  • View
    116

  • Download
    2

Embed Size (px)

DESCRIPTION

Programing in JES ( Jython ). Kayla Dean & Patrick Baker. Original Picture. Sunset. def sunset(filename): filename = makePicture ( pickAFile ()) explore(filename) for p in getPixels (filename): value = getBlue (p) setBlue (p, value * 0.7) value = getGreen (p) - PowerPoint PPT Presentation

Citation preview

Page 1: Programing  in JES ( Jython )

Programing in JES(Jython)

Kayla Dean&

Patrick Baker

Page 2: Programing  in JES ( Jython )

Original Picture

Page 3: Programing  in JES ( Jython )

Sunsetdef sunset(filename): filename =

makePicture(pickAFile()) explore(filename) for p in getPixels(filename): value = getBlue(p) setBlue(p, value * 0.7) value = getGreen(p) setGreen(p, value * 0.7) explore(filename)

Page 4: Programing  in JES ( Jython )

Sunset Pict

Page 5: Programing  in JES ( Jython )

Grayscaledef grayscale(filename): filename =

makePicture(pickAFile()) explore(filename) for p in getPixels(filename): sum = getRed(p) + getGreen(p)

+ getBlue(p) intensity = sum / 3 setColor(p, makeColor(intensity,

intensity, intensity)) explore(filename)

Page 6: Programing  in JES ( Jython )

Grayscale Pict

Page 7: Programing  in JES ( Jython )

Mirror Verticaldef mirrorVertical(filename): filename = makePicture(pickAFile()) explore(filename) mirrorPoint=getWidth(filename)/2 width=getWidth(filename) for y in range(0,

getHeight(filename)): for x in range(0, mirrorPoint ): leftPixel=getPixel (filename, x, y) rightPixel=getPixel (filename,

width-x-1,y) color=getColor(leftPixel) setColor(rightPixel ,color) explore(filename)

Page 8: Programing  in JES ( Jython )

Mirror Vertical Pict

Page 9: Programing  in JES ( Jython )

Mirror Horizontaldef mirrorHorizontal(filename): filename = makePicture(pickAFile()) explore(filename) mirrorPoint=getHeight(filename)/2 height=getHeight(filename) for x in range(0, getWidth(filename)): for y in range(0, mirrorPoint ): topPixel=getPixel (filename, x, y) bottomPixel=getPixel(filename,

x,height-y-1) color=getColor(topPixel) setColor(bottomPixel ,color) explore(filename)

Page 10: Programing  in JES ( Jython )

Mirror Horizontal Pict

Page 11: Programing  in JES ( Jython )

Line Detectdef lineDetect(filename): filename = makePicture(pickAFile()) for p in getPixels(filename): newRed = getRed(p)*0.229 newGreen = getGreen(p)*0.587 newBlue = getBlue(p)*0.114 luminance = newRed+newGreen+newBlue setColor(p,makeColor(luminance,luminance,luminance)) orig = (filename) makeBw = (filename) sketchLine = getWidth(orig)/2 for x in range(0,sketchLine): for y in range(0,getHeight(orig)-1): here=getPixel(makeBw,x,y) down=getPixel(orig,x,y+1) right=getPixel(orig,x+1,y) hereL=(getRed(here)+getGreen(here)+getBlue(here))/3 downL=(getRed(down)+getGreen(down)+getBlue(down))/3 rightL=(getRed(right)+getGreen(right)+getBlue(right))/3 if abs(hereL-downL)>=10 and abs(hereL-rightL)>=10: setColor(here,black) if abs(hereL-downL)<=10 and abs(hereL-rightL)<=10: setColor(here,white) show(makeBw) return makeBw

Page 12: Programing  in JES ( Jython )

Line Detect Pict

Page 13: Programing  in JES ( Jython )

Negate Bluedef negateblue(filename): filename =

makePicture(pickAFile()) for p in getPixels(filename): setBlue(p,0) show(filename)

Page 14: Programing  in JES ( Jython )

Negate Blue Pict

Page 15: Programing  in JES ( Jython )

Negativedef negative(filename): filename =

makePicture(pickAFile()) for px in getPixels(filename): red = getRed(px) green = getGreen(px) blue = getBlue(px) negColor = makeColor( 255-red,

255-green, 255-blue) setColor(px, negColor) explore(filename)

Page 16: Programing  in JES ( Jython )

Negative Pict

Page 17: Programing  in JES ( Jython )

Negate Greendef negategreen(filename): filename =

makePicture(pickAFile()) for p in getPixels(filename): setGreen(p,0) show(filename)

Page 18: Programing  in JES ( Jython )

Negate Green Pict

Page 19: Programing  in JES ( Jython )

Negate Reddef negatered(filename): filename =

makePicture(pickAFile()) for p in getPixels(filename): setRed(p,0) show(filename)

Page 20: Programing  in JES ( Jython )

Negate Red Pict

Page 21: Programing  in JES ( Jython )

Make Greendef green(filename): filename =

makePicture(pickAFile()) for p in getPixels(filename): setRed(p,0) setBlue(p,0) show(filename)

Page 22: Programing  in JES ( Jython )

Make Green Pict

Page 23: Programing  in JES ( Jython )

Make Reddef red(filename): filename =

makePicture(pickAFile()) for p in getPixels(filename): setGreen(p,0) setBlue(p,0) show(filename)

Page 24: Programing  in JES ( Jython )

Make Red Pict

Page 25: Programing  in JES ( Jython )

Make Bluedef blue(filename): filename =

makePicture(pickAFile()) for p in getPixels(filename): setRed(p,0) setGreen(p,0) show(filename)

Page 26: Programing  in JES ( Jython )

Make Blue Pict

Page 27: Programing  in JES ( Jython )

Other Codesdef filename():

filename=makePicture(pickAFile())

def sketchline(): sketchline = getWidth(filename)/2