rmagick 5.4.4 → 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.
- checksums.yaml +4 -4
- data/.devcontainer/ImageMagick6/devcontainer.json +1 -1
- data/.devcontainer/devcontainer.json +1 -1
- data/.github/workflows/ci.yml +41 -31
- data/.gitignore +1 -0
- data/.rubocop.yml +36 -9
- data/.rubocop_todo.yml +369 -187
- data/CHANGELOG.md +77 -0
- data/Gemfile +14 -0
- data/README.md +3 -3
- data/Rakefile +12 -1
- data/before_install_linux.sh +1 -11
- data/before_install_osx.sh +5 -7
- data/ext/RMagick/extconf.rb +58 -68
- data/ext/RMagick/rmagick.h +7 -12
- data/ext/RMagick/rmdraw.cpp +10 -20
- data/ext/RMagick/rmfill.cpp +4 -4
- data/ext/RMagick/rmilist.cpp +10 -2
- data/ext/RMagick/rmimage.cpp +342 -344
- data/ext/RMagick/rminfo.cpp +22 -21
- data/ext/RMagick/rmkinfo.cpp +5 -18
- data/ext/RMagick/rmmain.cpp +42 -91
- data/ext/RMagick/rmmontage.cpp +5 -5
- data/ext/RMagick/rmpixel.cpp +3 -3
- data/ext/RMagick/rmutil.cpp +58 -89
- data/lib/rmagick/version.rb +3 -3
- data/lib/rmagick.rb +1 -1
- data/lib/rmagick_internal.rb +111 -103
- data/lib/rvg/container.rb +3 -3
- data/lib/rvg/embellishable.rb +7 -3
- data/lib/rvg/misc.rb +15 -15
- data/lib/rvg/rvg.rb +6 -6
- data/lib/rvg/stretchable.rb +2 -2
- data/lib/rvg/stylable.rb +2 -2
- data/lib/rvg/transformable.rb +1 -1
- data/lib/rvg/units.rb +1 -0
- data/rmagick.gemspec +2 -15
- data/sig/rmagick/_draw_common_methods.rbs +64 -0
- data/sig/rmagick/_image_common_methods.rbs +387 -0
- data/sig/rmagick/draw.rbs +38 -0
- data/sig/rmagick/draw_attribute.rbs +28 -0
- data/sig/rmagick/enum.rbs +820 -0
- data/sig/rmagick/error.rbs +11 -0
- data/sig/rmagick/fill.rbs +21 -0
- data/sig/rmagick/geometry.rbs +14 -0
- data/sig/rmagick/image.rbs +196 -0
- data/sig/rmagick/image_list.rbs +183 -0
- data/sig/rmagick/iptc.rbs +101 -0
- data/sig/rmagick/kernel_info.rbs +12 -0
- data/sig/rmagick/optional_method_arguments.rbs +10 -0
- data/sig/rmagick/pixel.rbs +46 -0
- data/sig/rmagick/struct.rbs +90 -0
- data/sig/rmagick.rbs +43 -0
- data/sig/rvg/clippath.rbs +34 -0
- data/sig/rvg/container.rbs +78 -0
- data/sig/rvg/deep_equal.rbs +48 -0
- data/sig/rvg/describable.rbs +30 -0
- data/sig/rvg/embellishable.rbs +226 -0
- data/sig/rvg/misc.rbs +145 -0
- data/sig/rvg/paint.rbs +55 -0
- data/sig/rvg/pathdata.rbs +77 -0
- data/sig/rvg/rvg.rbs +125 -0
- data/sig/rvg/stretchable.rbs +56 -0
- data/sig/rvg/stylable.rbs +66 -0
- data/sig/rvg/text.rbs +118 -0
- data/sig/rvg/transformable.rbs +59 -0
- data/sig/rvg/units.rbs +33 -0
- metadata +38 -134
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,83 @@
|
|
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
|
+
|
40
|
+
## RMagick 5.5.0
|
41
|
+
|
42
|
+
Improvements
|
43
|
+
|
44
|
+
- Add RBS signatures (#1458)
|
45
|
+
- Remove unnecessary type check in KernelInfo#{unity_add, scale} (#1514)
|
46
|
+
- Remove unnecessary type check in Image#{morphology, morphology_channel} (#1513)
|
47
|
+
- Improve HatchFill.new to accept Pixel object as color (#1512)
|
48
|
+
- Fix GraphicContext#font_weight to accept Numeric object (#1510)
|
49
|
+
- Improve GraphicContext#font_weight to accept Symbol object (#1509)
|
50
|
+
- Improve Stretchable#viewbox to use implicitly conversioned value (#1507)
|
51
|
+
- Improve RVG::Transformable#rotate to convert to Float implicitly (#1506)
|
52
|
+
- Fix Image#modulate in order to accept negative number (#1505)
|
53
|
+
- Improve Image#modulate to accept "NN%" form string (#1504)
|
54
|
+
- Implicit conversion to string with methods that expect a string (#1496)
|
55
|
+
- Coerce to string instead of using #to_s (#1495)
|
56
|
+
- Coerce to string where pass object into string interpolation (#1494)
|
57
|
+
- Fix Draw#{fill_opacity, opacity, stroke_opacity} to correctly handle arguments (#1492)
|
58
|
+
- Fix Draw#{interline_spacing, interword_spacing, kerning} to correctly handle arguments that can be converted to Float (#1491)
|
59
|
+
- Remove unnecessary type check in KernelInfo methods (#1489)
|
60
|
+
- Generate compile_flags.txt for clangd for development (#1488)
|
61
|
+
- Fix Draw#{stroke_dasharray, stroke_miterlimit} to accept object which has #to_f method (#1486)
|
62
|
+
- Fix Image#composite_affine to accept ImageList object (#1484)
|
63
|
+
- Fix Image#add_compose_mask to accept ImageList object (#1483)
|
64
|
+
- Fix incorrect number of required arguments in ArgumentError (#1482)
|
65
|
+
- Fix ImageList#sort! that should return self (#1481)
|
66
|
+
- Fix ImageList#eql? that should not raise exception if can't compare (#1479)
|
67
|
+
- Fix ImageList#<=> that should return nil if can't compare (#1478)
|
68
|
+
- Add DrawAttribute module to simplify Draw, DrawOptions and PolaroidOptions (#1477)
|
69
|
+
- Add missing attribute writer methods in Image::{DrawOptions, PolaroidOptions} (#1476)
|
70
|
+
- Add Image::PolaroidOptions#affine= (#1475)
|
71
|
+
- Add Image::PolaroidOptions#tile= (#1474)
|
72
|
+
- Attribute writer methods should return passed value (#1473)
|
73
|
+
- Return self with ImageList if Image's method return self (#1472)
|
74
|
+
- Fix Image#clut_channel to accept ImageList object (#1471)
|
75
|
+
- Fix Magick::GradientFill#fill and Magick::TextureFill#fill to accept ImageList object (#1467)
|
76
|
+
|
77
|
+
Bug Fixes
|
78
|
+
|
79
|
+
- Fix typo in order to fix NoMethodError (#1515)
|
80
|
+
- Sync compression value in order fix the problem of compression being ignored by ImageMagick 7 (#1503)
|
81
|
+
- Add PKG_CONFIG_PATH for ImageMagick 7 in order to fix installation error on macOS (#1501)
|
82
|
+
|
6
83
|
## RMagick 5.4.4
|
7
84
|
|
8
85
|
Bug Fixes
|
data/Gemfile
CHANGED
@@ -2,3 +2,17 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in rmagick.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
gem 'pry', '~> 0.14'
|
7
|
+
gem 'rake-compiler', '~> 1.2'
|
8
|
+
gem 'rspec', '~> 3.13'
|
9
|
+
gem 'rspec_junit_formatter', '~> 0.6.0'
|
10
|
+
gem 'simplecov', '~> 0.22.0'
|
11
|
+
gem 'yard', '~> 0.9.36'
|
12
|
+
|
13
|
+
gem 'rubocop', '~> 1.63'
|
14
|
+
gem 'rubocop-performance', '~> 1.21'
|
15
|
+
gem 'rubocop-rspec', '~> 2.29'
|
16
|
+
|
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
|
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.
|
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
|
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!(
|
74
|
+
line.gsub!("0.0.0", Magick::VERSION)
|
75
75
|
line.gsub!(%r{YY/MM/DD}, now)
|
76
76
|
end
|
77
77
|
lines
|
@@ -143,6 +143,17 @@ namespace :website do
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
+
namespace :rbs do
|
147
|
+
desc 'Validate RBS definitions'
|
148
|
+
task :validate do
|
149
|
+
all_sigs = Dir.glob('sig').map { |dir| "-I #{dir}" }.join(' ')
|
150
|
+
sh("bundle exec rbs #{all_sigs} validate") do |ok, _|
|
151
|
+
abort('one or more rbs validate failed') unless ok
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
require 'bundler/gem_tasks'
|
146
157
|
require 'rake/extensiontask'
|
147
158
|
require 'rspec/core/rake_task'
|
148
159
|
RSpec::Core::RakeTask.new(:spec)
|
data/before_install_linux.sh
CHANGED
@@ -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
|
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
|
data/before_install_osx.sh
CHANGED
@@ -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
|
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
|
23
|
-
export CPPFLAGS="-I$(brew --prefix
|
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
|
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
|
data/ext/RMagick/extconf.rb
CHANGED
@@ -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,19 +48,20 @@ module RMagick
|
|
55
48
|
end
|
56
49
|
|
57
50
|
def setup_pkg_config_path
|
58
|
-
return if RUBY_PLATFORM
|
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")
|
55
|
+
append_pkg_config_path("#{`brew --prefix imagemagick@6`.strip}/lib/pkgconfig")
|
62
56
|
elsif find_executable('pacman')
|
63
|
-
|
64
|
-
else
|
65
|
-
return
|
57
|
+
append_pkg_config_path('/usr/lib/imagemagick6/pkgconfig')
|
66
58
|
end
|
59
|
+
end
|
67
60
|
|
61
|
+
def append_pkg_config_path(path)
|
68
62
|
pkg_config_paths = ENV['PKG_CONFIG_PATH'].to_s.split(':')
|
69
|
-
if File.exist?(
|
70
|
-
ENV['PKG_CONFIG_PATH'] = [ENV['PKG_CONFIG_PATH'],
|
63
|
+
if File.exist?(path) && !pkg_config_paths.include?(path)
|
64
|
+
ENV['PKG_CONFIG_PATH'] = [ENV['PKG_CONFIG_PATH'], path].compact.join(':')
|
71
65
|
end
|
72
66
|
end
|
73
67
|
|
@@ -92,11 +86,25 @@ module RMagick
|
|
92
86
|
else
|
93
87
|
exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find magick/MagickCore.h."
|
94
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
|
95
95
|
end
|
96
96
|
|
97
97
|
def configure_compile_options
|
98
98
|
# Magick-config is not available on Windows
|
99
|
-
if RUBY_PLATFORM
|
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
|
100
108
|
|
101
109
|
check_multiple_imagemagick_versions
|
102
110
|
check_partial_imagemagick_versions
|
@@ -118,31 +126,9 @@ module RMagick
|
|
118
126
|
$LDFLAGS = "#{original_ldflags} #{ldflags}"
|
119
127
|
end
|
120
128
|
|
121
|
-
configure_archflags_for_osx($magick_package) if RUBY_PLATFORM
|
122
|
-
|
123
|
-
elsif RUBY_PLATFORM =~ /mingw/ # mingw
|
124
|
-
|
125
|
-
dir_paths = search_paths_for_library_for_windows
|
126
|
-
$CPPFLAGS += %( -I"#{dir_paths[:include]}")
|
127
|
-
$CPPFLAGS += ' -x c++ -std=c++11 -Wno-register'
|
128
|
-
$LDFLAGS += %( -L"#{dir_paths[:lib]}")
|
129
|
-
$LDFLAGS << ' -lucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
|
130
|
-
|
131
|
-
have_library(im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_' : 'CORE_RL_magick_')
|
132
|
-
|
133
|
-
else # mswin
|
129
|
+
configure_archflags_for_osx($magick_package) if RUBY_PLATFORM.include?('darwin') # osx
|
134
130
|
|
135
|
-
dir_paths = search_paths_for_library_for_windows
|
136
|
-
$CPPFLAGS << %( -I"#{dir_paths[:include]}")
|
137
|
-
$LDFLAGS << %( -libpath:"#{dir_paths[:lib]}")
|
138
|
-
$LDFLAGS << ' -libpath:ucrt' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
|
139
|
-
|
140
|
-
$LOCAL_LIBS += ' ' + (im_version_at_least?('7.0.0') ? 'CORE_RL_MagickCore_.lib' : 'CORE_RL_magick_.lib')
|
141
|
-
|
142
|
-
$CPPFLAGS += ' /std:c++11'
|
143
131
|
end
|
144
|
-
ruby_version = RUBY_VERSION.split('.')
|
145
|
-
$CPPFLAGS += " -DRUBY_VERSION_MAJOR=#{ruby_version[0]} -DRUBY_VERSION_MINOR=#{ruby_version[1]}"
|
146
132
|
$CPPFLAGS += ' $(optflags) $(debugflags)'
|
147
133
|
end
|
148
134
|
|
@@ -180,11 +166,6 @@ module RMagick
|
|
180
166
|
def determine_imagemagick_package
|
181
167
|
packages = [installed_im7_packages, installed_im6_packages].flatten
|
182
168
|
|
183
|
-
if packages.empty?
|
184
|
-
# ImageMagick 6.7 does not have package file like ImageMagick-6.Q16.pc
|
185
|
-
packages = detect_imagemagick_packages(IM6_7_PACKAGES)
|
186
|
-
end
|
187
|
-
|
188
169
|
if packages.empty?
|
189
170
|
exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find ImageMagick with pkg-config\n"
|
190
171
|
end
|
@@ -268,10 +249,10 @@ module RMagick
|
|
268
249
|
# issue #169
|
269
250
|
# set ARCHFLAGS appropriately for OSX
|
270
251
|
def configure_archflags_for_osx(magick_package)
|
271
|
-
return unless PKGConfig.libs_only_L(magick_package)
|
252
|
+
return unless PKGConfig.libs_only_L(magick_package) =~ %r{-L(.+)/lib}
|
272
253
|
|
273
254
|
imagemagick_dir = Regexp.last_match(1)
|
274
|
-
command = Dir.glob(File.join(imagemagick_dir, "bin/*")).
|
255
|
+
command = Dir.glob(File.join(imagemagick_dir, "bin/*")).find { |file| File.executable? file }
|
275
256
|
fileinfo = `file #{command}`
|
276
257
|
|
277
258
|
# default ARCHFLAGS
|
@@ -285,28 +266,27 @@ module RMagick
|
|
285
266
|
$ARCH_FLAG = archflags.join(' ') unless archflags.empty?
|
286
267
|
end
|
287
268
|
|
288
|
-
def
|
269
|
+
def search_paths_for_windows
|
289
270
|
msg = 'searching PATH for the ImageMagick library...'
|
290
271
|
Logging.message msg
|
291
272
|
message msg + "\n"
|
292
273
|
|
293
|
-
|
274
|
+
found = false
|
294
275
|
dir_paths = {}
|
295
276
|
|
296
277
|
paths = ENV['PATH'].split(File::PATH_SEPARATOR)
|
297
278
|
paths.each do |dir|
|
298
|
-
|
299
|
-
|
300
|
-
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)
|
301
281
|
|
302
282
|
dir_paths[:include] = File.join(dir, 'include')
|
303
|
-
dir_paths[:
|
283
|
+
dir_paths[:root] = dir
|
304
284
|
|
305
|
-
|
285
|
+
found = true
|
306
286
|
break
|
307
287
|
end
|
308
288
|
|
309
|
-
return dir_paths if
|
289
|
+
return dir_paths if found
|
310
290
|
|
311
291
|
exit_failure <<~END_MINGW
|
312
292
|
Can't install RMagick #{RMAGICK_VERS}.
|
@@ -321,7 +301,7 @@ module RMagick
|
|
321
301
|
assert_has_dev_libs!
|
322
302
|
|
323
303
|
# Check for compiler. Extract first word so ENV['CXX'] can be a program name with arguments.
|
324
|
-
cxx = (ENV['CXX'] || RbConfig::CONFIG['CXX'] || 'g++').split
|
304
|
+
cxx = (ENV['CXX'] || RbConfig::CONFIG['CXX'] || 'g++').split.first
|
325
305
|
exit_failure "No C++ compiler found in ${ENV['PATH']}. See mkmf.log for details." unless find_executable(cxx)
|
326
306
|
end
|
327
307
|
|
@@ -340,17 +320,17 @@ module RMagick
|
|
340
320
|
Check the mkmf.log file for more detailed information.
|
341
321
|
END_FAILURE
|
342
322
|
|
343
|
-
if RUBY_PLATFORM
|
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
|
344
328
|
unless PKGConfig.libs('MagickCore')[/\bl\s*(MagickCore|Magick)6?\b/]
|
345
329
|
exit_failure failure_message
|
346
330
|
end
|
347
331
|
|
348
332
|
$magick_package = determine_imagemagick_package
|
349
333
|
$magick_version = PKGConfig.modversion($magick_package)[/^(\d+\.\d+\.\d+)/]
|
350
|
-
else
|
351
|
-
`#{magick_command} -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
|
352
|
-
$magick_version = Regexp.last_match(1)
|
353
|
-
exit_failure failure_message unless $magick_version
|
354
334
|
end
|
355
335
|
|
356
336
|
# Ensure minimum ImageMagick version
|
@@ -364,8 +344,6 @@ module RMagick
|
|
364
344
|
|
365
345
|
def create_header_file
|
366
346
|
ruby_api = [
|
367
|
-
'rb_gc_adjust_memory_usage', # Ruby 2.4.0
|
368
|
-
'rb_gc_mark_movable', # Ruby 2.7.0
|
369
347
|
'rb_io_path' # Ruby 3.2.0
|
370
348
|
]
|
371
349
|
memory_api = %w[
|
@@ -385,15 +363,10 @@ module RMagick
|
|
385
363
|
have_func(func, headers)
|
386
364
|
end
|
387
365
|
|
388
|
-
unless have_header('malloc.h')
|
389
|
-
have_header('malloc/malloc.h')
|
390
|
-
end
|
391
|
-
|
392
366
|
# Miscellaneous constants
|
393
367
|
$defs.push("-DRUBY_VERSION_STRING=\"ruby #{RUBY_VERSION}\"")
|
394
368
|
$defs.push("-DRMAGICK_VERSION_STRING=\"RMagick #{RMAGICK_VERS}\"")
|
395
369
|
|
396
|
-
$defs.push('-DIMAGEMAGICK_GREATER_THAN_EQUAL_6_8_9=1') if im_version_at_least?('6.8.9')
|
397
370
|
$defs.push('-DIMAGEMAGICK_GREATER_THAN_EQUAL_6_9_0=1') if im_version_at_least?('6.9.0')
|
398
371
|
$defs.push('-DIMAGEMAGICK_GREATER_THAN_EQUAL_6_9_10=1') if im_version_at_least?('6.9.10')
|
399
372
|
$defs.push('-DIMAGEMAGICK_7=1') if im_version_at_least?('7.0.0')
|
@@ -413,6 +386,22 @@ module RMagick
|
|
413
386
|
print_summary
|
414
387
|
end
|
415
388
|
|
389
|
+
def create_compile_flags_txt
|
390
|
+
cppflags = $CPPFLAGS.split
|
391
|
+
include_flags = cppflags.select { |flag| flag.start_with?('-I') }
|
392
|
+
define_flags = cppflags.select { |flag| flag.start_with?('-D') } + $defs
|
393
|
+
|
394
|
+
File.open('compile_flags.txt', 'w') do |f|
|
395
|
+
include_flags.each { |flag| f.puts(flag) }
|
396
|
+
f.puts "-I#{Dir.pwd}"
|
397
|
+
f.puts "-I#{RbConfig::CONFIG['rubyhdrdir']}"
|
398
|
+
f.puts "-I#{RbConfig::CONFIG['rubyhdrdir']}/ruby/backward"
|
399
|
+
f.puts "-I#{RbConfig::CONFIG['rubyarchhdrdir']}"
|
400
|
+
f.puts "-std=c++11"
|
401
|
+
define_flags.each { |flag| f.puts(flag) }
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
416
405
|
def magick_command
|
417
406
|
@magick_command ||= if find_executable('magick')
|
418
407
|
'magick'
|
@@ -451,3 +440,4 @@ at_exit do
|
|
451
440
|
message msg + "\n"
|
452
441
|
end
|
453
442
|
extconf.create_makefile_file
|
443
|
+
extconf.create_compile_flags_txt
|
data/ext/RMagick/rmagick.h
CHANGED
@@ -310,10 +310,8 @@ typedef enum _QuantumExpressionOperator
|
|
310
310
|
AbsQuantumOperator, /**< abs */
|
311
311
|
ExponentialQuantumOperator, /**< exponential */
|
312
312
|
MedianQuantumOperator, /**< median */
|
313
|
-
SumQuantumOperator /**< sum */
|
314
|
-
|
315
|
-
, RootMeanSquareQuantumOperator /** root mean square */
|
316
|
-
#endif
|
313
|
+
SumQuantumOperator, /**< sum */
|
314
|
+
RootMeanSquareQuantumOperator /** root mean square */
|
317
315
|
} QuantumExpressionOperator ;
|
318
316
|
|
319
317
|
|
@@ -333,6 +331,7 @@ typedef enum _QuantumExpressionOperator
|
|
333
331
|
* RMagick Module and Class VALUEs
|
334
332
|
*/
|
335
333
|
EXTERN VALUE Module_Magick;
|
334
|
+
EXTERN VALUE Module_DrawAttribute;
|
336
335
|
EXTERN VALUE Class_ImageList;
|
337
336
|
EXTERN VALUE Class_Info;
|
338
337
|
EXTERN VALUE Class_KernelInfo;
|
@@ -1173,7 +1172,8 @@ extern int rm_check_num2dbl(VALUE);
|
|
1173
1172
|
extern double rm_fuzz_to_dbl(VALUE);
|
1174
1173
|
extern Quantum rm_app2quantum(VALUE);
|
1175
1174
|
extern double rm_percentage(VALUE, double);
|
1176
|
-
extern double
|
1175
|
+
extern double rm_percentage2(VALUE, double, bool);
|
1176
|
+
extern double rm_str_to_pct(VALUE, bool);
|
1177
1177
|
extern VALUE rm_define_enum_type(const char *);
|
1178
1178
|
extern void rm_write_temp_image(Image *, char *, size_t);
|
1179
1179
|
extern void rm_delete_temp_image(char *);
|
@@ -1225,13 +1225,8 @@ MagickExport void UnityAddKernelInfo(KernelInfo *kernel, const double scale);
|
|
1225
1225
|
MagickExport void ScaleKernelInfo(KernelInfo *kernel, const double scaling_factor, const GeometryFlags normalize_flags);
|
1226
1226
|
#endif
|
1227
1227
|
|
1228
|
-
#
|
1229
|
-
|
1230
|
-
#define RESCUE_EXCEPTION_HANDLER_FUNC(func) (VALUE (*)(ANYARGS))(func)
|
1231
|
-
#else
|
1232
|
-
#define RESCUE_FUNC(func) (VALUE(*)(VALUE))(func)
|
1233
|
-
#define RESCUE_EXCEPTION_HANDLER_FUNC(func) (VALUE(*)(VALUE, VALUE))(func)
|
1234
|
-
#endif
|
1228
|
+
#define RESCUE_FUNC(func) (VALUE(*)(VALUE))(func)
|
1229
|
+
#define RESCUE_EXCEPTION_HANDLER_FUNC(func) (VALUE(*)(VALUE, VALUE))(func)
|
1235
1230
|
|
1236
1231
|
} // extern "C"
|
1237
1232
|
|
data/ext/RMagick/rmdraw.cpp
CHANGED
@@ -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,
|
@@ -950,20 +946,20 @@ Draw_clone(VALUE self)
|
|
950
946
|
* Draw the image.
|
951
947
|
*
|
952
948
|
* @overload composite(x, y, width, height, image)
|
953
|
-
* @param x [
|
954
|
-
* @param y [
|
955
|
-
* @param width [
|
956
|
-
* @param height [
|
949
|
+
* @param x [Numeric] x position
|
950
|
+
* @param y [Numeric] y position
|
951
|
+
* @param width [Numeric] the width
|
952
|
+
* @param height [Numeric] the height
|
957
953
|
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
958
954
|
* imagelist, uses the current image.
|
959
955
|
*
|
960
956
|
* @overload composite(x, y, width, height, image, composite_op = Magick::OverCompositeOp)
|
961
957
|
* - The "image" argument can be either an ImageList object or an Image
|
962
958
|
* argument.
|
963
|
-
* @param x [
|
964
|
-
* @param y [
|
965
|
-
* @param width [
|
966
|
-
* @param height [
|
959
|
+
* @param x [Numeric] x position
|
960
|
+
* @param y [Numeric] y position
|
961
|
+
* @param width [Numeric] the width
|
962
|
+
* @param height [Numeric] the height
|
967
963
|
* @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
|
968
964
|
* imagelist, uses the current image.
|
969
965
|
* @param composite_op [Magick::CompositeOperator] the operator
|
@@ -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
|
|
@@ -1463,8 +1453,8 @@ PolaroidOptions_alloc(VALUE klass)
|
|
1463
1453
|
/**
|
1464
1454
|
* Initialize a PolaroidOptions object.
|
1465
1455
|
*
|
1466
|
-
* @yield [
|
1467
|
-
* @yieldparam
|
1456
|
+
* @yield [opt]
|
1457
|
+
* @yieldparam opt [Magick::Image::PolaroidOptions] self
|
1468
1458
|
* @return [Magick::Image::PolaroidOptions] self
|
1469
1459
|
*/
|
1470
1460
|
VALUE
|
data/ext/RMagick/rmfill.cpp
CHANGED
@@ -634,7 +634,7 @@ h_diagonal_fill(
|
|
634
634
|
* Call GradientFill with the start and stop colors specified when this fill
|
635
635
|
* object was created.
|
636
636
|
*
|
637
|
-
* @param image_obj [Magick::Image] the image to fill
|
637
|
+
* @param image_obj [Magick::Image, Magick::ImageList] the image to fill
|
638
638
|
* @return [Magick::GradientFill] self
|
639
639
|
*/
|
640
640
|
VALUE
|
@@ -646,7 +646,7 @@ GradientFill_fill(VALUE self, VALUE image_obj)
|
|
646
646
|
double x1, y1, x2, y2; // points on the line
|
647
647
|
|
648
648
|
TypedData_Get_Struct(self, rm_GradientFill, &rm_gradient_fill_data_type, fill);
|
649
|
-
image = rm_check_destroyed(image_obj);
|
649
|
+
image = rm_check_destroyed(rm_cur_image(image_obj));
|
650
650
|
|
651
651
|
x1 = fill->x1;
|
652
652
|
y1 = fill->y1;
|
@@ -780,7 +780,7 @@ TextureFill_initialize(VALUE self, VALUE texture_arg)
|
|
780
780
|
* Call TextureFill with the texture specified when this fill object was
|
781
781
|
* created.
|
782
782
|
*
|
783
|
-
* @param image_obj [Magick::Image] the image to fill
|
783
|
+
* @param image_obj [Magick::Image, Magick::ImageList] the image to fill
|
784
784
|
* @return [Magick::TextureFill] self
|
785
785
|
*/
|
786
786
|
VALUE
|
@@ -792,7 +792,7 @@ TextureFill_fill(VALUE self, VALUE image_obj)
|
|
792
792
|
ExceptionInfo *exception;
|
793
793
|
#endif
|
794
794
|
|
795
|
-
image = rm_check_destroyed(image_obj);
|
795
|
+
image = rm_check_destroyed(rm_cur_image(image_obj));
|
796
796
|
TypedData_Get_Struct(self, rm_TextureFill, &rm_texture_fill_data_type, fill);
|
797
797
|
|
798
798
|
#if defined(IMAGEMAGICK_7)
|