CSE 8A Chapter 6.4: Reading Assignment Notes
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) {