CPSC 120 Postlab 4: Color Bars
Due before class on Monday, September 28, 2009

Overview

For artists that work digitally, the color accuracy of a display can have tremendous implications for their work. For example, if an artist's display desaturates green slightly, then an image with people would be printed with sickly green looking people. In order to remedy this, the color of the device must be calibrated to a range of known colors. The colors for calibration are often displayed using vertical bars of color. In this assignment you will write a program that can generate color bars by interpolating two different colors.

Your program should display a window with five vertical color bars of equal size. The left and right color bars should be random Colors. The bar in the middle should be a 50%-50% blend of the right and left color bars. The center right and center left color bars should be 75%-25% blend of the right and left color bars (switching which is 75% and which is 25% to create two different colors).

In order to accomplish this you will need to interpolate colors, which can be achieved by interpolating each of the RGB values that constitute a color. In order to linearly interpolate two numbers you can use the following equation:

	xi = x1 * (p1 / 100) + x2 * (p2 / 100)
Where xi is a value that is p1 percent of x1 and p2 percent of x2. Note that p1 and p2 must sum to 100.

Planning Your Program

Other Requirements

As usual, use good programming techniques. You should use good variable names, constants where appropriate, whitespace, and correct indentation and alignment of statements. Be sure to put your name, the file name, and a description of the program in the header. The program should be broken up into logical sections and each section should be documented with a brief description of what it does.

Submission

To submit your code cp a tgz file containing your java file to the directory:

   /home/staff/bouchard/CPSC120B/post4