6. Assume an image named image is all green

6. Assume an image named image is all green

and we execute the following code segment.

1
2
3
4
5
6
7
8
w = image.getWidth();
for (var pixel of image.values()) {
x = pixel.getX();
y = pixel.getY();
if (x + y < w) {
pixel.setRed(255);
}
}

Which one of the following is the image generated by this code segment?

Comments

Popular posts from this blog

The function swapRedGreen has one parameter, a pixel. This function swaps the red and green values and returns the resulting red, green and blue values somehow. Which one of the following is the correct code for this function?