Mirror across the horizontal side

Report a typo

Let's create a function that gets an image as an argument and returns its mirrored image across the horizontal axis, like:

fun mirrorXAxis(image: BufferedImage): BufferedImage {
    val mirrored = BufferedImage(image.width, image.height, image.type)

    for (x in 0 until image.width) {
        for (y in 0 until image.height) {
            val color = Color(image.getRGB(x, y))
            // Missing code line
        }
    }
    return mirrored
}

Here, a line of code is missing. What is the correct line we should insert?

Select one option from the list
___

Create a free account to access the full topic