def replaceDiagonal(d, arr)
      d = d.to_i
      (0...arr.length).each do |i|
        xy = diagonalXY(d, i)
        self[xy['x'], xy['y']] = arr[i]
      end
    end
def replaceDiagonal(d, arr)
      d = d.to_i
      (0...arr.length).each do |i|
        xy = diagonalXY(d, i)
        self[xy['x'], xy['y']] = arr[i]
      end
    end
Replace a diagonal line (top left to bottom right) of the image.