rmagick 5.5.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -3,6 +3,40 @@
3
3
  All notable changes to this project are documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## RMagick 6.0.0
7
+
8
+ Improvements
9
+
10
+ - Improve compatibility of Image#pixel_color value for ImageMagick 6 and 7 (#1591)
11
+ - Add missing constants (#1580)
12
+ - Loosen ImageMagick version check between compiled and runtime (#1526)
13
+
14
+ Bug Fixes
15
+
16
+ - Transform image according to Info#colorspace (#1594)
17
+ - Sync Image::Info attributes to image object (#1593)
18
+ - Fix install error on Windows MINGW environment (#1588)
19
+ - Fix header checks in order to use aligned_malloc expectedly (#1579)
20
+
21
+ Breaking Changes
22
+
23
+ - Change method that returns a color name to return a hex string (#1592)
24
+ - The following methods return RGBA hex string as color name. The hex string length is according to color depth.
25
+ - `Image#background_color`
26
+ - `Image#border_color`
27
+ - `Image#colormap`
28
+ - `Image#matte_color`
29
+ - `Image#transparent_color`
30
+ - `Info#background_color`
31
+ - `Info#border_color`
32
+ - `Info#matte_color`
33
+ - `Info#transparent_color`
34
+ - Change default value of argument
35
+ - The hex argument of `Pixel#to_color` has `true` by default.
36
+ - Drop ruby-mswin environment support on Windows (#1587)
37
+ - Drop Ruby 2.x support (#1540)
38
+ - Drop ImageMagick 6.7 support (#1539)
39
+
6
40
  ## RMagick 5.5.0
7
41
 
8
42
  Improvements
data/Gemfile CHANGED
@@ -4,21 +4,15 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'pry', '~> 0.14'
7
- gem 'rake-compiler', '~> 1.0'
8
- gem 'rspec', '~> 3.8'
7
+ gem 'rake-compiler', '~> 1.2'
8
+ gem 'rspec', '~> 3.13'
9
9
  gem 'rspec_junit_formatter', '~> 0.6.0'
10
- gem 'simplecov', '~> 0.16.1'
11
- gem 'yard', '~> 0.9.24'
10
+ gem 'simplecov', '~> 0.22.0'
11
+ gem 'yard', '~> 0.9.36'
12
12
 
13
- if RUBY_PLATFORM !~ /mswin|mingw/
14
- gem 'rubocop', '~> 0.81.0'
15
- gem 'rubocop-rspec', '~> 1.38.1'
16
- gem 'rubocop-performance', '~> 1.5.2'
17
- end
13
+ gem 'rubocop', '~> 1.63'
14
+ gem 'rubocop-performance', '~> 1.21'
15
+ gem 'rubocop-rspec', '~> 2.29'
18
16
 
19
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0')
20
- # For CI
21
- gem 'rbs', '~> 3.4'
22
-
23
- gem 'steep', '~> 1.6'
24
- end
17
+ gem 'rbs', '~> 3.4'
18
+ gem 'steep', '~> 1.6'
data/README.md CHANGED
@@ -42,14 +42,14 @@ These prerequisites are required for the latest version of RMagick.
42
42
  - RMagick 5.4.0 or later requires a C++ compiler.
43
43
 
44
44
  **Ruby**
45
- - Version 2.3 or later.
45
+ - Version 3.0 or later.
46
46
 
47
47
  You can get Ruby from <https://www.ruby-lang.org>.
48
48
 
49
49
  Ruby must be able to build C-Extensions (e.g. MRI, Rubinius, not JRuby)
50
50
 
51
51
  **ImageMagick**
52
- - Version 6.7.7 or later (6.x.x).
52
+ - Version 6.8.9 or later (6.x.x).
53
53
  - Version 7.0.8 or later (7.x.x). Require RMagick 4.1.0 or later.
54
54
 
55
55
  You can get ImageMagick from <https://imagemagick.org>.
@@ -138,7 +138,7 @@ gem install rmagick
138
138
  ### Versioning
139
139
 
140
140
  RMagick is versioned according to Semantic Versioning. For stable version
141
- compatible with Ruby 1.8+, use `~> 2.0`. Versions >= 3 work on Ruby >= 2.x
141
+ compatible with Ruby 3.0+, use `~> 3.0`. Versions >= 6 work on Ruby >= 3.x
142
142
  only.
143
143
 
144
144
  Using RMagick
data/Rakefile CHANGED
@@ -71,7 +71,7 @@ namespace :website do
71
71
  now = now.strftime('%m/%d/%y')
72
72
 
73
73
  lines.each do |line|
74
- line.gsub!(/0\.0\.0/, Magick::VERSION)
74
+ line.gsub!("0.0.0", Magick::VERSION)
75
75
  line.gsub!(%r{YY/MM/DD}, now)
76
76
  end
77
77
  lines
@@ -2,8 +2,6 @@
2
2
 
3
3
  set -euox pipefail
4
4
 
5
- gem install bundler -v 2.3.26 # Bundler 2.4.x has dropped support for Ruby 2.3
6
-
7
5
  if [ -v STYLE_CHECKS ]; then
8
6
  set +ux
9
7
  exit 0
@@ -15,22 +13,14 @@ if [ ! -v IMAGEMAGICK_VERSION ]; then
15
13
  exit 1
16
14
  fi
17
15
 
18
- sudo apt-get clean
19
- sudo apt-get update
20
-
21
16
  # remove all existing imagemagick related packages
22
17
  sudo apt-get autoremove -y imagemagick* libmagick* --purge
23
18
 
24
19
  # install build tools, ImageMagick delegates
25
20
  sudo apt-get install -y build-essential libx11-dev libxext-dev zlib1g-dev \
26
- liblcms2-dev libpng-dev libjpeg-dev libfreetype6-dev libxml2-dev \
21
+ liblcms2-dev libpng-dev libjpeg-dev libfreetype6-dev \
27
22
  libtiff5-dev libwebp-dev liblqr-1-0-dev vim gsfonts ghostscript
28
23
 
29
- if [ ! -d /usr/include/freetype ]; then
30
- # If `/usr/include/freetype` is not existed, ImageMagick 6.7 configuration fails about Freetype.
31
- sudo ln -sf /usr/include/freetype2 /usr/include/freetype
32
- fi
33
-
34
24
  project_dir=$(pwd)
35
25
  build_dir="${project_dir}/build-ImageMagick/ImageMagick-${IMAGEMAGICK_VERSION}"
36
26
  if [ -v CONFIGURE_OPTIONS ]; then
@@ -2,8 +2,6 @@
2
2
 
3
3
  set -euox pipefail
4
4
 
5
- gem install bundler -v 2.3.26 # Bundler 2.4.x has dropped support for Ruby 2.3
6
-
7
5
  if [ -v STYLE_CHECKS ]; then
8
6
  set +ux
9
7
  exit 0
@@ -17,10 +15,10 @@ fi
17
15
 
18
16
  export HOMEBREW_NO_AUTO_UPDATE=true
19
17
  brew uninstall --force imagemagick imagemagick@6
20
- brew install wget ghostscript freetype jpeg little-cms2 openexr libomp libpng libtiff liblqr libtool zlib webp
18
+ brew install wget ghostscript freetype libtool jpeg little-cms2 openexr libomp libpng libtiff liblqr zlib webp zstd
21
19
 
22
- export LDFLAGS="-L$(brew --prefix libxml2)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix glib)/lib -L$(brew --prefix openexr)/lib"
23
- export CPPFLAGS="-I$(brew --prefix libxml2)/include -I$(brew --prefix zlib)/include -I$(brew --prefix glib)/include/glib-2.0 -I$(brew --prefix glib)/lib/glib-2.0/include -I$(brew --prefix openexr)/include/OpenEXR"
20
+ export LDFLAGS="-L$(brew --prefix jpeg)/lib -L$(brew --prefix little-cms2)/lib -L$(brew --prefix openexr)/lib -L$(brew --prefix libomp)/lib -L$(brew --prefix libpng)/lib -L$(brew --prefix libtiff)/lib -L$(brew --prefix liblqr)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix webp)/lib -L$(brew --prefix zstd)/lib"
21
+ export CPPFLAGS="-I$(brew --prefix jpeg)/include -I$(brew --prefix openexr)/include/OpenEXR -I$(brew --prefix libtiff)/include -I$(brew --prefix zlib)/include -I$(brew --prefix zstd)/include -I$(brew --prefix glib)/include/glib-2.0 -I$(brew --prefix glib)/lib/glib-2.0/include"
24
22
 
25
23
  project_dir=$(pwd)
26
24
  build_dir="${project_dir}/build-ImageMagick/ImageMagick-${IMAGEMAGICK_VERSION}"
@@ -43,7 +41,7 @@ build_imagemagick() {
43
41
  fi
44
42
 
45
43
  cd "${build_dir}"
46
- ./configure --prefix=/usr/local "${options}" --without-raw --without-jxl --without-openjp2
44
+ ./configure --prefix=/usr/local "${options}" --without-raw
47
45
  make -j
48
46
  }
49
47
 
@@ -52,7 +50,7 @@ if [ ! -d "${build_dir}" ]; then
52
50
  fi
53
51
 
54
52
  cd "${build_dir}"
55
- make install -j
53
+ sudo make install -j
56
54
  cd "${project_dir}"
57
55
 
58
56
  set +ux
@@ -4,21 +4,12 @@ require 'rubygems'
4
4
  require 'mkmf'
5
5
  require 'pkg-config'
6
6
 
7
- module MakeMakefile
8
- # Use the C++ compiler to retrieve the information needed to create a Makefile for mswin environment.
9
- remove_const(:CONFTEST_C)
10
- CONFTEST_C = "#{CONFTEST}.cpp"
11
- end
12
-
13
7
  module RMagick
14
8
  class Extconf
15
9
  require 'rmagick/version'
16
10
  RMAGICK_VERS = ::Magick::VERSION
17
11
  MIN_RUBY_VERS = ::Magick::MIN_RUBY_VERSION
18
12
 
19
- # ImageMagick 6.7 package
20
- IM6_7_PACKAGES = ['ImageMagick'].freeze
21
-
22
13
  # ImageMagick 6.8+ packages
23
14
  IM6_PACKAGES = %w[
24
15
  ImageMagick-6.Q64HDRI
@@ -48,6 +39,8 @@ module RMagick
48
39
  def initialize
49
40
  @stdout = $stdout.dup
50
41
 
42
+ exit_failure("No longer support MSWIN environment.") if RUBY_PLATFORM.include?('mswin')
43
+
51
44
  setup_pkg_config_path
52
45
  assert_can_compile!
53
46
  configure_compile_options
@@ -55,7 +48,7 @@ module RMagick
55
48
  end
56
49
 
57
50
  def setup_pkg_config_path
58
- return if RUBY_PLATFORM =~ /mswin|mingw/
51
+ return if RUBY_PLATFORM.include?('mingw')
59
52
 
60
53
  if find_executable('brew')
61
54
  append_pkg_config_path("#{`brew --prefix imagemagick`.strip}/lib/pkgconfig")
@@ -93,11 +86,25 @@ module RMagick
93
86
  else
94
87
  exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find magick/MagickCore.h."
95
88
  end
89
+
90
+ if have_header('malloc.h')
91
+ headers << 'malloc.h'
92
+ elsif have_header('malloc/malloc.h')
93
+ headers << 'malloc/malloc.h'
94
+ end
96
95
  end
97
96
 
98
97
  def configure_compile_options
99
98
  # Magick-config is not available on Windows
100
- if RUBY_PLATFORM !~ /mswin|mingw/
99
+ if RUBY_PLATFORM.include?('mingw') # mingw
100
+
101
+ dir_paths = search_paths_for_windows
102
+ $CPPFLAGS += %( -I"#{dir_paths[:include]}")
103
+ $CPPFLAGS += ' -x c++ -std=c++11 -Wno-register'
104
+ $LDFLAGS += %( -L"#{dir_paths[:root]}" -lucrt)
105
+ $LDFLAGS += (im_version_at_least?('7.0.0') ? ' -lCORE_RL_MagickCore_' : ' -lCORE_RL_magick_')
106
+
107
+ else
101
108
 
102
109
  check_multiple_imagemagick_versions
103
110
  check_partial_imagemagick_versions
@@ -119,31 +126,9 @@ module RMagick
119
126
  $LDFLAGS = "#{original_ldflags} #{ldflags}"
120
127
  end
121
128
 
122
- configure_archflags_for_osx($magick_package) if RUBY_PLATFORM =~ /darwin/ # osx
123
-
124
- elsif RUBY_PLATFORM =~ /mingw/ # mingw
125
-
126
- dir_paths = search_paths_for_library_for_windows
127
- $CPPFLAGS += %( -I"#{dir_paths[:include]}")
128
- $CPPFLAGS += ' -x c++ -std=c++11 -Wno-register'
129
- $LDFLAGS += %( -L"#{dir_paths[:lib]}")
130
- $LDFLAGS << ' -lucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
131
-
132
- have_library(im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_' : 'CORE_RL_magick_')
129
+ configure_archflags_for_osx($magick_package) if RUBY_PLATFORM.include?('darwin') # osx
133
130
 
134
- else # mswin
135
-
136
- dir_paths = search_paths_for_library_for_windows
137
- $CPPFLAGS << %( -I"#{dir_paths[:include]}")
138
- $LDFLAGS << %( -libpath:"#{dir_paths[:lib]}")
139
- $LDFLAGS << ' -libpath:ucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
140
-
141
- $LOCAL_LIBS += ' ' + (im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_.lib' : 'CORE_RL_magick_.lib')
142
-
143
- $CPPFLAGS += ' /std:c++11'
144
131
  end
145
- ruby_version = RUBY_VERSION.split('.')
146
- $CPPFLAGS += " -DRUBY_VERSION_MAJOR=#{ruby_version[0]} -DRUBY_VERSION_MINOR=#{ruby_version[1]}"
147
132
  $CPPFLAGS += ' $(optflags) $(debugflags)'
148
133
  end
149
134
 
@@ -181,11 +166,6 @@ module RMagick
181
166
  def determine_imagemagick_package
182
167
  packages = [installed_im7_packages, installed_im6_packages].flatten
183
168
 
184
- if packages.empty?
185
- # ImageMagick 6.7 does not have package file like ImageMagick-6.Q16.pc
186
- packages = detect_imagemagick_packages(IM6_7_PACKAGES)
187
- end
188
-
189
169
  if packages.empty?
190
170
  exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find ImageMagick with pkg-config\n"
191
171
  end
@@ -269,10 +249,10 @@ module RMagick
269
249
  # issue #169
270
250
  # set ARCHFLAGS appropriately for OSX
271
251
  def configure_archflags_for_osx(magick_package)
272
- return unless PKGConfig.libs_only_L(magick_package).match(%r{-L(.+)/lib})
252
+ return unless PKGConfig.libs_only_L(magick_package) =~ %r{-L(.+)/lib}
273
253
 
274
254
  imagemagick_dir = Regexp.last_match(1)
275
- command = Dir.glob(File.join(imagemagick_dir, "bin/*")).select { |file| File.executable? file }.first
255
+ command = Dir.glob(File.join(imagemagick_dir, "bin/*")).find { |file| File.executable? file }
276
256
  fileinfo = `file #{command}`
277
257
 
278
258
  # default ARCHFLAGS
@@ -286,28 +266,27 @@ module RMagick
286
266
  $ARCH_FLAG = archflags.join(' ') unless archflags.empty?
287
267
  end
288
268
 
289
- def search_paths_for_library_for_windows
269
+ def search_paths_for_windows
290
270
  msg = 'searching PATH for the ImageMagick library...'
291
271
  Logging.message msg
292
272
  message msg + "\n"
293
273
 
294
- found_lib = false
274
+ found = false
295
275
  dir_paths = {}
296
276
 
297
277
  paths = ENV['PATH'].split(File::PATH_SEPARATOR)
298
278
  paths.each do |dir|
299
- lib = File.join(dir, 'lib')
300
- lib_file = File.join(lib, im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_.lib' : 'CORE_RL_magick_.lib')
301
- next unless File.exist?(lib_file)
279
+ dll = File.join(dir, im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_.dll' : 'CORE_RL_magick_.dll')
280
+ next unless File.exist?(dll)
302
281
 
303
282
  dir_paths[:include] = File.join(dir, 'include')
304
- dir_paths[:lib] = lib
283
+ dir_paths[:root] = dir
305
284
 
306
- found_lib = true
285
+ found = true
307
286
  break
308
287
  end
309
288
 
310
- return dir_paths if found_lib
289
+ return dir_paths if found
311
290
 
312
291
  exit_failure <<~END_MINGW
313
292
  Can't install RMagick #{RMAGICK_VERS}.
@@ -322,7 +301,7 @@ module RMagick
322
301
  assert_has_dev_libs!
323
302
 
324
303
  # Check for compiler. Extract first word so ENV['CXX'] can be a program name with arguments.
325
- cxx = (ENV['CXX'] || RbConfig::CONFIG['CXX'] || 'g++').split(' ').first
304
+ cxx = (ENV['CXX'] || RbConfig::CONFIG['CXX'] || 'g++').split.first
326
305
  exit_failure "No C++ compiler found in ${ENV['PATH']}. See mkmf.log for details." unless find_executable(cxx)
327
306
  end
328
307
 
@@ -341,17 +320,17 @@ module RMagick
341
320
  Check the mkmf.log file for more detailed information.
342
321
  END_FAILURE
343
322
 
344
- if RUBY_PLATFORM !~ /mswin|mingw/
323
+ if RUBY_PLATFORM.include?('mingw')
324
+ `#{magick_command} -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
325
+ $magick_version = Regexp.last_match(1)
326
+ exit_failure failure_message unless $magick_version
327
+ else
345
328
  unless PKGConfig.libs('MagickCore')[/\bl\s*(MagickCore|Magick)6?\b/]
346
329
  exit_failure failure_message
347
330
  end
348
331
 
349
332
  $magick_package = determine_imagemagick_package
350
333
  $magick_version = PKGConfig.modversion($magick_package)[/^(\d+\.\d+\.\d+)/]
351
- else
352
- `#{magick_command} -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
353
- $magick_version = Regexp.last_match(1)
354
- exit_failure failure_message unless $magick_version
355
334
  end
356
335
 
357
336
  # Ensure minimum ImageMagick version
@@ -365,8 +344,6 @@ module RMagick
365
344
 
366
345
  def create_header_file
367
346
  ruby_api = [
368
- 'rb_gc_adjust_memory_usage', # Ruby 2.4.0
369
- 'rb_gc_mark_movable', # Ruby 2.7.0
370
347
  'rb_io_path' # Ruby 3.2.0
371
348
  ]
372
349
  memory_api = %w[
@@ -386,15 +363,10 @@ module RMagick
386
363
  have_func(func, headers)
387
364
  end
388
365
 
389
- unless have_header('malloc.h')
390
- have_header('malloc/malloc.h')
391
- end
392
-
393
366
  # Miscellaneous constants
394
367
  $defs.push("-DRUBY_VERSION_STRING=\"ruby #{RUBY_VERSION}\"")
395
368
  $defs.push("-DRMAGICK_VERSION_STRING=\"RMagick #{RMAGICK_VERS}\"")
396
369
 
397
- $defs.push('-DIMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9=1') if im_version_at_least?('6.8.9')
398
370
  $defs.push('-DIMAGEMAGICK_GREATER_THAN_EQUAL_6_9_0=1') if im_version_at_least?('6.9.0')
399
371
  $defs.push('-DIMAGEMAGICK_GREATER_THAN_EQUAL_6_9_10=1') if im_version_at_least?('6.9.10')
400
372
  $defs.push('-DIMAGEMAGICK_7=1') if im_version_at_least?('7.0.0')
@@ -415,7 +387,7 @@ module RMagick
415
387
  end
416
388
 
417
389
  def create_compile_flags_txt
418
- cppflags = $CPPFLAGS.split(' ')
390
+ cppflags = $CPPFLAGS.split
419
391
  include_flags = cppflags.select { |flag| flag.start_with?('-I') }
420
392
  define_flags = cppflags.select { |flag| flag.start_with?('-D') } + $defs
421
393
 
@@ -310,10 +310,8 @@ typedef enum _QuantumExpressionOperator
310
310
  AbsQuantumOperator, /**< abs */
311
311
  ExponentialQuantumOperator, /**< exponential */
312
312
  MedianQuantumOperator, /**< median */
313
- SumQuantumOperator /**< sum */
314
- #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
315
- , RootMeanSquareQuantumOperator /** root mean square */
316
- #endif
313
+ SumQuantumOperator, /**< sum */
314
+ RootMeanSquareQuantumOperator /** root mean square */
317
315
  } QuantumExpressionOperator ;
318
316
 
319
317
 
@@ -1227,13 +1225,8 @@ MagickExport void UnityAddKernelInfo(KernelInfo *kernel, const double scale);
1227
1225
  MagickExport void ScaleKernelInfo(KernelInfo *kernel, const double scaling_factor, const GeometryFlags normalize_flags);
1228
1226
  #endif
1229
1227
 
1230
- #if (RUBY_VERSION_MAJOR == 2 && RUBY_VERSION_MINOR < 7)
1231
- #define RESCUE_FUNC(func) (VALUE (*)(ANYARGS))(func)
1232
- #define RESCUE_EXCEPTION_HANDLER_FUNC(func) (VALUE (*)(ANYARGS))(func)
1233
- #else
1234
- #define RESCUE_FUNC(func) (VALUE(*)(VALUE))(func)
1235
- #define RESCUE_EXCEPTION_HANDLER_FUNC(func) (VALUE(*)(VALUE, VALUE))(func)
1236
- #endif
1228
+ #define RESCUE_FUNC(func) (VALUE(*)(VALUE))(func)
1229
+ #define RESCUE_EXCEPTION_HANDLER_FUNC(func) (VALUE(*)(VALUE, VALUE))(func)
1237
1230
 
1238
1231
  } // extern "C"
1239
1232
 
@@ -13,9 +13,7 @@
13
13
  #include "rmagick.h"
14
14
  #include "float.h"
15
15
 
16
- #ifdef HAVE_RB_GC_MARK_MOVABLE
17
16
  static void Draw_compact(void *drawptr);
18
- #endif
19
17
  static void Draw_mark(void *);
20
18
  static void Draw_destroy(void *);
21
19
  static size_t Draw_memsize(const void *);
@@ -28,9 +26,7 @@ const rb_data_type_t rm_draw_data_type = {
28
26
  Draw_mark,
29
27
  Draw_destroy,
30
28
  Draw_memsize,
31
- #ifdef HAVE_RB_GC_MARK_MOVABLE
32
29
  Draw_compact,
33
- #endif
34
30
  },
35
31
  0, 0,
36
32
  RUBY_TYPED_FROZEN_SHAREABLE,
@@ -1277,7 +1273,6 @@ Draw_primitive(VALUE self, VALUE primitive)
1277
1273
  return self;
1278
1274
  }
1279
1275
 
1280
- #ifdef HAVE_RB_GC_MARK_MOVABLE
1281
1276
  /**
1282
1277
  * Compact the objects.
1283
1278
  *
@@ -1295,7 +1290,6 @@ Draw_compact(void *drawptr)
1295
1290
  draw->primitives = rb_gc_location(draw->primitives);
1296
1291
  }
1297
1292
  }
1298
- #endif
1299
1293
 
1300
1294
  /**
1301
1295
  * Mark referenced objects.
@@ -1311,11 +1305,7 @@ Draw_mark(void *drawptr)
1311
1305
 
1312
1306
  if (draw->primitives != (VALUE)0)
1313
1307
  {
1314
- #ifdef HAVE_RB_GC_MARK_MOVABLE
1315
1308
  rb_gc_mark_movable(draw->primitives);
1316
- #else
1317
- rb_gc_mark(draw->primitives);
1318
- #endif
1319
1309
  }
1320
1310
  }
1321
1311
 
@@ -288,17 +288,11 @@ DEFINE_GVL_STUB2(WriteImage, const ImageInfo *, Image *);
288
288
  DEFINE_GVL_STUB4(GetImageChannelEntropy, const Image *, const ChannelType, double *, ExceptionInfo *);
289
289
  #endif
290
290
 
291
- #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
292
291
  DEFINE_GVL_STUB3(RotationalBlurImage, const Image *, const double, ExceptionInfo *);
293
- #else
294
- DEFINE_GVL_STUB3(RadialBlurImage, const Image *, const double, ExceptionInfo *);
295
- #endif
296
292
 
297
293
  #if defined(IMAGEMAGICK_7)
298
- #elif defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
299
- DEFINE_GVL_STUB4(RotationalBlurImageChannel, const Image *, const ChannelType, const double, ExceptionInfo *);
300
294
  #else
301
- DEFINE_GVL_STUB4(RadialBlurImageChannel, const Image *, const ChannelType, const double, ExceptionInfo *);
295
+ DEFINE_GVL_STUB4(RotationalBlurImageChannel, const Image *, const ChannelType, const double, ExceptionInfo *);
302
296
  #endif
303
297
 
304
298
  /**
@@ -2327,6 +2321,7 @@ Image_capture(int argc, VALUE *argv, VALUE self ATTRIBUTE_UNUSED)
2327
2321
  rm_ensure_result(new_image);
2328
2322
 
2329
2323
  rm_set_user_artifact(new_image, image_info);
2324
+ rm_sync_image_options(new_image, image_info);
2330
2325
 
2331
2326
  RB_GC_GUARD(info_obj);
2332
2327
 
@@ -7307,6 +7302,7 @@ Image_from_blob(VALUE klass ATTRIBUTE_UNUSED, VALUE blob_arg)
7307
7302
 
7308
7303
  rm_ensure_result(images);
7309
7304
  rm_set_user_artifact(images, info);
7305
+ rm_sync_image_options(images, info);
7310
7306
 
7311
7307
  RB_GC_GUARD(info_obj);
7312
7308
 
@@ -7963,26 +7959,7 @@ Image_gray_q(VALUE self)
7963
7959
  #if defined(HAVE_SETIMAGEGRAY)
7964
7960
  return has_attribute(self, (MagickBooleanType (*)(const Image *, ExceptionInfo *))SetImageGray);
7965
7961
  #else
7966
- #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
7967
7962
  return has_attribute(self, IsGrayImage);
7968
- #else
7969
- // For ImageMagick 6.7
7970
- Image *image;
7971
- ColorspaceType colorspace;
7972
- VALUE ret;
7973
-
7974
- image = rm_check_destroyed(self);
7975
- colorspace = image->colorspace;
7976
- if (image->colorspace == sRGBColorspace || image->colorspace == TransparentColorspace) {
7977
- // Workaround
7978
- // If image colorspace has non-RGBColorspace, IsGrayImage() always return false.
7979
- image->colorspace = RGBColorspace;
7980
- }
7981
-
7982
- ret = has_attribute(self, IsGrayImage);
7983
- image->colorspace = colorspace;
7984
- return ret;
7985
- #endif
7986
7963
  #endif
7987
7964
  }
7988
7965
 
@@ -9931,6 +9908,8 @@ Image_initialize(int argc, VALUE *argv, VALUE self)
9931
9908
  CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SetImageExtent), &args);
9932
9909
  #endif
9933
9910
 
9911
+ rm_sync_image_options(image, info);
9912
+
9934
9913
  // If the caller did not supply a fill argument, call SetImageBackgroundColor
9935
9914
  // to fill the image using the background color. The background color can
9936
9915
  // be set by specifying it when creating the Info parm block.
@@ -10671,11 +10650,11 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
10671
10650
  DestroyExceptionInfo(exception);
10672
10651
 
10673
10652
  #if defined(IMAGEMAGICK_7)
10674
- old_color.red = GetPixelRed(image, old_pixel);
10675
- old_color.green = GetPixelGreen(image, old_pixel);
10676
- old_color.blue = GetPixelBlue(image, old_pixel);
10677
- old_color.alpha = GetPixelAlpha(image, old_pixel);
10678
- old_color.black = GetPixelBlack(image, old_pixel);
10653
+ old_color.red = GetPixelRed(image, old_pixel) + 0.5;
10654
+ old_color.green = GetPixelGreen(image, old_pixel) + 0.5;
10655
+ old_color.blue = GetPixelBlue(image, old_pixel) + 0.5;
10656
+ old_color.alpha = GetPixelAlpha(image, old_pixel) + 0.5;
10657
+ old_color.black = GetPixelBlack(image, old_pixel) + 0.5;
10679
10658
  return Pixel_from_PixelPacket(&old_color);
10680
10659
  #else
10681
10660
  old_color = *old_pixel;
@@ -10750,11 +10729,11 @@ Image_pixel_color(int argc, VALUE *argv, VALUE self)
10750
10729
  if (pixel)
10751
10730
  {
10752
10731
  #if defined(IMAGEMAGICK_7)
10753
- old_color.red = GetPixelRed(image, pixel);
10754
- old_color.green = GetPixelGreen(image, pixel);
10755
- old_color.blue = GetPixelBlue(image, pixel);
10756
- old_color.alpha = GetPixelAlpha(image, pixel);
10757
- old_color.black = GetPixelBlack(image, pixel);
10732
+ old_color.red = GetPixelRed(image, pixel) + 0.5;
10733
+ old_color.green = GetPixelGreen(image, pixel) + 0.5;
10734
+ old_color.blue = GetPixelBlue(image, pixel) + 0.5;
10735
+ old_color.alpha = GetPixelAlpha(image, pixel) + 0.5;
10736
+ old_color.black = GetPixelBlack(image, pixel) + 0.5;
10758
10737
 
10759
10738
  SetPixelRed(image, new_color.red, pixel);
10760
10739
  SetPixelGreen(image, new_color.green, pixel);
@@ -11185,11 +11164,9 @@ Image_quantum_operator(int argc, VALUE *argv, VALUE self)
11185
11164
  case SumQuantumOperator:
11186
11165
  qop = SumEvaluateOperator;
11187
11166
  break;
11188
- #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
11189
11167
  case RootMeanSquareQuantumOperator:
11190
11168
  qop = RootMeanSquareEvaluateOperator;
11191
11169
  break;
11192
- #endif
11193
11170
  }
11194
11171
 
11195
11172
  exception = AcquireExceptionInfo();
@@ -11307,15 +11284,9 @@ Image_radial_blur(VALUE self, VALUE angle_obj)
11307
11284
  image = rm_check_destroyed(self);
11308
11285
  exception = AcquireExceptionInfo();
11309
11286
 
11310
- #if defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
11311
11287
  GVL_STRUCT_TYPE(RotationalBlurImage) args = { image, angle, exception };
11312
11288
  void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RotationalBlurImage), &args);
11313
11289
  new_image = reinterpret_cast<decltype(new_image)>(ret);
11314
- #else
11315
- GVL_STRUCT_TYPE(RadialBlurImage) args = { image, angle, exception };
11316
- void *ret = CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RadialBlurImage), &args);
11317
- new_image = reinterpret_cast<decltype(new_image)>(ret);
11318
- #endif
11319
11290
  rm_check_exception(exception, new_image, DestroyOnError);
11320
11291
  DestroyExceptionInfo(exception);
11321
11292
 
@@ -11366,12 +11337,9 @@ Image_radial_blur_channel(int argc, VALUE *argv, VALUE self)
11366
11337
  new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RotationalBlurImage), &args);
11367
11338
  CHANGE_RESULT_CHANNEL_MASK(new_image);
11368
11339
  END_CHANNEL_MASK(image);
11369
- #elif defined(IMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9)
11340
+ #else
11370
11341
  GVL_STRUCT_TYPE(RotationalBlurImageChannel) args = { image, channels, angle, exception };
11371
11342
  new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RotationalBlurImageChannel), &args);
11372
- #else
11373
- GVL_STRUCT_TYPE(RadialBlurImageChannel) args = { image, channels, angle, exception };
11374
- new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(RadialBlurImageChannel), &args);
11375
11343
  #endif
11376
11344
  rm_check_exception(exception, new_image, DestroyOnError);
11377
11345
  DestroyExceptionInfo(exception);
@@ -11630,9 +11598,11 @@ rd_image(VALUE klass ATTRIBUTE_UNUSED, VALUE file, gvl_function_t fp)
11630
11598
  #endif
11631
11599
 
11632
11600
  rm_check_exception(exception, images, DestroyOnError);
11633
- rm_set_user_artifact(images, info);
11634
11601
  DestroyExceptionInfo(exception);
11635
11602
 
11603
+ rm_set_user_artifact(images, info);
11604
+ rm_sync_image_options(images, info);
11605
+
11636
11606
  RB_GC_GUARD(info_obj);
11637
11607
 
11638
11608
  return array_from_images(images);
@@ -11774,9 +11744,10 @@ Image_read_inline(VALUE self ATTRIBUTE_UNUSED, VALUE content)
11774
11744
  magick_free((void *)blob);
11775
11745
 
11776
11746
  rm_check_exception(exception, images, DestroyOnError);
11777
-
11778
11747
  DestroyExceptionInfo(exception);
11748
+
11779
11749
  rm_set_user_artifact(images, info);
11750
+ rm_sync_image_options(images, info);
11780
11751
 
11781
11752
  RB_GC_GUARD(info_obj);
11782
11753