Skip to main content

Section 26.5 Location Based Conditions

We can also use the x and y coordinates of pixels to make decisions about what pixels to process. This program changes pixels to black only if their x coordinate is less than 20 or over 180.

Checkpoint 26.5.1.

Currently, this program changes the 20 leftmost and rightmost pixels to black. Modify it to turn the 40 left and rightmost pixels to black. (Hint: The image is 200 pixels wide.)
You have attempted of activities on this page.