CSE8A_HW3

CSE8A_HW3 - Homework 3: Color Subtraction & Tri-Effect...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework 3: Color Subtraction & Tri-Effect Due: 5:00pm, Friday, January 28th Set Up Open your home directory (double click on your cs8wxx icon; 2 nd icon from the top) and create a new directory in your home directory called hw3 (all lowercase). Copy the folder bookClasses from your Desktop into the hw3 directory. o Right click on Desktop/bookClasses > Copy ; Right click on hw3 > Paste Into Folder When you work in Dr. Java be sure you are editing files in the hw3/bookClasses directory. Problems 1. Color Subtraction This program requires you to remove a specified amount of color from an image. You will need to write a program that subtracts the red, blue, and green components of all pixels of a Picture by specified values. To do this, you will: h Write one method in Picture.java. Method: subtractColor 1. Add a method to Picture.java called subtractColor ( be sure to use hw3/bookClasses/Picture.java ). 2. Your method takes three parameters -- which specify how much the RGB color components of all pixels of the picture should be reduced. For example, if you pass (100, 20, 45) as arguments to your method and the color values of one of the pixels of the Picture is (150, 200, 50), then these color values should be reduced to (50, 180, 5) after your method is called. If the result of subtraction is less than 0, set the color value to 0; if the result of subtraction is greater than 255, set the color value to 255. The order in which the color values are passed to the method should be red, green, and blue. 3. The method should reduce the color values of ALL the pixels in the Picture. 4. Start with this template: /* * Name: method name * * Purpose: Briefly describe the purpose of this method * * Parameters: List all parameters and their types and what they represent. * If no parameters, just state None. * * Return: Specify the return type and what it represents.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

CSE8A_HW3 - Homework 3: Color Subtraction & Tri-Effect...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online