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+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents