CSE 8A Chapter 6.4: Reading Assignment Notes

23 views2 pages

Document Summary

To highlight the lightest and darkest areas of a picture, first get the pixels whose colors have a distance from white or black less than some specified amount. * method to replace the pixel colors in the current. * picture object that have a color distance less than. * the passed amount to white or black with the passed. * @param replacementcolor the new color to use public void highlightlightanddark(double amount, color replacementcolor) { // loop through all the pixels in the x direction for (int x = 0; x < getwidth(); x++) { // loop through all the pixels in the y direction for (int y = 0; y < getheight(); y++) { // get the current pixel pixel = getpixel(x,y); // if the distance from white or black is less than the. // passed amount use the replace color instead if (pixel. colordistance(color. white) < amount ||pixel. colordistance(color. black) < pixel. setcolor(replacementcolor); amount) {

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents