def level(black_point = 0.0, white_point = nil, gamma = nil)
      black_point = Float(black_point)

      white_point ||= Magick::QuantumRange - black_point
      white_point = Float(white_point)

      gamma_arg = gamma
      gamma ||= 1.0
      gamma = Float(gamma)

      if gamma.abs > 10.0 || white_point.abs <= 10.0 || white_point.abs < gamma.abs
        gamma, white_point = white_point, gamma
        white_point = Magick::QuantumRange - black_point unless gamma_arg
      end

      level2(black_point, white_point, gamma)
    end
def level(black_point = 0.0, white_point = nil, gamma = nil)
      black_point = Float(black_point)

      white_point ||= Magick::QuantumRange - black_point
      white_point = Float(white_point)

      gamma_arg = gamma
      gamma ||= 1.0
      gamma = Float(gamma)

      if gamma.abs > 10.0 || white_point.abs <= 10.0 || white_point.abs < gamma.abs
        gamma, white_point = white_point, gamma
        white_point = Magick::QuantumRange - black_point unless gamma_arg
      end

      level2(black_point, white_point, gamma)
    end
Patches problematic change to the order of arguments in 1.11.0.
 Before this release, the order was
       black_point, gamma, white_point
 RMagick 1.11.0 changed this to
       black_point, white_point, gamma
 This fix tries to determine if the arguments are in the old order and
 if so, swaps the gamma and white_point arguments.  Then it calls
 level2, which simply accepts the arguments as given.
 Inspect the gamma and white point values and swap them if they
 look like they're in the old order.
 (Thanks to Al Evans for the suggestion.)