Method: Magick::Image#level

Defined in:
lib/rmagick_internal.rb

#level(black_point = 0.0, white_point = nil, gamma = nil) ⇒ Object

(Thanks to Al Evans for the suggestion.)



906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
# File 'lib/rmagick_internal.rb', line 906

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