Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replace MaxRGB with QuantumRange

  • Loading branch information...
commit fca6c01455ee03fa474967d4c9accd386e6d50c4 1 parent c0f24b6
rmagick authored
View
16 doc/constants.html
@@ -38,7 +38,7 @@
}
/*
- * Modify .simple_table for the MaxRGB/QuantumDepth table.
+ * Modify .simple_table for the QuantumRange/QuantumDepth table.
* The major differences are the centered text and the auto width.
*/
#maxrgb {
@@ -155,7 +155,7 @@ <h2 class="methods">Constants</h2>
<dd>An extended form of the <code>Version</code> constant with
the format shown here:<br />
- <code>This is RMagick 1.15.0 ($Date: 2007/02/10 00:13:43 $)
+ <code>This is RMagick 1.15.0 ($Date: 2007/03/23 23:02:14 $)
Copyright (C) 2007 by Timothy P. Hunter<br />
Built with ImageMagick 6.2.5 03/05/06 Q8
http://www.imagemagick.org<br />
@@ -169,24 +169,28 @@ <h2 class="methods">Constants</h2>
<code>@(#)ImageMagick X.Y.Z MM/DD/YY Q:16
http://www.imagemagick.org</code></dd>
- <dt>MaxRGB</dt>
+ <dt>QuantumRange</dt>
<dd>The maximum value of a <em>Quantum</em>. A quantum is one
of the red, green, blue, or opacity elements of a pixel in the
RGB colorspace, or cyan, yellow, magenta, or black elements in
the CYMK colorspace.</dd>
+ <dt>MaxRGB <i>(deprecated)</i></dt>
+
+ <dd>Same as QuantumRange.</dd>
+
<dt>QuantumDepth</dt>
<dd>
The number of bits in a quantum. The relationship between
- QuantumDepth and MaxRGB is summarized in this table.
+ QuantumDepth and QuantumRange is summarized in this table.
<table summary="number of bits in a quantum" id="maxrgb">
<tr>
<th>QuantumDepth</th>
- <th>MaxRGB</th>
+ <th>QuantumRange</th>
</tr>
<tr>
@@ -1303,7 +1307,7 @@ <h3 class="const" id="StorageType">StorageType</h3>
<dt>QuantumPixel</dt>
<dd>corresponds to the Quantum type used by ImageMagick, range
- 0-MaxRGB.</dd>
+ 0-QuantumRange.</dd>
</dl>
<h3 class="const" id="StyleType">StyleType</h3>
View
2  doc/ex/bilevel_channel.rb
@@ -3,7 +3,7 @@
require 'RMagick'
img = Magick::Image.read('images/Flower_Hat.jpg').first
-result = img.bilevel_channel(2*Magick::MaxRGB/3, Magick::RedChannel)
+result = img.bilevel_channel(2*Magick::QuantumRange/3, Magick::RedChannel)
result.write('bilevel_channel.jpg')
exit
View
2  doc/ex/level.rb
@@ -6,6 +6,6 @@
before = Magick::Image.read('images/Flower_Hat.jpg').first
# Brighten up the mid-tones a bit.
-after = before.level(0, Magick::MaxRGB, 1.50)
+after = before.level(0, Magick::QuantumRange, 1.50)
after.write('level.jpg')
exit
View
4 doc/ex/mask.rb
@@ -24,7 +24,7 @@
end
# Set the matte attribute to false, indicating the absence of an alpha channel
-# in the mask image. Assign the mask image to the mask= attribute of the image
+# in the mask image. Assign the mask image to the mask= attribute of the image
# being masked.
q.matte = false
@@ -32,6 +32,6 @@
# Use the #level method to darken the image under the black part of the mask.
-img = img.level(0, Magick::MaxRGB, 0.50)
+img = img.level(0, Magick::QuantumRange, 0.50)
img.write('mask.jpg')
View
2  doc/ex/random_threshold_channel.rb
@@ -6,7 +6,7 @@
img = Magick::Image.read('images/Flower_Hat.jpg').first
-geom = Magick::Geometry.new(Magick::MaxRGB/2)
+geom = Magick::Geometry.new(Magick::QuantumRange/2)
img2 = img.random_threshold_channel(geom, Magick::RedChannel)
img2.write('random_threshold_channel.jpg')
View
2  doc/ex/sepiatone.rb
@@ -3,6 +3,6 @@
require 'RMagick'
img = Magick::Image.read('images/Flower_Hat.jpg').first
-sepiatone = img.sepiatone(Magick::MaxRGB * 0.8)
+sepiatone = img.sepiatone(Magick::QuantumRange * 0.8)
sepiatone.write('sepiatone.jpg')
View
14 doc/ex/smile.rb
@@ -101,20 +101,20 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0 ]
- img = Image.new(SmileWidth, SmileHeight)
-
+ img = Image.new(SmileWidth, SmileHeight)
+
q = Array.new # Create an array of pixels one
SmileWidth.times do # row long
q << Magick::Pixel.new(0,0,0,0)
end
- n = 0
+ n = 0
SmileHeight.times do |y| # Store pixels a row at a time
SmileWidth.times do |x| # Build a row of pixels
- q[x].red = MaxRGB * SmileBits[n]
- q[x].green = MaxRGB * SmileBits[n]
- q[x].blue = MaxRGB * SmileBits[n]
- n += 1
+ q[x].red = QuantumRange * SmileBits[n]
+ q[x].green = QuantumRange * SmileBits[n]
+ q[x].blue = QuantumRange * SmileBits[n]
+ n += 1
end
# Store the row of pixels
img.store_pixels(0, y, SmileWidth, 1, q)
View
4 doc/ex/threshold.rb
@@ -5,8 +5,8 @@
img = Magick::Image.read('images/Flower_Hat.jpg').first
-# Use a threshold of 55% of MaxRGB.
-img = img.threshold(Magick::MaxRGB*0.55)
+# Use a threshold of 55% of QuantumRange.
+img = img.threshold(Magick::QuantumRange*0.55)
#img.display
img.write('threshold.jpg')
View
6 doc/ex/viewex.rb
@@ -9,7 +9,7 @@
img.view( 10, 5, 20, 20) do |view|
# Set all the pixels in the view to green.
- view[][] = Magick::Pixel.new(0, Magick::MaxRGB)
+ view[][] = Magick::Pixel.new(0, Magick::QuantumRange)
# Change the top and bottom rows to red.
view[0][] = 'red'
@@ -23,11 +23,11 @@
# Change the green channel of all the
# pixels on row 8.
- view[8][].green = Magick::MaxRGB/2
+ view[8][].green = Magick::QuantumRange/2
# Change the blue channel of 8 pixels
# on column 10.
- view[4,8][10].blue = Magick::MaxRGB
+ view[4,8][10].blue = Magick::QuantumRange
end
img.scale(5).write("viewex.gif")
View
2  doc/ilist.html
@@ -1534,7 +1534,7 @@ <h3 id="quantize">quantize</h3>
<dd>The maximum number of colors to use in the output images.
Must be less than or equal to <a href=
- "constants.html#Miscellaneous_constants">MaxRGB</a>.</dd>
+ "constants.html#Miscellaneous_constants">QuantumRange</a>.</dd>
<dt>colorspace</dt>
View
10 doc/image1.html
@@ -368,7 +368,7 @@ <h3 id="constitute">constitute</h3>
The elements in the array must be either all
<code>Integers</code> or all <code>Floats</code>. If the
elements are <code>Integers</code>, the <code>Integers</code>
- must be in the range [0..MaxRGB]. If the elements are
+ must be in the range [0..QuantumRange]. If the elements are
<code>Floats</code>, they must be in the range [0..1].</dd>
</dl>
@@ -1376,7 +1376,7 @@ <h3 id="bilevel_channel">bilevel_channel</h3>
<dt>threshold</dt>
<dd>The threshold value, a number between 0 and
- <code>MaxRGB</code>.</dd>
+ QuantumRange.</dd>
<dt>channel...</dt>
@@ -1392,7 +1392,7 @@ <h3 id="bilevel_channel">bilevel_channel</h3>
<h4>Example</h4>
- <p><code>bilevel_channel(2*MaxRGB/3, RedChannel)</code></p>
+ <p><code>bilevel_channel(2*QuantumRange/3, RedChannel)</code></p>
<p class="rollover"><a href=
"javascript:popup('bilevel_channel.rb.html')"><img onmouseover=
@@ -1433,7 +1433,7 @@ <h3 id="black_threshold">black_threshold</h3>
<h4>Arguments</h4>
- <p>Each channel argument is a number between 0 and MaxRGB. All
+ <p>Each channel argument is a number between 0 and QuantumRange. All
arguments except the first may be omitted. If the <span class=
"arg">green_channel</span> or <span class=
"arg">blue_channel</span> argument is omitted, the default
@@ -3487,7 +3487,7 @@ <h3 id="dispatch">dispatch</h3>
<dd>If <code>true</code>, the returned array elements will be
<code>Float</code> values in the range 0..1. If
<code>false</code>, the returned array elements will be
- <code>Integer</code> values in the range 0..MaxRGB.</dd>
+ <code>Integer</code> values in the range 0..QuantumRange.</dd>
</dl>
<h4>Returns</h4>An array
View
20 doc/image2.html
@@ -1715,7 +1715,7 @@ <h3 id="import_pixels">import_pixels</h3>
"arg">pixels</span> is an array or an object that can be
converted to an array by the <code>Kernel::Array</code>
method. The elements in the array must be
- <code>Numeric</code> values in the range [0..MaxRGB]. In
+ <code>Numeric</code> values in the range [0..QuantumRange]. In
either case, the pixel data must be stored in scanline
order: left-to-right and top-to-bottom.</dd>
</dl>
@@ -1842,7 +1842,7 @@ <h3 id="level">level</h3>
<p><span class="arg">image</span>.level(<span class=
"arg">black_point</span>=<code>0.0</code>, <span class=
- "arg">white_point</span>=<code>MaxRGB</code>, <span class=
+ "arg">white_point</span>=<code>QuantumRange</code>, <span class=
"arg">gamma</span>=<code>1.0</code>) -&gt; <em>anImage</em></p>
</div>
@@ -1865,13 +1865,13 @@ <h3 id="level">level</h3>
<dt>black_point</dt>
<dd>A black point level in the range 0-<a href=
- "constants.html#Miscellaneous_constants">MaxRGB</a>. The
+ "constants.html#Miscellaneous_constants">QuantumRange</a>. The
default is 0.0.</dd>
<dt>mid_point</dt>
- <dd>A white point level in the range 0-MaxRGB. The default is
- <a href="constants.html#Miscellaneous_constants">MaxRGB</a> -
+ <dd>A white point level in the range 0..QuantumRange. The default is
+ <a href="constants.html#Miscellaneous_constants">QuantumRange</a> -
<span class="arg">black_point</span>.</dd>
<dt>gamma</dt>
@@ -1933,7 +1933,7 @@ <h3 id="level_channel">level_channel</h3>
<p><span class="arg">image</span>.level_channel(<span class=
"arg">channel</span>, <span class="arg">black_point</span>=0,
- <span class="arg">white_point</span>=MaxRGB - black_point,
+ <span class="arg">white_point</span>=QuantumRange - black_point,
<span class="arg">gamma</span>=1.0) -&gt; <em>anImage</em></p>
</div>
@@ -1952,13 +1952,13 @@ <h3 id="level_channel">level_channel</h3>
<dt>black_point</dt>
<dd>A black point level in the range 0-<a href=
- "constants.html#Miscellaneous_constants">MaxRGB</a>. The
+ "constants.html#Miscellaneous_constants">QuantumRange</a>. The
default is 0.0.</dd>
<dt>mid_point</dt>
- <dd>A white point level in the range 0-MaxRGB. The default is
- <a href="constants.html#Miscellaneous_constants">MaxRGB</a> -
+ <dd>A white point level in the range 0..QuantumRange. The default is
+ <a href="constants.html#Miscellaneous_constants">QuantumRange</a> -
<span class="arg">black_point</span>.</dd>
<dt>gamma</dt>
@@ -2466,7 +2466,7 @@ <h3 id="monochrome_q">monochrome?</h3>
<h4>Description</h4>
<p>Returns true if all the pixels have the same red, green, and
- blue values and the values are either 0 or MaxRGB. That is, the
+ blue values and the values are either 0 or QuantumRange. That is, the
image is black-and-white.</p>
<h4>See also</h4>
View
28 doc/image3.html
@@ -454,7 +454,7 @@ <h3 id="quantize">quantize</h3>
<dd>The maximum number of colors in the result image. Must be
&lt;= <a href=
- "constants.html#Miscellaneous_constants">MaxRGB</a>.</dd>
+ "constants.html#Miscellaneous_constants">QuantumRange</a>.</dd>
<dt>colorspace</dt>
@@ -764,8 +764,8 @@ <h3 id="random_threshold_channel">random_threshold_channel</h3>
<dd><span class="imquote">A geometry string containing
LOWxHIGH thresholds.</span> The string is in the form `XxY'.
The Y value may be omitted, in which case it is assigned the
- value MaxRGB-X. If an % appears in the string then the values
- are assumed to be percentages of MaxRGB. <span class=
+ value QuantumRange-X. If an % appears in the string then the values
+ are assumed to be percentages of QuantumRange. <span class=
"imquote">If the string contains 2x2, 3x3, or 4x4, then an
ordered dither of order 2, 3, or 4 will be performed
instead.</span> A <a href="struct.html#Geometry">Geometry</a>
@@ -785,7 +785,7 @@ <h3 id="random_threshold_channel">random_threshold_channel</h3>
<h4>Example</h4>
<pre>
-geom = Geometry.new(MaxRGB/2)
+geom = Geometry.new(QuantumRange/2)
random_threshold_channel(geom, RedChannel)
</pre>
@@ -1432,7 +1432,7 @@ <h3 id="segment">segment</h3>
<h3 id="sepiatone">sepiatone</h3>
<p><span class="arg">image</span>.sepiatone(<span class=
- "arg">threshold</span>=MaxRGB) -&gt; <span class=
+ "arg">threshold</span>=QuantumRange) -&gt; <span class=
"arg">anImage</span></p>
</div>
@@ -1449,9 +1449,9 @@ <h3 id="sepiatone">sepiatone</h3>
<dt>threshold</dt>
<dd class="imquote"><span class="arg">Threshold</span> ranges
- from 0 to <code>MaxRGB</code> and is a measure of the extent
+ from 0 to QuantumRange and is a measure of the extent
of the sepia toning. A threshold of 80% is a good starting
- point for a reasonable tone. The default is MaxRGB.</dd>
+ point for a reasonable tone. The default is QuantumRange.</dd>
</dl>
<h4>Returns</h4>
@@ -2038,7 +2038,7 @@ <h3 id="solarize">solarize</h3>
<h4>Arguments</h4>
- <p><span class="imquote">Ranges from 0 to MaxRGB and is a
+ <p><span class="imquote">Ranges from 0 to QuantumRange and is a
measure of the extent of the solarization.</span> The default
is 50.</p>
@@ -2529,7 +2529,7 @@ <h3 id="threshold">threshold</h3>
<h4>Arguments</h4>
- <p>A value between 0 and MaxRGB.</p>
+ <p>A value between 0 and QuantumRange.</p>
<h4>Returns</h4>
@@ -2755,7 +2755,7 @@ <h3 id="transparent">transparent</h3>
<dd>The new opacity value, either an <a href=
"constants.html#Opacity">opacity</a> value or a number
- between 0 and MaxRGB. The default is TransparentOpacity.</dd>
+ between 0 and QuantumRange. The default is TransparentOpacity.</dd>
</dl>
<h4>Returns</h4>
@@ -3195,7 +3195,7 @@ <h3 id="view">view</h3>
img.view( 10, 5, 20, 20) do |view|
# Set all the pixels in the view to green.
- view[][] = Pixel.new(0, MaxRGB)
+ view[][] = Pixel.new(0, QuantumRange)
# Change the top and bottom rows to red.
view[0][] = 'red'
@@ -3209,11 +3209,11 @@ <h3 id="view">view</h3>
# Change the green channel of all the
# pixels on row 8.
- view[8][].green = MaxRGB/2
+ view[8][].green = QuantumRange/2
# Change the blue channel of 8 pixels
# on column 10.
- view[4,8][10].blue = MaxRGB
+ view[4,8][10].blue = QuantumRange
end
</pre>
@@ -3602,7 +3602,7 @@ <h3 id="white_threshold">white_threshold</h3>
<h4>Arguments</h4>
- <p>Each channel argument is a number between 0 and MaxRGB. All
+ <p>Each channel argument is a number between 0 and QuantumRange. All
arguments except the first may be omitted. If the <span class=
"arg">green_channel</span> or <span class=
"arg">blue_channel</span> argument is omitted, the default
View
6 doc/imageattrs.html
@@ -836,9 +836,9 @@ <h3 id="fuzz">fuzz</h3>
<p>The argument may be a floating-point numeric value or a
string in the form "NN%". In the second case, the argument is
computed as a percentage of <a href=
- "constants.html#Miscellaneous_constants">MaxRGB</a>. For
+ "constants.html#Miscellaneous_constants">QuantumRange</a>. For
example, a value of '5%' sets <code>fuzz</code> to
- 0.05*MaxRGB.</p>
+ 0.05*QuantumRange.</p>
<h4>Returns</h4>
@@ -1273,7 +1273,7 @@ <h3 id="opacity">opacity</h3>
are blended with the supplied transparency value.</span>
Set-only.</p>
- <h4>Arguments</h4>A number between 0 and MaxRGB. Higher numbers
+ <h4>Arguments</h4>A number between 0 and QuantumRange. Higher numbers
increase transparency.
</div>
View
6 doc/imusage.html
@@ -233,7 +233,7 @@ <h2 id="color_names">Color names</h2>
<td>cmyk(c,m,y,k)</td>
<td>CMYK functional notation. c, m, y, and k are either 4
- integers 0-MaxRGB or 4 percentages 0%-100%.</td>
+ integers 0-QuantumRange or 4 percentages 0%-100%.</td>
</tr>
<tr class="evenrow">
@@ -246,7 +246,7 @@ <h2 id="color_names">Color names</h2>
<td>rgb(r,g,b)</td>
<td>SVG functional notation. r, g, and b are either 3
- integers 0-MaxRGB or 3 percentages 0%-100%.</td>
+ integers 0-QuantumRange or 3 percentages 0%-100%.</td>
</tr>
<tr class="evenrow">
@@ -273,7 +273,7 @@ <h2 id="color_names">Color names</h2>
</table>
<p>The alpha channel is the opacity of the image, which can range
- from 0 (Magick::OpaqueOpacity) to MaxRGB
+ from 0 (Magick::OpaqueOpacity) to QuantumRange
(Magick::TransparentOpacity).</p>
<p>A <code>Pixel</code> object contains the numeric
View
4 doc/info.html
@@ -904,9 +904,9 @@ <h3 id="fuzz">fuzz</h3>
<p>The argument may be a numeric value or a string in the form
"NN%". In the second case, the argument is computed as a
percentage of <a href=
- "constants.html#Miscellaneous_constants">MaxRGB</a>. For
+ "constants.html#Miscellaneous_constants">QuantumRange</a>. For
example, a value of '5%' sets <code>fuzz</code> to
- 0.05*MaxRGB.</p>
+ 0.05*QuantumRange.</p>
</div>
<div class="sig">
View
4 doc/optequiv.html
@@ -927,7 +927,7 @@ <h2 class="methods" id="convert">convert, mogrify</h2>
<td>Image#<a href=
"image2.html#level">level</a>(<em>black_point</em>=0.0,
- <em>white_point</em>=MaxRGB, <em>gamma</em>=1.0)</td>
+ <em>white_point</em>=QuantumRange, <em>gamma</em>=1.0)</td>
</tr>
<tr id="limit">
@@ -1433,7 +1433,7 @@ <h2 class="methods" id="convert">convert, mogrify</h2>
<td>-sepia-tone <em>threshold</em></td>
<td>Image#<a href=
- "image3.html#sepiatone">sepiatone</a>(<em>threshold</em>=MaxRGB)</td>
+ "image3.html#sepiatone">sepiatone</a>(<em>threshold</em>=QuantumRange)</td>
</tr>
<tr>
View
8 doc/struct.html
@@ -326,8 +326,8 @@ <h2 id="view">The Image::View class</h2>
<h5>Examples</h5>
<pre>
# Set the red channel of all the pixels in the 2nd
- # row of the view to MaxRGB
- view[1][].red = MaxRGB
+ # row of the view to QuantumRange
+ view[1][].red = QuantumRange
# Set the green channel of the pixel at [20][30] to
# half that of its left-hand neighbor.
view[20][30].green = view[20][29].green * 0.5
@@ -586,7 +586,7 @@ <h2 id="view">The Image::View class</h2>
CMYK colorspace a pixel's color is described by its intensity
in the cyan, magenta, yellow and black (K) channels.
Intensity is a value between 0 and <a href=
- "constants.html#MaxRGB">MaxRGB</a>.</p>
+ "constants.html#QuantumRange">QuantumRange</a>.</p>
<p>Usually, RMagick methods operate on entire images or on
groups of pixels that have been selected by their position or
@@ -615,7 +615,7 @@ <h2 id="view">The Image::View class</h2>
<p>Constructs a pixel object from the specified red, green,
blue, and opacity intensities. The intensity is a number
between 0 and <a href=
- "constants.html#Miscellaneous_constants">MaxRGB</a>.</p>
+ "constants.html#Miscellaneous_constants">QuantumRange</a>.</p>
<h5>Attributes</h5>
View
22 examples/histogram.rb
@@ -9,14 +9,14 @@ def initialize(size)
super
fill {Magick::Pixel.new}
end
-
+
def reset(bg)
each {|pixel| pixel.reset(bg)}
end
end
module Magick
-
+
class Pixel
def reset(bg)
self.red = bg.red
@@ -25,7 +25,7 @@ def reset(bg)
self.opacity = bg.opacity
end
end
-
+
class Image
private
@@ -82,28 +82,28 @@ def channel_histograms(red, green, blue, int, scale, fg, bg)
yf = Float(y)
if yf >= HISTOGRAM_ROWS - (red[x] * scale)
- red_column[y].red = MaxRGB
+ red_column[y].red = QuantumRange
red_column[y].green = 0
red_column[y].blue = 0
- rgb_column[y].red = MaxRGB
+ rgb_column[y].red = QuantumRange
end
if yf >= HISTOGRAM_ROWS - (green[x] * scale)
- green_column[y].green = MaxRGB
+ green_column[y].green = QuantumRange
green_column[y].red = 0
green_column[y].blue = 0
- rgb_column[y].green = MaxRGB
+ rgb_column[y].green = QuantumRange
end
if yf >= HISTOGRAM_ROWS - (blue[x] * scale)
- blue_column[y].blue = MaxRGB
+ blue_column[y].blue = QuantumRange
blue_column[y].red = 0
blue_column[y].green = 0
- rgb_column[y].blue = MaxRGB
+ rgb_column[y].blue = QuantumRange
end
if yf >= HISTOGRAM_ROWS - (int[x] * scale)
int_column[y].opacity = TransparentOpacity
end
end
-
+
rgb_histogram.store_pixels( x, 0, 1, HISTOGRAM_ROWS, rgb_column)
red_histogram.store_pixels( x, 0, 1, HISTOGRAM_ROWS, red_column)
green_histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, green_column)
@@ -228,7 +228,7 @@ def histogram(fg='white', bg='black')
# Scale to chart size. When computing the scale, add some "air" between
# the max frequency and the top of the histogram. This makes a prettier chart.
# The RGBA and intensity histograms are all drawn to the same scale.
-
+
max = [red.max, green.max, blue.max, alpha.max, int.max].max
scale = HISTOGRAM_ROWS / (max*AIR_FACTOR)
View
90 examples/identify.rb
@@ -12,11 +12,11 @@ def identify
puts "\tGeometry: #{columns}x#{rows}\n"
puts "\tClass: #{class_type.to_s}\n"
puts "\tType: #{image_type.to_s}\n"
- puts "\tEndianess: #{endian}\n"
+ puts "\tEndianess: #{endian}\n"
puts "\tColorspace: #{colorspace}\n"
puts "\tChannelDepth:\n"
color_space = gray? ? Magick::GrayColorspace : colorspace
- case color_space
+ case color_space
when Magick::RGBColorspace
puts "\t\tRed: #{channel_depth(Magick::RedChannel)}-bits\n"
puts "\t\tGreen: #{channel_depth(Magick::GreenChannel)}-bits\n"
@@ -32,59 +32,59 @@ def identify
puts "\t\tGray: #{channel_depth(Magick::GrayChannel)}-bits\n"
puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if matte
end
- scale = Magick::MaxRGB / (Magick::MaxRGB >> (Magick::QuantumDepth-channel_depth))
+ scale = Magick::QuantumRange / (Magick::QuantumRange >> (Magick::QuantumDepth-channel_depth))
puts "\tChannel statistics:\n"
case color_space
when Magick::RGBColorspace
puts "\t\tRed:\n"
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::RedChannel)[0]/scale, channel_extrema(Magick::RedChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::RedChannel)[1]/scale, channel_extrema(Magick::RedChannel)[1]/Magick::MaxRGB)
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::RedChannel)[0]/scale, channel_mean(Magick::RedChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::RedChannel)[1]/scale, channel_mean(Magick::RedChannel)[1]/Magick::MaxRGB)
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::RedChannel)[0]/scale, channel_extrema(Magick::RedChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::RedChannel)[1]/scale, channel_extrema(Magick::RedChannel)[1]/Magick::QuantumRange)
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::RedChannel)[0]/scale, channel_mean(Magick::RedChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::RedChannel)[1]/scale, channel_mean(Magick::RedChannel)[1]/Magick::QuantumRange)
puts "\t\tGreen:\n"
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::GreenChannel)[0]/scale, channel_extrema(Magick::GreenChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::GreenChannel)[1]/scale, channel_extrema(Magick::GreenChannel)[1]/Magick::MaxRGB)
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::GreenChannel)[0]/scale, channel_mean(Magick::GreenChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::GreenChannel)[1]/scale, channel_mean(Magick::GreenChannel)[1]/Magick::MaxRGB)
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::GreenChannel)[0]/scale, channel_extrema(Magick::GreenChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::GreenChannel)[1]/scale, channel_extrema(Magick::GreenChannel)[1]/Magick::QuantumRange)
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::GreenChannel)[0]/scale, channel_mean(Magick::GreenChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::GreenChannel)[1]/scale, channel_mean(Magick::GreenChannel)[1]/Magick::QuantumRange)
puts "\t\tBlue:\n"
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlueChannel)[0]/scale, channel_extrema(Magick::BlueChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlueChannel)[1]/scale, channel_extrema(Magick::BlueChannel)[1]/Magick::MaxRGB)
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::BlueChannel)[0]/scale, channel_mean(Magick::BlueChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::BlueChannel)[1]/scale, channel_mean(Magick::BlueChannel)[1]/Magick::MaxRGB)
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlueChannel)[0]/scale, channel_extrema(Magick::BlueChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlueChannel)[1]/scale, channel_extrema(Magick::BlueChannel)[1]/Magick::QuantumRange)
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::BlueChannel)[0]/scale, channel_mean(Magick::BlueChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::BlueChannel)[1]/scale, channel_mean(Magick::BlueChannel)[1]/Magick::QuantumRange)
when Magick::CMYKColorspace
puts "\t\tCyan:\n"
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::CyanChannel)[0]/scale, channel_extrema(Magick::CyanChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::CyanChannel)[1]/scale, channel_extrema(Magick::CyanChannel)[1]/Magick::MaxRGB)
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::CyanChannel)[0]/scale, channel_mean(Magick::CyanChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::CyanChannel)[1]/scale, channel_mean(Magick::CyanChannel)[1]/Magick::MaxRGB)
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::CyanChannel)[0]/scale, channel_extrema(Magick::CyanChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::CyanChannel)[1]/scale, channel_extrema(Magick::CyanChannel)[1]/Magick::QuantumRange)
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::CyanChannel)[0]/scale, channel_mean(Magick::CyanChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::CyanChannel)[1]/scale, channel_mean(Magick::CyanChannel)[1]/Magick::QuantumRange)
puts "\t\tMagenta:\n"
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::MagentaChannel)[0]/scale, channel_extrema(Magick::MagentaChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::MagentaChannel)[1]/scale, channel_extrema(Magick::MagentaChannel)[1]/Magick::MaxRGB)
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::MagentaChannel)[0]/scale, channel_mean(Magick::MagentaChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::MagentaChannel)[1]/scale, channel_mean(Magick::MagentaChannel)[1]/Magick::MaxRGB)
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::MagentaChannel)[0]/scale, channel_extrema(Magick::MagentaChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::MagentaChannel)[1]/scale, channel_extrema(Magick::MagentaChannel)[1]/Magick::QuantumRange)
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::MagentaChannel)[0]/scale, channel_mean(Magick::MagentaChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::MagentaChannel)[1]/scale, channel_mean(Magick::MagentaChannel)[1]/Magick::QuantumRange)
puts "\t\tYellow:\n"
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::YellowChannel)[0]/scale, channel_extrema(Magick::YellowChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::YellowChannel)[1]/scale, channel_extrema(Magick::YellowChannel)[1]/Magick::MaxRGB)
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::YellowChannel)[0]/scale, channel_mean(Magick::YellowChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::YellowChannel)[1]/scale, channel_mean(Magick::YellowChannel)[1]/Magick::MaxRGB)
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::YellowChannel)[0]/scale, channel_extrema(Magick::YellowChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::YellowChannel)[1]/scale, channel_extrema(Magick::YellowChannel)[1]/Magick::QuantumRange)
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::YellowChannel)[0]/scale, channel_mean(Magick::YellowChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::YellowChannel)[1]/scale, channel_mean(Magick::YellowChannel)[1]/Magick::QuantumRange)
puts "\t\tBlack:\n"
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlackChannel)[0]/scale, channel_extrema(Magick::BlackChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlackChannel)[1]/scale, channel_extrema(Magick::BlackChannel)[1]/Magick::MaxRGB)
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::BlackChannel)[0]/scale, channel_mean(Magick::BlackChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::BlackChannel)[1]/scale, channel_mean(Magick::BlackChannel)[1]/Magick::MaxRGB)
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlackChannel)[0]/scale, channel_extrema(Magick::BlackChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlackChannel)[1]/scale, channel_extrema(Magick::BlackChannel)[1]/Magick::QuantumRange)
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::BlackChannel)[0]/scale, channel_mean(Magick::BlackChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::BlackChannel)[1]/scale, channel_mean(Magick::BlackChannel)[1]/Magick::QuantumRange)
when Magick::GrayColorspace
puts "\t\tGray:\n"
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::GrayChannel)[0]/scale, channel_extrema(Magick::GrayChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::GrayChannel)[1]/scale, channel_extrema(Magick::GrayChannel)[1]/Magick::MaxRGB)
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[0]/scale, channel_mean(Magick::GrayChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[1]/scale, channel_mean(Magick::GrayChannel)[1]/Magick::MaxRGB)
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::GrayChannel)[0]/scale, channel_extrema(Magick::GrayChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::GrayChannel)[1]/scale, channel_extrema(Magick::GrayChannel)[1]/Magick::QuantumRange)
+ puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[0]/scale, channel_mean(Magick::GrayChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[1]/scale, channel_mean(Magick::GrayChannel)[1]/Magick::QuantumRange)
end
if matte
puts "\t\tOpacity:\n"
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[0]/scale, channel_extrema(Magick::OpacityChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[1]/scale, channel_extrema(Magick::OpacityChannel)[1]/Magick::MaxRGB)
- puts "\t\t\tMean:" + sprintf("%u (%g)\n", channel_mean(Magick::OpacityChannel)[0]/scale, channel_mean(Magick::OpacityChannel)[0]/Magick::MaxRGB)
- puts "\t\t\tStandard deviation:" + sprintf("%u (%g)\n", channel_mean(Magick::OpacityChannel)[1]/scale, channel_mean(Magick::OpacityChannel)[1]/Magick::MaxRGB)
+ puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[0]/scale, channel_extrema(Magick::OpacityChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[1]/scale, channel_extrema(Magick::OpacityChannel)[1]/Magick::QuantumRange)
+ puts "\t\t\tMean:" + sprintf("%u (%g)\n", channel_mean(Magick::OpacityChannel)[0]/scale, channel_mean(Magick::OpacityChannel)[0]/Magick::QuantumRange)
+ puts "\t\t\tStandard deviation:" + sprintf("%u (%g)\n", channel_mean(Magick::OpacityChannel)[1]/scale, channel_mean(Magick::OpacityChannel)[1]/Magick::QuantumRange)
end
if class_type == Magick::DirectClass
puts "\tColors: #{total_colors}\n"
@@ -157,21 +157,21 @@ def identify
exif_attrs.each do |attr|
puts "\t\t#{attr[0]}: #{attr[1]}\n"
end
- end
+ end
end
puts "\tTainted: True\n" if changed?
puts "\tTainted: False\n" unless changed?
puts "\tVersion: #{Magick::Version}\n"
puts "\t #{Magick::Magick_version}\n"
- end
+ end
end
end
if ARGV.length == 0
puts <<-'END_USAGE'
- This example displays information about the specified image file(s)
- that is similar to ImageMagick/GraphicsMagick's identify command.
-
+ This example displays information about the specified image file(s)
+ that is similar to ImageMagick/GraphicsMagick's identify command.
+
Usage:
ruby identify.rb filename [filename...]
END_USAGE
@@ -183,5 +183,5 @@ def identify
img.identify
end
-exit
+exit
View
4 examples/spinner.rb
@@ -22,13 +22,13 @@
spinner = Magick::ImageList.new
# 'level' is the change from darkest gray to white
-level = Magick::MaxRGB / 2 / NFRAMES
+level = Magick::QuantumRange / 2 / NFRAMES
NFRAMES.times do |x|
gc = Magick::Draw.new
gc.translate(DIM/2, DIM/2)
gc.stroke('none')
- intensity = 0.58 * Magick::MaxRGB
+ intensity = 0.58 * Magick::QuantumRange
fill_color = Magick::Pixel.new(intensity, intensity, intensity).to_color
gc.fill(fill_color)
angle = x * (360/NFRAMES)
View
6 lib/RMagick.rb
@@ -1,4 +1,4 @@
-# $Id: RMagick.rb,v 1.53 2007/03/23 22:14:33 rmagick Exp $
+# $Id: RMagick.rb,v 1.54 2007/03/23 23:04:08 rmagick Exp $
#==============================================================================
# Copyright (C) 2007 by Timothy P. Hunter
# Name: RMagick.rb
@@ -844,7 +844,7 @@ def each_iptc_dataset
def level(black_point=0.0, white_point=nil, gamma=nil)
black_point = Float(black_point)
- white_point ||= Magick::MaxRGB - black_point
+ white_point ||= Magick::QuantumRange - black_point
white_point = Float(white_point)
gamma_arg = gamma
@@ -854,7 +854,7 @@ def level(black_point=0.0, white_point=nil, gamma=nil)
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
+ white_point = Magick::QuantumRange - black_point
end
end
View
14 test/Image1.rb
@@ -52,7 +52,7 @@ def test_constitute
# can't compare it directly to the original image.
assert_equal(@img.columns, res.columns)
assert_equal(@img.rows, res.rows)
- assert_block { pixels.all? { |v| 0 <= v && v <= Magick::MaxRGB } }
+ assert_block { pixels.all? { |v| 0 <= v && v <= Magick::QuantumRange } }
end
pixels = @img.dispatch(0, 0, @img.columns, @img.rows, 'RGBA', true)
@@ -409,7 +409,7 @@ def test_color_fill_to_border
res = @img.color_fill_to_border(@img.columns/2, @img.rows/2, 'red')
assert_instance_of(Magick::Image, res)
end
- pixel = Magick::Pixel.new(Magick::MaxRGB)
+ pixel = Magick::Pixel.new(Magick::QuantumRange)
assert_nothing_raised { @img.color_fill_to_border(@img.columns/2, @img.rows/2, pixel) }
end
@@ -420,7 +420,7 @@ def test_color_floodfill
res = @img.color_floodfill(@img.columns/2, @img.rows/2, 'red')
assert_instance_of(Magick::Image, res)
end
- pixel = Magick::Pixel.new(Magick::MaxRGB)
+ pixel = Magick::Pixel.new(Magick::QuantumRange)
assert_nothing_raised { @img.color_floodfill(@img.columns/2, @img.rows/2, pixel) }
end
@@ -437,7 +437,7 @@ def test_colorize
assert_instance_of(Magick::Image, res)
end
assert_nothing_raised { @img.colorize(0.25, 0.25, 0.25, 0.25, 'red') }
- pixel = Magick::Pixel.new(Magick::MaxRGB)
+ pixel = Magick::Pixel.new(Magick::QuantumRange)
assert_nothing_raised { @img.colorize(0.25, 0.25, 0.25, pixel) }
assert_nothing_raised { @img.colorize(0.25, 0.25, 0.25, 0.25, pixel) }
assert_raise(ArgumentError) { @img.colorize }
@@ -472,7 +472,7 @@ def test_colormap
res = pc_img.colormap(0)
assert_equal('red', res)
end
- pixel = Magick::Pixel.new(Magick::MaxRGB)
+ pixel = Magick::Pixel.new(Magick::QuantumRange)
assert_nothing_raised { pc_img.colormap(0, pixel) }
assert_raise(TypeError) { pc_img.colormap(0, [2]) }
pc_img.freeze
@@ -485,7 +485,7 @@ def test_color_point
assert_instance_of(Magick::Image, res)
assert_not_same(@img, res)
end
- pixel = Magick::Pixel.new(Magick::MaxRGB)
+ pixel = Magick::Pixel.new(Magick::QuantumRange)
assert_nothing_raised { @img.color_point(0, 0, pixel) }
end
@@ -494,7 +494,7 @@ def test_color_reset!
res = @img.color_reset!('red')
assert_same(@img, res)
end
- pixel = Magick::Pixel.new(Magick::MaxRGB)
+ pixel = Magick::Pixel.new(Magick::QuantumRange)
assert_nothing_raised { @img.color_reset!(pixel) }
assert_raise(TypeError) { @img.color_reset!([2]) }
assert_raise(ArgumentError) { @img.color_reset!('x') }
View
16 test/Image2.rb
@@ -490,7 +490,7 @@ def test_frame
assert_nothing_raised { @img.frame(50, 50, 25, 25, 6) }
assert_nothing_raised { @img.frame(50, 50, 25, 25, 6, 6) }
assert_nothing_raised { @img.frame(50, 50, 25, 25, 6, 6, 'red') }
- red = Magick::Pixel.new(Magick::MaxRGB)
+ red = Magick::Pixel.new(Magick::QuantumRange)
assert_nothing_raised { @img.frame(50, 50, 25, 25, 6, 6, red) }
assert_raise(TypeError) { @img.frame(50, 50, 25, 25, 6, 6, 2) }
end
@@ -626,8 +626,8 @@ def test_level
end
assert_nothing_raised { @img.level(0.0) }
assert_nothing_raised { @img.level(0.0, 1.0) }
- assert_nothing_raised { @img.level(0.0, 1.0, Magick::MaxRGB) }
- assert_raise(ArgumentError) { @img.level(0.0, 1.0, Magick::MaxRGB, 2) }
+ assert_nothing_raised { @img.level(0.0, 1.0, Magick::QuantumRange) }
+ assert_raise(ArgumentError) { @img.level(0.0, 1.0, Magick::QuantumRange, 2) }
assert_raise(ArgumentError) { @img.level('x') }
assert_raise(ArgumentError) { @img.level(0.0, 'x') }
assert_raise(ArgumentError) { @img.level(0.0, 1.0, 'x') }
@@ -653,9 +653,9 @@ def test_level_channel
assert_nothing_raised { @img.level_channel(Magick::RedChannel, 0.0) }
assert_nothing_raised { @img.level_channel(Magick::RedChannel, 0.0, 1.0) }
- assert_nothing_raised { @img.level_channel(Magick::RedChannel, 0.0, 1.0, Magick::MaxRGB) }
+ assert_nothing_raised { @img.level_channel(Magick::RedChannel, 0.0, 1.0, Magick::QuantumRange) }
- assert_raise(ArgumentError) { @img.level_channel(Magick::RedChannel, 0.0, 1.0, Magick::MaxRGB, 2) }
+ assert_raise(ArgumentError) { @img.level_channel(Magick::RedChannel, 0.0, 1.0, Magick::QuantumRange, 2) }
assert_raise(TypeError) { @img.level_channel(2) }
assert_raise(TypeError) { @img.level_channel(Magick::RedChannel, 'x') }
assert_raise(TypeError) { @img.level_channel(Magick::RedChannel, 0.0, 'x') }
@@ -819,8 +819,8 @@ def test_opaque
res = @img.opaque('white', 'red')
assert_instance_of(Magick::Image, res)
end
- red = Magick::Pixel.new(Magick::MaxRGB)
- blue = Magick::Pixel.new(0, 0, Magick::MaxRGB)
+ red = Magick::Pixel.new(Magick::QuantumRange)
+ blue = Magick::Pixel.new(0, 0, Magick::QuantumRange)
assert_nothing_raised { @img.opaque(red, blue) }
assert_raise(TypeError) { @img.opaque(red, 2) }
assert_raise(TypeError) { @img.opaque(2, blue) }
@@ -868,7 +868,7 @@ def test_pixel_color
res = @img.pixel_color(0, 0)
assert_equal('red', res.to_color)
- blue = Magick::Pixel.new(0, 0, Magick::MaxRGB)
+ blue = Magick::Pixel.new(0, 0, Magick::QuantumRange)
assert_nothing_raised { @img.pixel_color(0,0, blue) }
# If args are out-of-bounds return the background color
img = Magick::Image.new(10, 10) { self.background_color = 'blue' }
View
10 test/Image3.rb
@@ -324,8 +324,8 @@ def test_sepiatone
res = @img.sepiatone
assert_instance_of(Magick::Image, res)
end
- assert_nothing_raised { @img.sepiatone(Magick::MaxRGB*0.80) }
- assert_raise(ArgumentError) { @img.sepiatone(Magick::MaxRGB, 2) }
+ assert_nothing_raised { @img.sepiatone(Magick::QuantumRange*0.80) }
+ assert_raise(ArgumentError) { @img.sepiatone(Magick::QuantumRange, 2) }
assert_raise(TypeError) { @img.sepiatone('x') }
end
@@ -475,7 +475,7 @@ def test_splice
assert_instance_of(Magick::Image, res)
end
assert_nothing_raised { @img.splice(0, 0, 2, 2, 'red') }
- red = Magick::Pixel.new(Magick::MaxRGB)
+ red = Magick::Pixel.new(Magick::QuantumRange)
assert_nothing_raised { @img.splice(0, 0, 2, 2, red) }
assert_raise(ArgumentError) { @img.splice(0,0, 2, 2, red, 'x') }
assert_raise(TypeError) { @img.splice([], 0, 2, 2, red) }
@@ -596,7 +596,7 @@ def test_to_blob
end
def test_to_color
- red = Magick::Pixel.new(Magick::MaxRGB)
+ red = Magick::Pixel.new(Magick::QuantumRange)
assert_nothing_raised do
res = @img.to_color(red)
assert_equal('red', res)
@@ -612,7 +612,7 @@ def test_transparent
assert_nothing_raised { @img.transparent(pixel) }
assert_nothing_raised { @img.transparent('white', Magick::TransparentOpacity) }
assert_raise(ArgumentError) { @img.transparent('white', Magick::TransparentOpacity, 2) }
- assert_nothing_raised { @img.transparent('white', Magick::MaxRGB/2) }
+ assert_nothing_raised { @img.transparent('white', Magick::QuantumRange/2) }
assert_raise(TypeError) { @img.transparent(2) }
end
View
2  test/ImageList2.rb
@@ -134,7 +134,7 @@ def test_montage
assert_nothing_thrown do
montage = ilist.montage do
self.background_color = 'black'
- self.background_color = Magick::Pixel.new(Magick::MaxRGB, 0, 0)
+ self.background_color = Magick::Pixel.new(Magick::QuantumRange, 0, 0)
self.border_color = 'red'
self.border_color = Magick::Pixel.new(0, 0, 0)
self.border_width = 2
View
10 test/Image_attributes.rb
@@ -28,7 +28,7 @@ def test_background_color
assert_equal("white", @img.background_color)
assert_nothing_raised { @img.background_color = "#dfdfdf" }
assert_equal("rgb(223,223,223)", @img.background_color)
- assert_nothing_raised { @img.background_color = Magick::Pixel.new(Magick::MaxRGB, Magick::MaxRGB/2, Magick::MaxRGB/2) }
+ assert_nothing_raised { @img.background_color = Magick::Pixel.new(Magick::QuantumRange, Magick::QuantumRange/2, Magick::QuantumRange/2) }
assert_equal("rgb(100%,50%,50%)", @img.background_color)
assert_raise(TypeError) { @img.background_color = 2 }
end
@@ -57,10 +57,10 @@ def test_bias
assert_instance_of(Float, @img.bias)
assert_nothing_raised { @img.bias = 0.1 }
- assert_in_delta(Magick::MaxRGB * 0.1, @img.bias, 0.1)
+ assert_in_delta(Magick::QuantumRange * 0.1, @img.bias, 0.1)
assert_nothing_raised { @img.bias = '10%' }
- assert_in_delta(Magick::MaxRGB * 0.10, @img.bias, 0.1)
+ assert_in_delta(Magick::QuantumRange * 0.10, @img.bias, 0.1)
assert_raise(TypeError) { @img.bias = [] }
assert_raise(ArgumentError) { @img.bias = 'x' }
@@ -85,7 +85,7 @@ def test_border_color
assert_equal("rgb(223,223,223)", @img.border_color)
assert_nothing_raised { @img.border_color = "red" }
assert_equal("red", @img.border_color)
- assert_nothing_raised { @img.border_color = Magick::Pixel.new(Magick::MaxRGB, Magick::MaxRGB/2, Magick::MaxRGB/2) }
+ assert_nothing_raised { @img.border_color = Magick::Pixel.new(Magick::QuantumRange, Magick::QuantumRange/2, Magick::QuantumRange/2) }
assert_equal("rgb(100%,50%,50%)", @img.border_color)
assert_raise(TypeError) { @img.border_color = 2 }
end
@@ -361,7 +361,7 @@ def test_fuzz
assert_nothing_raised { @img.fuzz = 50 }
assert_equal(50.0, @img.fuzz)
assert_nothing_raised { @img.fuzz = '50%' }
- assert_in_delta(Magick::MaxRGB * 0.50, @img.fuzz, 0.1)
+ assert_in_delta(Magick::QuantumRange * 0.50, @img.fuzz, 0.1)
assert_raise(TypeError) { @img.fuzz = [] }
assert_raise(ArgumentError) { @img.fuzz = 'xxx' }
end
Please sign in to comment.
Something went wrong with that request. Please try again.