Homework #2: Picture Collage

Objectives

The Oxford English Dictionary has the following definition for collage: "An abstract form of art in which photographs, pieces of paper, newspaper cuttings, string, etc., are placed in juxtaposition and glued to the pictorial surface; such a work of art."

The objectives of this assignment are to have you write a Java program that will create a collage of pictures. Your collage will be made by copying at least 3 pictures onto a blank canvas. You must use at least 3 different pictures. To create your collage, you must use different image methods from chapter 4 and 5 like negate, grayscale, clear blue (red, green), keep blue (red, green), scale, rotate, etc. You should then copy each resulting picture to a blank picture and finally mirror the results (pick a direction that gives interesting results).

Problem

  1. Choose a theme for your collage. A theme could be a country you've traveled to (or that you are from), pet(s) you may have, movies you enjoy, etc. This theme will help you to focus your collage. You may find pictures about your theme by doing an image search on Google.
  2. Define and write methods for the Picture class. You should already have the methods in Chapter 4 as part of your Picture class. At a minimum, you should include these methods:
    1. The methods from chapter 5 that you want to use in this assignment.
    2. Add a drawBorder() method that draws a black border around the inside of the picture that the method is invoked on.
    3. Add a drawFancyBorder() method to draw a fancy border around the inside of the picture. You are to define the way in which the border is "fancy". Define the method to take at least one parameter; you need to decide what the parameter should be. This method should work for any picture!
    4. Add embedImage() method to the Picture class, which takes four arguments: (1) a Picture that is a source image, (2) an int that is an x-coordinate, (3) an int that is an y-coordinate, and (4) an int that is the width of a square. The method embedImage() copies a square of that width from the source image, beginning at (x,y), into the lower righthand corner of the receiving image. It also draws a black border around the inset image that is three pixels wide. For example, I embedded a 200x200 square beginning at (170,59) from this picture taken at CSULB into the mediasources' butterfly2 image and produced this resultant image.
  3. Write a Java program (e.g. one with a class method named main()) that creates your collage. The Java code in this file will call the Picture methods to make changes to your pictures and then start copying them to a blank canvas (e.g. blank Picture object). This program should make at least one call to the embedImage() method that you wrote in the section above. You should apply the drawFancyBorder() to the final picture that your Java program generates. Remember to write the final picture object to a file as you will be turning in this picture as part of your assignment.

Deliverables

You must submit the Java code in printed form and electornically -- see below. To submit your code electronically, send via e-mail the files Picture.java, your Java main program (call it what you like, as long as it's a good name), and the resulting image collage. Your code must compile and run in the CECS lab computers without any changes!

Collaborating

You may collaborate with one student from this class in order to satisfy the requirements from this assignment. Each student is required to create his/her own original collage and thus must be different from the collage created by the student whom you collaborate with. That is, you can help each other to create the collage but each of you need to submit different programs (step 3 above) that manipulate the pictures in different way to create your own unique collage.

Notes

Programming Resources