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
- First declare your variables.  You will probably 
need variables for each of the colors that will be drawn.
The Color objects for the left and right color bars can be initialized
to random colors when the variables are declared.  The value of the other 
three colors, however, must be calculated from the left and right colors.
In order to calculate the remaining colors using the interpolation equation
above you can read the RGB values using the get methods (getRed(), getGreen(),
and getBlue()) of the Color class.  Once you calculate new RGB values you
can use the constructor of the Color class to create a new Color
object.
- When you have variables representing all five colors you can draw five
filled rectangles to the window, one of each color in the appropriate location.
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