def ff_find_border(col, row, existing_value, direction, image)
      next_col, next_row = ff_neighbour(col, row, direction)
      begin
        while image[next_col, next_row] == existing_value
          col, row = next_col, next_row
          next_col, next_row = ff_neighbour(col, row, direction)
        end
      rescue
        # Out of bounds. Do nothing.
      end
      col = 0 if col < 1
      row = 0 if row < 1
      return col, row
    end
def ff_find_border(col, row, existing_value, direction, image)
      next_col, next_row = ff_neighbour(col, row, direction)
      begin
        while image[next_col, next_row] == existing_value
          col, row = next_col, next_row
          next_col, next_row = ff_neighbour(col, row, direction)
        end
      rescue
        # Out of bounds. Do nothing.
      end
      col = 0 if col < 1
      row = 0 if row < 1
      return col, row
    end
Searches left and right to find the 'border' in a row of pixels in the
 image array. This private method is used by the flood_fill() method.

 @param [Integer] col the column index of the origin
 @param [Integer] row the row index of the origin
 @param [Integer] existing_value the value of the pixels we want to find a border for (i.e. we are searching for the occurance of a value other than this particular one)
 @param [Symbol] direction the direction of travel (:east, :west, :north, :south)
 @param [NArray] image a two-dimensional numerical pixel array
 @return [Array<Integer>] column and row pixel indices