HW2

Document Sample
HW2 Powered By Docstoc
					CS1315 Summer 2007 - Homework 2, Pictures (2% of your final grade)

                     Please Fill In the Information Below
Name                 <Type Your Name Here>
GTID                 <The one that starts with a letter not the number 9>
GTMail Address       <Your Mail Address>@mail.gatech.edu
Section              <Your Class Section>
Instructor           Cedric Stallworth
TA                   <Your TAs Name>


                                     Collaboration Statement
     (select the one that applies to your work on this assignment, delete the other one)
"I worked on the homework assignment alone, using only course materials."
"I worked on this homework with
<give the names of the people you worked with>,
used solutions or partial solutions provided by
<name the people or other sources>,
 and referred to
<cite any texts, web sites, or other materials not provided as course materials for CS1315>.”
Keep in mind that you are only allowed to work with other students currently in CS1315. Do give
credit though using the collaboration statement. The professors and the current TA's should be
treated as course material and need not be listed in the collaboration statement.

If you seek help from someone outside of the course (ie. Not the professor or TA), you MUST
receive approval from the professor.
If you do not have a collaboration statement on your assignment, you will receive a grade of zero
for this assignment.


                                     Homework Turn In Policy
For the chance to receive full credit, turn this homework in as HW1 before Monday, June 11,
2007 at 11:45PM.
For a chance to receive 80% credit, turn this homework in as HW1Late between Monday, June
11, 2007 at 11:45PM and Tuesday, June 12 at 11:45PM. Also email your TA to notify him/her that
your homework was late.
Anything turned in after Tuesday, June 12 at 11:45PM will NOT be accepted and a grade of zero
will be given for this assignment.
Concepts
Answer these questions by typing your answers in the spaces provided.

In your own words, tell what these functions do with respect to colors.

  1) makeColor( R, G, B)


  2) pickAColor()


  3) distance()


In your own words, tell what these functions do with respect to pixels.

  1) getColor( pixel )

  2) setColor( pixel )

  3) getRed( pixel )

  4) setRed( pixel )

  5) getGreen( pixel )

  6) setGreen( pixel )

  7) getBlue( pixel )

  8) setBlue( pixel )

  9) getX( pixel )

  10) getY( pixel )


In your own words, tell what these functions do with respect to pictures.

  1) makePicture( width, height )

  2) makeEmptyPicture( width, height )

  3) getHeight( picture )

  4) getWidth( picture )

  5) getPixel( picture, x, y )

  6) getPixels( picture )

  7) show( picture )

  8) repaint( picture )

  9) writePictureTo( picture, file )

  10) openPictureTool( picture )
  11) setAllPixelsToAColor( picture, color )

In your own words, tell what the functions do with respect to drawing graphics onto pictures.

  1)   addRect(color, x, y, width, height)

  2)   addRect(color, x, y, width, height)

  3)   addOval(color, x, y, width, height)

  4)   addOvalFilled(color, x, y, width, height)

  5)   addArc(color, x, y, width, height, startangle, arcangle)

  6)   addArcFilled(color, x, y, width, height, startangle, arcangle)

  7)   addLine(color, x1, y1, x2, y2)

  8)   addText(color, x, y, string)

  9)   makeStyle(font, emphasis, size)

  10) addTextWithStyle(color, x, y, string, style)
Programming
Answer these problems by creating three .py files named HW2prob1.py, HW2prob2.py,
HW2prob3.py that contain your programmed solutions to the following three function
specifications. Attach your .py file to your homework submission. (Note: at no time are you to use
the JES’ built in duplicatePicture() or copyInto() functions)

Program 1
Download the attached file , “simpson_scramble.jpg”, and write a program named descramble()
that will take in the file name of the scrambled picture and show the unscrambled picture. Your
output should look like the attached file, “simpsons.jpg”. Your TA will run your program by
loading it and typing descramble(“simpson_scramble.jpg”) on the command line. The picture
that is generated by your function will be evaluated for correctness. Only turn in a file named
HW2prob1.py containing your function. Your TA has a copy of the original scrambled picture.

This assignment demonstrates your ability to:
         crop and copy from one image to another
         flip an image vertically and horizontally
         take the negative of an image
         change a targeted color in an image


Program 2
Download the attached file, “museum.jpg” and write a program named curator() that takes in no
parameters but shows an image with the empty picture frames filled in just like the ones in the
attached image “full_museum.jpg”. Your program should modify the attached images to achieve
the desired results. Your TA will run your program by loading it and typing curator() on the
command line. The picture that is generated by your function will be evaluated for correctness.
Only turn in a file named HW2prob2.py containing your function. Your TA has a copy of the
original image files.

This assignment demonstrates your ability to:
         apply the grayscale effect
         enlarge and shrink an image
         blur an image
         brighten an image
         apply the chromakey effect
         blend two images
         change the hue of an image


Program 3
Write a program named makeKenny() that takes in no parameters and shows a replica of the
image shown in the attached file named “kenny_was_here.jpg”. You are to use the graphics
primitives discussed in class. Be as exact as you can. Your TA will run your program by loading
it and typing makeKenny() on the command line. The picture that is generated by your function
will be evaluated for correctness. Only turn in a file named HW2prob3.py containing your function.

This assignment demonstrates your ability to use the following graphic primitives:
      addRect(color, x, y, width, height)
      addRect(color, x, y, width, height)
      addOval(color, x, y, width, height)
      addOvalFilled(color, x, y, width, height)
      addArc(color, x, y, width, height, startangle, arcangle)
      addArcFilled(color, x, y, width, height, startangle, arcangle)
      makeStyle(font, emphasis, size)
      addTextWithStyle(color, x, y, string, style)

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:5
posted:12/31/2011
language:
pages:4