Grey image

Report a typo

A Color instance with all 3 values equal to each other denotes a shade of the grey color, e.g., Color(160, 160, 160). The following code lines create an image with the width of 100 pixels and the height of 256 pixels. This image has a different shade of grey for each line: from white at the top to black at the bottom. Put the code lines in the correct order. The "for loop" with the width precedes the "for loop" with the height.

Put the items in the correct order
for (j in 0 until image.height) {
val image: BufferedImage = BufferedImage(100, 256, BufferedImage.TYPE_INT_RGB)
for (i in 0 until image.width) {
image.setRGB(i, j, Color(j, j, j).rgb)
}
}
___

Create a free account to access the full topic