/*************************************************************************
* Name:
* NetID:
* Precept:
*
* Description: Reads in an image from a file, and displays the red, green,
* and blue portions in three separate windows.
*
* Dependencies: Picture.java
*
* Remark: This is Booksite Creative Exercise 3.1.60.
*************************************************************************/
import java.awt.Color;
public class ColorSeparation {
public static void main(String[] args) {
// read in the picture specified by command-line argument
Picture pic = new Picture(args[0]);
int width = pic.width();
int height = pic.height();
// create three empty pictures of the same dimension
Picture picR = new Picture(width, height); // R
Picture picG = __________________________; // G
_________________________________________; // B
// separate colors
for (int col = 0; col < width; col++) {
for (int row = 0; row < height; row++) {
// color value of current pixel
Color c = pic.____________________;
int r = c.getRed(); // r
int g = __________; // g
__________________; // b
picR.set(col, row, new Color(r, 0, 0));
______________________________________;
______________________________________;
}
}
// display each one in its own window
picR.show();
___________;
___________;
}
}