Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed build error with ImageMagick 6.8.8 and Ruby 2.0 #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions doc/constants.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}

/*
* Modify .simple_table for the QuantumRange/QuantumDepth table.
* Modify .simple_table for the QuantumRange/MAGICKCORE_QUANTUM_DEPTH table.
* The major differences are the centered text and the auto width.
*/
#maxrgb {
Expand Down Expand Up @@ -196,15 +196,15 @@ <h2 class="methods">Constants</h2>

<dd>Same as QuantumRange.</dd>

<dt>QuantumDepth</dt>
<dt>MAGICKCORE_QUANTUM_DEPTH</dt>

<dd>
The number of bits in a quantum. The relationship between
QuantumDepth and QuantumRange is summarized in this table.
MAGICKCORE_QUANTUM_DEPTH and QuantumRange is summarized in this table.

<table summary="number of bits in a quantum" id="maxrgb">
<tr>
<th>QuantumDepth</th>
<th>MAGICKCORE_QUANTUM_DEPTH</th>

<th>QuantumRange</th>
</tr>
Expand All @@ -229,6 +229,10 @@ <h2 class="methods">Constants</h2>
</table>
</dd>

<dt>QuantumDepth <i>(deprecated)</i></dt>

<dd>Same as MAGICKCORE_QUANTUM_DEPTH.</dd>

<dt>Version</dt>

<dd>The RMagick version string. This has the form:<br />
Expand Down
2 changes: 1 addition & 1 deletion doc/ex/mask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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')

2 changes: 1 addition & 1 deletion doc/image2.html
Original file line number Diff line number Diff line change
Expand Up @@ -2231,7 +2231,7 @@ <h4>Example</h4>
<code>pack</code>, but it does demonstrate the use of a string
<span class="arg">pixels</span> argument. Note that this
example assumes that ImageMagick is configured with
QuantumDepth=8.</p>
MAGICKCORE_QUANTUM_DEPTH=8.</p>
<pre>
hat = Image.read("Flower_Hat.jpg").first
pixels = hat.export_pixels(0, 0, hat.columns, hat.rows, "RGB")
Expand Down
4 changes: 2 additions & 2 deletions doc/image3.html
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,7 @@ <h4>Arguments</h4>
<dt>depth</dt>

<dd>The desired depth (must be no greater than <a href=
"constants.html">QuantumDepth</a>)</dd>
"constants.html">MAGICKCORE_QUANTUM_DEPTH</a>)</dd>
</dl>

<h4>Returns</h4>
Expand Down Expand Up @@ -3287,7 +3287,7 @@ <h4>Returns</h4>

<h4>Example</h4>

<p><code>threshold(MaxRGB*0.55)</code></p>
<p><code>threshold(QuantumRange*0.55)</code></p>

<p class="rollover"><a href=
"javascript:popup('threshold.rb.html')"><img src=
Expand Down
2 changes: 1 addition & 1 deletion doc/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ <h4>Description</h4>
<h4>Arguments</h4>

<p>Either 8, 16, or 32. You can specify 16 and 32 only when
ImageMagick was compiled with a QuantumDepth that allows these
ImageMagick was compiled with a MAGICKCORE_QUANTUM_DEPTH that allows these
depth values.</p>

<p>Use <code>depth</code> to specify the depth of CMYK, GRAY,
Expand Down
4 changes: 2 additions & 2 deletions doc/struct.html
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ <h4>to_color</h4>
<p><span class="arg">pixel</span>.to_color(<span class=
"arg">compliance</span>=AllCompliance, <span class=
"arg">matte</span>=<code>false</code>, <span class=
"arg">depth</span>=<code>QuantumDepth</code>, <span class=
"arg">depth</span>=<code>MAGICKCORE_QUANTUM_DEPTH</code>, <span class=
"arg">hex</span>=<code>false</code>) -&gt;
<em>string</em></p>
</div>
Expand Down Expand Up @@ -851,7 +851,7 @@ <h5>Arguments</h5>
<dd>An image depth. The default is the quantum depth used
when ImageMagick was compiled. The values 16 and 32 can be
used only when ImageMagick was compiled with the
appropriate QuantumDepth.</dd>
appropriate MAGICKCORE_QUANTUM_DEPTH.</dd>

<dt>hex</dt>

Expand Down
2 changes: 1 addition & 1 deletion examples/histogram.rb
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def histogram(fg='white', bg='black')

# Give the user something to look at while we're working.
name = File.basename(filename).sub(/\..*?$/,'')
$defout.sync = true
$stdout.sync = true
printf "Creating #{name}_Histogram.miff"

timer = Thread.new do
Expand Down
8 changes: 4 additions & 4 deletions examples/identify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def identify
puts "\tEndianess: #{endian}\n"
puts "\tColorspace: #{colorspace}\n"
puts "\tChannelDepth:\n"
color_space = gray? ? Magick::GrayColorspace : colorspace
color_space = gray? ? Magick::GRAYColorspace : colorspace
case color_space
when Magick::RGBColorspace
puts "\t\tRed: #{channel_depth(Magick::RedChannel)}-bits\n"
Expand All @@ -28,11 +28,11 @@ def identify
puts "\t\tYellow: #{channel_depth(Magick::YellowChannel)}-bits\n"
puts "\t\tBlack: #{channel_depth(Magick::BlackChannel)}-bits\n"
puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if matte
when Magick::GrayColorspace
when Magick::GRAYColorspace
puts "\t\tGray: #{channel_depth(Magick::GrayChannel)}-bits\n"
puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if matte
end
scale = Magick::QuantumRange / (Magick::QuantumRange >> (Magick::QuantumDepth-channel_depth))
scale = Magick::QuantumRange / (Magick::QuantumRange >> (Magick::MAGICKCORE_QUANTUM_DEPTH-channel_depth))
puts "\tChannel statistics:\n"
case color_space
when Magick::RGBColorspace
Expand Down Expand Up @@ -72,7 +72,7 @@ def identify
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
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::QuantumRange)
puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::GrayChannel)[1]/scale, channel_extrema(Magick::GrayChannel)[1]/Magick::QuantumRange)
Expand Down
119 changes: 37 additions & 82 deletions ext/RMagick/extconf.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "mkmf"
require "date"

RMAGICK_VERS = "0.0.0"
RMAGICK_VERS = "2.13.2"
MIN_RUBY_VERS = "1.8.5"
MIN_RUBY_VERS_NO = MIN_RUBY_VERS.tr(".","").to_i
MIN_IM_VERS = "6.4.9"
Expand Down Expand Up @@ -46,6 +46,19 @@ def exit_failure(msg)
end


def set_imagemagick_path_for_mingw()
path = ENV['PATH'].split(File::PATH_SEPARATOR)
path.each do |dir|
lib = File.join(dir, "lib")
lib_file = File.join(lib, "CORE_RL_magick_.lib")
if File.exists?(lib_file)
include = File.join(dir, "include")
$CPPFLAGS = %Q{-I"#{include}"}
$LDFLAGS = %Q{-L"#{lib}"}
break
end
end
end


# Seems like lots of people have multiple versions of ImageMagick installed.
Expand Down Expand Up @@ -152,6 +165,14 @@ def check_partial_imagemagick_versions()

$magick_version = `Magick-config --version`.chomp

# Ensure ImageMagick is not configured for HDRI
unless checking_for("HDRI disabled version of ImageMagick") do
not (`Magick-config --version`["HDRI"])
end
exit_failure "\nCan't install RMagick #{RMAGICK_VERS}."+
"\nRMagick does not work when ImageMagick is configured for High Dynamic Range Images."+
"\nDon't use the --enable-hdri option when configuring ImageMagick.\n"
end

# Save flags
$CFLAGS = ENV["CFLAGS"].to_s + " " + `Magick-config --cflags`.chomp
Expand All @@ -164,7 +185,8 @@ def check_partial_imagemagick_versions()
`convert -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-\d+ /
abort "Unable to get ImageMagick version" unless $1
$magick_version = $1
$LOCAL_LIBS = '-lCORE_RL_magick_ -lX11'
set_imagemagick_path_for_mingw()
$LOCAL_LIBS = '-lCORE_RL_magick_'

else # mswin

Expand All @@ -175,7 +197,7 @@ def check_partial_imagemagick_versions()
$CPPFLAGS = %Q{-I"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Include" -I"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\include"}
# The /link option is required by the Makefile but causes warnings in the mkmf.log file.
$LDFLAGS = %Q{/link /LIBPATH:"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Lib" /LIBPATH:"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\lib" /LIBPATH:"C:\\ruby\\lib"}
$LOCAL_LIBS = 'CORE_RL_magick_.lib X11.lib'
$LOCAL_LIBS = 'CORE_RL_magick_.lib'

end

Expand Down Expand Up @@ -206,40 +228,17 @@ def check_partial_imagemagick_versions()


have_func("snprintf", headers)
["AcquireImage", # 6.4.1
"AffinityImage", # 6.4.3-6
"AffinityImages", # 6.4.3-6
"AutoGammaImageChannel", # 6.5.5-1
["AutoGammaImageChannel", # 6.5.5-1
"AutoLevelImageChannel", # 6.5.5-1
"BlueShiftImage", # 6.5.4-3
"ColorMatrixImage", # 6.?
"ConstituteComponentTerminus", # 6.5.7-9
"DeskewImage", # 6.4.2-5
"EncipherImage", # 6.3.8-6
"EqualizeImageChannel", # 6.3.6-9
"FloodfillPaintImage", # 6.3.7
"FunctionImageChannel", # 6.4.8-8
"GetAuthenticIndexQueue", # 6.4.5-6
"GetAuthenticPixels", # 6.4.5-6
"GetImageAlphaChannel", # 6.3.9-2
"GetVirtualPixels", # 6.4.5-6
"LevelImageColors", # 6.4.2
"EvaluateImages", # 6.?
"LevelColorsImageChannel", # 6.5.6-4
"LevelizeImageChannel", # 6.4.2
"LiquidRescaleImage", # 6.3.8-2
"MagickLibAddendum", # 6.5.9-1
"OpaquePaintImageChannel", # 6.3.7-10
"QueueAuthenticPixels", # 6.4.5-6
"RemapImage", # 6.4.4-0
"RemoveImageArtifact", # 6.3.6
"SelectiveBlurImageChannel", # 6.5.0-3
"SetImageAlphaChannel", # 6.3.6-9
"SetImageArtifact", # 6.3.6
"SetMagickMemoryMethods", # 6.4.1
"SparseColorImage", # 6.3.6-?
"SyncAuthenticPixels", # 6.4.5-6
"StatisticImage", # 6.?
"TransformImageColorspace", # 6.5.1
"TransparentPaintImage", # 6.3.7-10
"TransparentPaintImageChroma" # 6.4.5-6
].each do |func|
have_func(func, headers)
end
Expand Down Expand Up @@ -273,12 +272,7 @@ def check_partial_imagemagick_versions()


have_struct_member("Image", "type", headers) # ???
have_struct_member("DrawInfo", "kerning", headers) # 6.4.7-8
have_struct_member("DrawInfo", "interline_spacing", headers) # 6.5.5-8
have_struct_member("DrawInfo", "interword_spacing", headers) # 6.4.8-0
have_type("DitherMethod", headers) # 6.4.2
have_type("MagickFunction", headers) # 6.4.8-8
have_type("ImageLayerMethod", headers) # 6.3.6 replaces MagickLayerMethod
have_type("long double", headers)
#have_type("unsigned long long", headers)
#have_type("uint64_t", headers)
Expand All @@ -288,8 +282,7 @@ def check_partial_imagemagick_versions()
#check_sizeof("Image *", headers)


have_enum_values("AlphaChannelType", ["CopyAlphaChannel", # 6.4.3-7
"BackgroundAlphaChannel"], headers) # 6.5.2-5
have_enum_values("AlphaChannelType", ["BackgroundAlphaChannel"], headers) # 6.5.2-5
have_enum_values("CompositeOperator", ["BlurCompositeOp", # 6.5.3-7
"DistortCompositeOp", # 6.5.3-10
"LinearBurnCompositeOp", # 6.5.4-3
Expand All @@ -298,57 +291,19 @@ def check_partial_imagemagick_versions()
"PegtopLightCompositeOp", # 6.5.4-3
"PinLightCompositeOp", # 6.5.4-3
"VividLightCompositeOp"], headers) # 6.5.4-3
have_enum_values("CompressionType", ["DXT1Compression", # 6.3.9-3
"DXT3Compression", # 6.3.9-3
"DXT5Compression", # 6.3.9-3
"ZipSCompression", # 6.5.5-4
have_enum_values("CompressionType", ["ZipSCompression", # 6.5.5-4
"PizCompression", # 6.5.5-4
"Pxr24Compression", # 6.5.5-4
"B44Compression", # 6.5.5-4
"B44ACompression"], headers) # 6.5.5-4

have_enum_values("DistortImageMethod", ["BarrelDistortion", # 6.4.2-5
"BarrelInverseDistortion", # 6.4.3-8
"BilinearForwardDistortion", # 6.5.1-2
"BilinearReverseDistortion", # 6.5.1-2
"DePolarDistortion", # 6.4.2-6
"PolarDistortion", # 6.4.2-6
"PolynomialDistortion", # 6.4.2-4
"ShepardsDistortion"], headers) # 6.4.2-4
have_enum_value("DitherMethod", "NoDitherMethod", headers) # 6.4.3
have_enum_values("FilterTypes", ["KaiserFilter", # 6.3.6
"WelshFilter", # 6.3.6-4
"ParzenFilter", # 6.3.6-4
"LagrangeFilter", # 6.3.7-2
"BohmanFilter", # 6.3.7-2
"BartlettFilter", # 6.3.7-2
"SentinelFilter"], headers) # 6.3.7-2
have_enum_values("MagickEvaluateOperator", ["PowEvaluateOperator", # 6.4.1-9
"LogEvaluateOperator", # 6.4.2
"ThresholdEvaluateOperator", # 6.4.3
"ThresholdBlackEvaluateOperator", # 6.4.3
"ThresholdWhiteEvaluateOperator", # 6.4.3
"GaussianNoiseEvaluateOperator", # 6.4.3
"ImpulseNoiseEvaluateOperator", # 6.4.3
"LaplacianNoiseEvaluateOperator", # 6.4.3
"MultiplicativeNoiseEvaluateOperator", # 6.4.3
"PoissonNoiseEvaluateOperator", # 6.4.3
"UniformNoiseEvaluateOperator", # 6.4.3
"CosineEvaluateOperator", # 6.4.8-5
"SineEvaluateOperator", # 6.4.8-5
"AddModulusEvaluateOperator"], # 6.4.8-5
headers)
have_enum_values("DistortImageMethod", ["BilinearForwardDistortion", # 6.5.1-2
"BilinearReverseDistortion"], # 6.5.1-2
headers)
have_enum_values("MagickFunction", ["ArcsinFunction", # 6.5.2-8
"ArctanFunction", # 6.5.2-8
"PolynomialFunction", # 6.4.8-8
"SinusoidFunction"], headers) # 6.4.8-8
have_enum_values("ImageLayerMethod", ["FlattenLayer", # 6.3.6-2
"MergeLayer", # 6.3.6
"MosaicLayer", # 6.3.6-2
"TrimBoundsLayer" ], headers) # 6.4.3-8
have_enum_values("VirtualPixelMethod", ["HorizontalTileVirtualPixelMethod", # 6.4.2-6
"VerticalTileVirtualPixelMethod", # 6.4.2-6
"HorizontalTileEdgeVirtualPixelMethod", # 6.5.0-1
"ArctanFunction"], headers) # 6.5.2-8

have_enum_values("VirtualPixelMethod", ["HorizontalTileEdgeVirtualPixelMethod", # 6.5.0-1
"VerticalTileEdgeVirtualPixelMethod", # 6.5.0-1
"CheckerTileVirtualPixelMethod"], # 6.5.0-1
headers)
Expand Down
9 changes: 6 additions & 3 deletions ext/RMagick/rmagick.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ VALUE
Magick_colors(VALUE class)
{
const ColorInfo **color_info_list;
unsigned long number_colors, x;
size_t number_colors;
unsigned long x;
volatile VALUE ary;
ExceptionInfo exception;

Expand Down Expand Up @@ -82,7 +83,8 @@ VALUE
Magick_fonts(VALUE class)
{
const TypeInfo **type_info;
unsigned long number_types, x;
size_t number_types;
unsigned long x;
volatile VALUE ary;
ExceptionInfo exception;

Expand Down Expand Up @@ -166,7 +168,8 @@ VALUE
Magick_init_formats(VALUE class)
{
const MagickInfo **magick_info;
unsigned long number_formats, x;
size_t number_formats;
unsigned long x;
volatile VALUE formats;
ExceptionInfo exception;

Expand Down
Loading