/**
 * This function calculates the coordinate of the pixel after shifting
 * in the specified direction.
 *
 * @param width The width of the canvas
 * @param height The height of the canvas
 * @param posX The current x-coordinate of the pixel
 * @param posY The current y-coordinate of the pixel
 * @param shiftDirection The direction in which the pixel is shifted ('left' or 'right')
 * @return Pair<Int, Int> The new x-coordinate and y-coordinate of the pixel after shifting
 */
fun calculatePixels(width: Int, height: Int, posX: Int, posY: Int, shiftDirection: String): Pair<Int, Int> {

    var newX = posX
    var newY = posY

    when (shiftDirection) {
        "left" -> {
            if (posX > 0) {
                newX = posX shl 1
                newY = (posY shr 1) % height
            } else {
                newX = width - 1
            }
        }
        "right" -> {
            if (posX < width - 1) {
                newX = posX shr 1
                newY = (posY shl 1) % height
            } else {
                newX = 0
            }
        }
    }

    return Pair(newX, newY)
}
/**
 * This function calculates the coordinate of the pixel after shifting
 * in the specified direction.
 *
 * @param width The width of the canvas
 * @param height The height of the canvas
 * @param posX The current x-coordinate of the pixel
 * @param posY The current y-coordinate of the pixel
 * @param shiftDirection The direction in which the pixel is shifted ('left' or 'right')
 * @return Pair<Int, Int> The new x-coordinate and y-coordinate of the pixel after shifting
 */
fun calculatePixels(width: Int, height: Int, posX: Int, posY: Int, shiftDirection: String): Pair<Int, Int> {
/**
 * This function calculates the coordinate of the pixel after shifting
 * in the specified direction.
 *
 * @param width The width of the canvas
 * @param height The height of the canvas
 * @param posX The current x-coordinate of the pixel
 * @param posY The current y-coordinate of the pixel
 * @param shiftDirection The direction in which the pixel is shifted ('left' or 'right')
 * @return Pair<Int, Int> The new x-coordinate and y-coordinate of the pixel after shifting
 */
fun calculatePixels(width: Int, height: Int, posX: Int, posY: Int, shiftDirection: String): Pair<Int, Int> {

    var newX = posX
    var newY = posY

    when (shiftDirection) {
        "left" -> {
            if (posX > 0) {
                newX = posX shl 1
                newY = (posY shr 1) % height
            } else {
                newX = width - 1
            }
        }
        "right" -> {
            if (posX < width - 1) {
                newX = posX shr 1
                newY = (posY shl 1) % height
            } else {
                newX = 0
            }
        }
    }

    return Pair(newX, newY)
}