lib/RMagick.rb in rmagick-1.12.0 vs lib/RMagick.rb in rmagick-1.13.0
- old
+ new
@@ -1,6 +1,6 @@
-# $Id: RMagick.rb,v 1.42 2006/06/03 22:56:40 rmagick Exp $
+# $Id: RMagick.rb,v 1.43 2006/06/20 23:18:22 rmagick Exp $
#==============================================================================
# Copyright (C) 2006 by Timothy P. Hunter
# Name: RMagick.rb
# Author: Tim Hunter
# Purpose: Extend Ruby to interface with ImageMagick.
@@ -710,12 +710,17 @@
# 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.)
def level(black_point=0.0, white_point=nil, gamma=nil)
+ black_point = Float(black_point)
+
white_point ||= Magick::MaxRGB - 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
unless gamma_arg
white_point = Magick::MaxRGB - black_point