rmagick 4.2.2 → 4.2.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rmagick might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c383bce80132c17b4d8a6afab0085b2f4d5d23f582473d9405b5f6dcb3d6283f
4
- data.tar.gz: 0f5f7afe6df7a1c5095860ca5341d0b72a4960b8ead6a2779bd8209a92078f95
3
+ metadata.gz: 19f12f1fe15653484cfee177ac21d5174d912918ef9bdf874b74b940a91cf5ba
4
+ data.tar.gz: 9a187a8e989d9b0f984716a1bb5e8239e4e0d428de76f52cbbf56cbfb7c7e55a
5
5
  SHA512:
6
- metadata.gz: 619e5ec7f5fbd0750fb5bc4807d9d7ca0e58b6ba6e3efc9726541bbe3c260a748c026446ce89ef51661254b5285f907254d9b389cb237e141bd525fa23bbf2b6
7
- data.tar.gz: 50e98c64b22c0bbf9d4b5aafd6664d02abdc2d8286a703e9199aed8b5e9597c4ce1ec4abeceabed20c21b5ab6d703b0ff9d4d81637d08b2c2ba93e615b02184f
6
+ metadata.gz: d04c9a98d1004623c27fedda53f7f3d5de1ae7a9f938da386a803e6191d224e92bf71831bfc57ac946d45f4f2a820d1441fd3d19a8d78442d0046d7927819a13
7
+ data.tar.gz: b05b1c15617eb186b65edc55b97c6c8b4f58f25249f1295378efaf1e40f7242f82c46e20389eecd914e62d3e5c7233e3dc0b0308897a3f5825dda0c1cbaec796
@@ -10,7 +10,7 @@ on:
10
10
  jobs:
11
11
  lint:
12
12
  runs-on: ubuntu-latest
13
- timeout-minutes: 10
13
+ timeout-minutes: 20
14
14
  steps:
15
15
  - uses: actions/checkout@v2
16
16
  - name: Set up Ruby 2.3
@@ -24,15 +24,15 @@ jobs:
24
24
 
25
25
  test-linux:
26
26
  runs-on: ubuntu-latest
27
- timeout-minutes: 10
27
+ timeout-minutes: 20
28
28
  strategy:
29
29
  matrix:
30
- ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0']
30
+ ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1']
31
31
  imagemagick-version:
32
32
  - { full: 6.7.7-10, major-minor: '6.7' }
33
33
  - { full: 6.8.9-10, major-minor: '6.8' }
34
- - { full: 6.9.11-58, major-minor: '6.9' }
35
- - { full: 7.0.10-58, major-minor: '7.0' }
34
+ - { full: 6.9.12-37, major-minor: '6.9' }
35
+ - { full: 7.1.0-22, major-minor: '7.0' }
36
36
 
37
37
  name: Linux, Ruby ${{ matrix.ruby-version }}, IM ${{ matrix.imagemagick-version.major-minor }}
38
38
  steps:
@@ -55,10 +55,10 @@ jobs:
55
55
  timeout-minutes: 20
56
56
  strategy:
57
57
  matrix:
58
- ruby-version: ['2.6', '2.7', '3.0']
58
+ ruby-version: ['2.6', '2.7', '3.0', '3.1']
59
59
  imagemagick-version:
60
- - { full: 6.9.11-58, major-minor: '6.9' }
61
- - { full: 7.0.10-58, major-minor: '7.0' }
60
+ - { full: 6.9.12-37, major-minor: '6.9' }
61
+ - { full: 7.1.0-22, major-minor: '7.0' }
62
62
 
63
63
  name: macOS, Ruby ${{ matrix.ruby-version }}, IM ${{ matrix.imagemagick-version.major-minor }}
64
64
  steps:
@@ -74,34 +74,3 @@ jobs:
74
74
  run: |
75
75
  bundle install --path=vendor/bundle --jobs 4 --retry 3
76
76
  bundle exec rake
77
-
78
- test-windows:
79
- runs-on: windows-latest
80
- timeout-minutes: 10
81
- strategy:
82
- matrix:
83
- ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0']
84
- imagemagick-version:
85
- - { full: 6.8.9-10, major-minor: '6.8' }
86
- - { full: 6.9.11-29, major-minor: '6.9' } # seems that binary file mirroring have stopped.
87
- - { full: 7.0.10-29, major-minor: '7.0' } # seems that binary file mirroring have stopped.
88
- name: MSWin, Ruby ${{ matrix.ruby-version }}, IM ${{ matrix.imagemagick-version.major-minor }}
89
- steps:
90
- - uses: actions/checkout@v2
91
- - name: Set up Ruby ${{ matrix.ruby-version }}
92
- uses: ruby/setup-ruby@master
93
- with:
94
- ruby-version: ${{ matrix.ruby-version }}
95
- - name: Install ImageMagick
96
- run: |
97
- $imagemagick_version = "${{ matrix.imagemagick-version.full }}"
98
- $imagemagick_version_without_patch = $imagemagick_version.split("-")[0]
99
- $installer_name = "ImageMagick-$($imagemagick_version)-Q16-x64-dll.exe"
100
- $url = "https://ftp.icm.edu.pl/pub/graphics/ImageMagick/binaries/$($installer_name)"
101
- choco install wget
102
- choco install ghostscript -Version 9.50
103
- wget $url --progress=dot
104
- cmd.exe /D /S /C "$($installer_name) /DIR=D:\ImageMagick /VERYSILENT /TASKS=install_Devel"
105
- - name: Build and test with Rake
106
- run: |
107
- cmd.exe /D /S /C "SET MAKE=make & SET PATH=D:\ImageMagick;%PATH% & bundle install --path=vendor/bundle --retry 3 & bundle exec rake"
data/CHANGELOG.md CHANGED
@@ -3,6 +3,39 @@
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 4.2.5
7
+
8
+ Bug Fixes
9
+
10
+ - Specify rpath linker option to fix dynamic lib lookup failure on Linux (#1325)
11
+ - Fix Image#profile! that can't delete exif data (#1326)
12
+
13
+ ## RMagick 4.2.4
14
+
15
+ Improvements
16
+
17
+ - spec_helper: drop require_relative to lib directory (#1306)
18
+ - Fix build error with Ruby 3.1 on macOS (#1313)
19
+
20
+ Bug Fixes
21
+
22
+ - remove Mutex in trace_proc= (#1303)
23
+ - channel_mean_spec: fix floating point comparison (#1307)
24
+ - changed_predicate_spec: ensure target directory exists (#1305)
25
+ - Doc: Fix documentation of Magick::Image#crop (#1311)
26
+ - Magick::UndefinedKernel should also not be used when creating a new KernelInfo. (#1312)
27
+
28
+ ## RMagick 4.2.3
29
+
30
+ Bug Fixes
31
+
32
+ - Re-add block syntax deprecation warning and fix in RMagick source (#1279) (#1280)
33
+ - Doc: Replace Magick::Montage with Magick::ImageList::Montage (#1281)
34
+ - Update shadow example (#1297)
35
+ - Escape the backslashes in windows error message (#1298)
36
+ - Also set the alpha value of the target pixel (#1299)
37
+ - Set alpha_trait to BlendPixelTrait when the alpha value of the pixel is not opaque. (#1300)
38
+
6
39
  ## RMagick 4.2.2
7
40
 
8
41
  Bug Fixes:
@@ -41,7 +41,6 @@ module RMagick
41
41
  {
42
42
  magick_version: $magick_version,
43
43
  local_libs: $LOCAL_LIBS,
44
- cflags: $CFLAGS,
45
44
  cppflags: $CPPFLAGS,
46
45
  ldflags: $LDFLAGS,
47
46
  defs: $defs,
@@ -68,11 +67,18 @@ module RMagick
68
67
  check_multiple_imagemagick_versions
69
68
  check_partial_imagemagick_versions
70
69
 
70
+ libdir = `pkg-config --libs-only-L #{$magick_package}`.chomp.sub('-L', '')
71
+ ldflags = "#{ENV['LDFLAGS']} " + `pkg-config --libs #{$magick_package}`.chomp
72
+
71
73
  # Save flags
72
- $CFLAGS = "#{ENV['CFLAGS']} " + `pkg-config --cflags #{$magick_package}`.chomp
73
74
  $CPPFLAGS = "#{ENV['CPPFLAGS']} " + `pkg-config --cflags #{$magick_package}`.chomp
74
- $LDFLAGS = "#{ENV['LDFLAGS']} " + `pkg-config --libs #{$magick_package}`.chomp
75
75
  $LOCAL_LIBS = "#{ENV['LIBS']} " + `pkg-config --libs #{$magick_package}`.chomp
76
+ $LDFLAGS = "#{ldflags} -Wl,-rpath,#{libdir}"
77
+
78
+ unless try_link("int main() { }")
79
+ # if linker does not recognizes '-Wl,-rpath,somewhere' option, it revert to original option
80
+ $LDFLAGS = ldflags
81
+ end
76
82
 
77
83
  configure_archflags_for_osx($magick_package) if RUBY_PLATFORM =~ /darwin/ # osx
78
84
 
@@ -96,7 +102,7 @@ module RMagick
96
102
 
97
103
  end
98
104
 
99
- $CFLAGS << (have_macro('__GNUC__') ? ' -std=gnu99' : ' -std=c99')
105
+ $CPPFLAGS << (have_macro('__GNUC__') ? ' -std=gnu99' : ' -std=c99')
100
106
  end
101
107
 
102
108
  def exit_failure(msg)
@@ -258,7 +264,7 @@ module RMagick
258
264
  Retry with '--with-opt-dir' option.
259
265
  Usage: gem install rmagick -- '--with-opt-dir=\"[path to ImageMagick]\"'
260
266
  e.g.
261
- gem install rmagick -- '--with-opt-dir=\"C:\Program Files\ImageMagick-6.9.1-Q16\"'
267
+ gem install rmagick -- '--with-opt-dir=\"C:\\Program Files\\ImageMagick-6.9.1-Q16\"'
262
268
  END_MINGW
263
269
  end
264
270
 
@@ -434,9 +434,9 @@ EXTERN unsigned long long rm_main_thread_id;
434
434
  #define R_boolean_to_C_boolean(attr) RTEST(attr) /**< C boolean <- Ruby boolean */
435
435
  #define C_int_to_R_int(attr) INT2FIX(attr) /**< C int -> Ruby int */
436
436
  #define R_int_to_C_int(attr) NUM2INT(attr) /**< C int <- Ruby int */
437
- #define C_long_to_R_long(attr) INT2NUM(attr) /**< C long -> Ruby long */
437
+ #define C_long_to_R_long(attr) LONG2NUM(attr) /**< C long -> Ruby long */
438
438
  #define R_long_to_C_long(attr) NUM2LONG(attr) /**< C long <- Ruby long */
439
- #define C_ulong_to_R_ulong(attr) UINT2NUM(attr) /**< C unsigned long -> Ruby unsigned long */
439
+ #define C_ulong_to_R_ulong(attr) ULONG2NUM(attr) /**< C unsigned long -> Ruby unsigned long */
440
440
  #define R_ulong_to_C_ulong(attr) NUM2ULONG(attr) /**< C unsigned long <- Ruby unsigned long */
441
441
  #define C_str_to_R_str(attr) attr ? rb_str_new2(attr) : Qnil /**< C string -> Ruby string */
442
442
  #define C_dbl_to_R_dbl(attr) rb_float_new(attr) /**< C double -> Ruby double */
@@ -1173,6 +1173,9 @@ extern void rm_set_user_artifact(Image *, Info *);
1173
1173
  extern void rm_sync_image_options(Image *, Info *);
1174
1174
  extern void rm_split(Image *);
1175
1175
  extern void rm_magick_error(const char *);
1176
+ #if defined(IMAGEMAGICK_7)
1177
+ extern void rm_set_pixelinfo_alpha(PixelInfo *, const MagickRealType);
1178
+ #endif
1176
1179
 
1177
1180
  //! whether to retain on errors
1178
1181
  typedef enum
data/ext/RMagick/rmdraw.c CHANGED
@@ -856,6 +856,7 @@ VALUE Draw_annotate(
856
856
  if (rb_proc_arity(rb_block_proc()) == 0)
857
857
  {
858
858
  // Run the block in self's context
859
+ rb_warn("passing a block without an image argument is deprecated");
859
860
  rb_obj_instance_eval(0, NULL, self);
860
861
  }
861
862
  else
@@ -1396,6 +1397,7 @@ DrawOptions_initialize(VALUE self)
1396
1397
  if (rb_proc_arity(rb_block_proc()) == 0)
1397
1398
  {
1398
1399
  // Run the block in self's context
1400
+ rb_warn("passing a block without an image argument is deprecated");
1399
1401
  rb_obj_instance_eval(0, NULL, self);
1400
1402
  }
1401
1403
  else
@@ -1467,6 +1469,7 @@ PolaroidOptions_initialize(VALUE self)
1467
1469
  if (rb_proc_arity(rb_block_proc()) == 0)
1468
1470
  {
1469
1471
  // Run the block in self's context
1472
+ rb_warn("passing a block without an image argument is deprecated");
1470
1473
  rb_obj_instance_eval(0, NULL, self);
1471
1474
  }
1472
1475
  else
@@ -428,7 +428,7 @@ ImageList_flatten_images(VALUE self)
428
428
  * @overload montage
429
429
  * Creates {Magick::ImageList::Montage} object, yields to block
430
430
  * if present in {Magick::ImageList::Montage} object's scope.
431
- * @yield []
431
+ * @yield [Magick::ImageList::Montage]
432
432
  *
433
433
  * @return [Magick::ImageList] a new image list
434
434
  */
@@ -440,7 +440,7 @@ ImageList_montage(VALUE self)
440
440
  Image *new_images, *images;
441
441
  ExceptionInfo *exception;
442
442
 
443
- // Create a new instance of the Magick::Montage class
443
+ // Create a new instance of the Magick::ImageList::Montage class
444
444
  montage_obj = rm_montage_new();
445
445
  if (rb_block_given_p())
446
446
  {
@@ -448,6 +448,7 @@ ImageList_montage(VALUE self)
448
448
  // object's attributes.
449
449
  if (rb_proc_arity(rb_block_proc()) == 0)
450
450
  {
451
+ rb_warn("passing a block without an image argument is deprecated");
451
452
  rb_obj_instance_eval(0, NULL, montage_obj);
452
453
  }
453
454
  else
@@ -1008,7 +1009,7 @@ ImageList_remap(int argc, VALUE *argv, VALUE self)
1008
1009
  *
1009
1010
  * @overload to_blob
1010
1011
  * Runs an info parm block if present - the user can specify the image format and depth
1011
- * @yield []
1012
+ * @yield [Magick::Image::Info]
1012
1013
  *
1013
1014
  * @return [String] the blob
1014
1015
  */
@@ -1990,12 +1990,12 @@ Image_bounding_box(VALUE self)
1990
1990
  * importantly, you can capture menus or other popups that are independent windows but appear
1991
1991
  * over the specified window.
1992
1992
  * @param borders [Boolean] If true, include the border in the image.
1993
- * @yield []
1993
+ * @yield [Magick::Image::Info]
1994
1994
  *
1995
1995
  * @return [Magick::Image] a new image
1996
1996
  * @example
1997
- * img = Image.capture {
1998
- * self.filename = "root"
1997
+ * img = Image.capture { |options|
1998
+ * options.filename = "root"
1999
1999
  * }
2000
2000
  */
2001
2001
  VALUE
@@ -3104,17 +3104,17 @@ Image_columns(VALUE self)
3104
3104
  * @param channel [Magick::ChannelType] a ChannelType arguments.
3105
3105
  *
3106
3106
  * @overload compare_channel(image, metric, channel = Magick::AllChannels)
3107
- * If present a block, compare_channel yields to a block in which you can set optional arguments
3108
- * by setting attributes on self.
3109
- * - self.highlight_color = color
3107
+ * When a block is given, compare_channel yields with a block argument you can optionally use to
3108
+ * set attributes.
3109
+ * - options.highlight_color = color
3110
3110
  * - Emphasize pixel differences with this color. The default is partially transparent red.
3111
- * - self.lowlight_color = color
3111
+ * - options.lowlight_color = color
3112
3112
  * - Demphasize pixel differences with this color. The default is partially transparent white.
3113
3113
  * @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
3114
3114
  * imagelist, uses the current image.
3115
3115
  * @param metric [Magick::MetricType] The desired distortion metric.
3116
3116
  * @param channel [Magick::ChannelType] a ChannelType arguments.
3117
- * @yield []
3117
+ * @yield [Magick::OptionalMethodArguments]
3118
3118
  *
3119
3119
  * @overload compare_channel(image, metric, *channels)
3120
3120
  * @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
@@ -3124,18 +3124,18 @@ Image_columns(VALUE self)
3124
3124
  * @param *channels [Magick::ChannelType] one or more ChannelType arguments.
3125
3125
  *
3126
3126
  * @overload compare_channel(image, metric, *channels)
3127
- * If present a block, compare_channel yields to a block in which you can set optional arguments
3128
- * by setting attributes on self.
3129
- * - self.highlight_color = color
3127
+ * When a block is given, compare_channel yields with a block argument you can optionally use to
3128
+ * set attributes.
3129
+ * - options.highlight_color = color
3130
3130
  * - Emphasize pixel differences with this color. The default is partially transparent red.
3131
- * - self.lowlight_color = color
3131
+ * - options.lowlight_color = color
3132
3132
  * - Demphasize pixel differences with this color. The default is partially transparent white.
3133
3133
  * @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
3134
3134
  * imagelist, uses the current image.
3135
3135
  * @param metric [Magick::MetricType] The desired distortion metric.
3136
3136
  * @param channel [Magick::ChannelType] a ChannelType arguments.
3137
3137
  * @param *channels [Magick::ChannelType] one or more ChannelType arguments.
3138
- * @yield []
3138
+ * @yield [Magick::OptionalMethodArguments]
3139
3139
  *
3140
3140
  * @return [Array] The first element is a difference image, the second is a the value of the
3141
3141
  * computed distortion represented as a Float.
@@ -4681,26 +4681,26 @@ Image_init_copy(VALUE copy, VALUE orig)
4681
4681
  /**
4682
4682
  * Extract a region of the image defined by width, height, x, y.
4683
4683
  *
4684
- * @overload crop(reset = false, x, y, width, height)
4685
- * @param reset [Boolean] true if reset the cropped image page canvas and position
4684
+ * @overload crop(x, y, width, height, reset = false)
4686
4685
  * @param x [Numeric] x position of start of region
4687
4686
  * @param y [Numeric] y position of start of region
4688
4687
  * @param width [Numeric] width of region
4689
4688
  * @param height [Numeric] height of region
4690
- *
4691
- * @overload crop(reset = false, gravity, width, height)
4692
4689
  * @param reset [Boolean] true if reset the cropped image page canvas and position
4690
+ *
4691
+ * @overload crop(gravity, width, height, reset = false)
4693
4692
  * @param gravity [Magick::GravityType] the gravity type
4694
4693
  * @param width [Numeric] width of region
4695
4694
  * @param height [Numeric] height of region
4696
-
4697
- * @overload crop(reset = false, gravity, x, y, width, height)
4698
4695
  * @param reset [Boolean] true if reset the cropped image page canvas and position
4696
+
4697
+ * @overload crop(gravity, x, y, width, height, reset = false)
4699
4698
  * @param gravity [Magick::GravityType] the gravity type
4700
4699
  * @param x [Numeric] x position of start of region
4701
4700
  * @param y [Numeric] y position of start of region
4702
4701
  * @param width [Numeric] width of region
4703
4702
  * @param height [Numeric] height of region
4703
+ * @param reset [Boolean] true if reset the cropped image page canvas and position
4704
4704
  *
4705
4705
  * @return [Magick::Image] a new image
4706
4706
  * @see Image#crop!
@@ -5039,8 +5039,16 @@ VALUE
5039
5039
  Image_delete_profile(VALUE self, VALUE name)
5040
5040
  {
5041
5041
  Image *image = rm_check_frozen(self);
5042
- DeleteImageProfile(image, StringValueCStr(name));
5043
5042
 
5043
+ #if defined(IMAGEMAGICK_7)
5044
+ ExceptionInfo *exception = AcquireExceptionInfo();
5045
+
5046
+ ProfileImage(image, StringValueCStr(name), NULL, 0, exception);
5047
+ CHECK_EXCEPTION();
5048
+ DestroyExceptionInfo(exception);
5049
+ #else
5050
+ ProfileImage(image, StringValueCStr(name), NULL, 0, MagickTrue);
5051
+ #endif
5044
5052
  return self;
5045
5053
  }
5046
5054
 
@@ -5551,17 +5559,16 @@ Image_dissolve(int argc, VALUE *argv, VALUE self)
5551
5559
  * the source image will be taken into account in the mapping.
5552
5560
  *
5553
5561
  * @overload distort(type, points, bestfit = false)
5554
- * If present a block, distort yields to a block in which you can set optional arguments by
5555
- * setting attributes on self.
5556
- * - self.define("distort:viewport", "WxH+X+Y")
5562
+ * When a block is given, distort yields with a block argument you can optionally use to set attributes.
5563
+ * - options.define("distort:viewport", "WxH+X+Y")
5557
5564
  * - Specify the size and offset of the generated viewport image of the distorted image space. W and
5558
5565
  * H are the width and height, and X and Y are the offset.
5559
- * - self.define("distort:scale", N)
5566
+ * - options.define("distort:scale", N)
5560
5567
  * - N is an integer factor. Scale the output image (viewport or otherwise) by that factor without
5561
5568
  * changing the viewed contents of the distorted image. This can be used either for
5562
5569
  * 'super-sampling' the image for a higher quality result, or for panning and zooming around
5563
5570
  * the image (with appropriate viewport changes, or post-distort cropping and resizing).
5564
- * - self.verbose(true)
5571
+ * - options.verbose(true)
5565
5572
  * - Attempt to output the internal coefficients, and the -fx equivalent to the distortion, for
5566
5573
  expert study, and debugging purposes. This many not be available for all distorts.
5567
5574
  * @param type [Magick::DistortMethod] a DistortMethod value
@@ -5570,13 +5577,13 @@ Image_dissolve(int argc, VALUE *argv, VALUE self)
5570
5577
  * image is adjusted to ensure the whole source image will just fit within the final destination
5571
5578
  * image, which will be sized and offset accordingly. Also in many cases the virtual offset of
5572
5579
  * the source image will be taken into account in the mapping.
5573
- * @yield []
5580
+ * @yield [Magick::OptionalMethodArguments]
5574
5581
  *
5575
5582
  * @return [Magick::Image] a new image
5576
5583
  * @example
5577
- * img.distort(Magick::ScaleRotateTranslateDistortion, [0]) do
5578
- * self.define "distort:viewport", "44x44+15+0"
5579
- * self.define "distort:scale", 2
5584
+ * img.distort(Magick::ScaleRotateTranslateDistortion, [0]) do |options|
5585
+ * options.define "distort:viewport", "44x44+15+0"
5586
+ * options.define "distort:scale", 2
5580
5587
  * end
5581
5588
  */
5582
5589
  VALUE
@@ -6882,7 +6889,7 @@ Image_frame(int argc, VALUE *argv, VALUE self)
6882
6889
  * @overload from_blob(blob)
6883
6890
  * This yields {Magick::Image::Info} to block with its object's scope.
6884
6891
  * @param blob [String] the blob data
6885
- * @yield []
6892
+ * @yield [Magick::Image::Info]
6886
6893
  *
6887
6894
  * @return [Array<Magick::Image>] an array of new images
6888
6895
  * @see Image#to_blob
@@ -8968,7 +8975,7 @@ Image_matte_flood_fill(int argc, VALUE *argv, VALUE self)
8968
8975
  rb_raise(rb_eNoMemError, "not enough memory to continue");
8969
8976
  }
8970
8977
  #if defined(IMAGEMAGICK_7)
8971
- draw_info->fill.alpha = alpha;
8978
+ rm_set_pixelinfo_alpha(&draw_info->fill, alpha);
8972
8979
  #else
8973
8980
  draw_info->fill.opacity = QuantumRange - alpha;
8974
8981
  #endif
@@ -8979,6 +8986,11 @@ Image_matte_flood_fill(int argc, VALUE *argv, VALUE self)
8979
8986
  target_mpp.red = (MagickRealType) image->border_color.red;
8980
8987
  target_mpp.green = (MagickRealType) image->border_color.green;
8981
8988
  target_mpp.blue = (MagickRealType) image->border_color.blue;
8989
+ #if defined(IMAGEMAGICK_7)
8990
+ rm_set_pixelinfo_alpha(&target_mpp, (MagickRealType) image->border_color.alpha);
8991
+ #else
8992
+ target_mpp.opacity = (MagickRealType) image->border_color.opacity;
8993
+ #endif
8982
8994
  }
8983
8995
  else
8984
8996
  {
@@ -8986,6 +8998,11 @@ Image_matte_flood_fill(int argc, VALUE *argv, VALUE self)
8986
8998
  target_mpp.red = (MagickRealType) target.red;
8987
8999
  target_mpp.green = (MagickRealType) target.green;
8988
9000
  target_mpp.blue = (MagickRealType) target.blue;
9001
+ #if defined(IMAGEMAGICK_7)
9002
+ rm_set_pixelinfo_alpha(&target_mpp, (MagickRealType) target.alpha);
9003
+ #else
9004
+ target_mpp.opacity = (MagickRealType) target.opacity;
9005
+ #endif
8989
9006
  }
8990
9007
 
8991
9008
  #if defined(IMAGEMAGICK_7)
@@ -10349,11 +10366,11 @@ Image_pixel_interpolation_method_eq(VALUE self, VALUE method)
10349
10366
  * If present a block, optional arguments may be specified in a block associated with the method.
10350
10367
  * These arguments control the shadow color and how the label is rendered.
10351
10368
  * By default the shadow color is gray75. To specify a different shadow color,
10352
- * use self.shadow_color.
10353
- * To specify a different border color (that is, the color of the image border) use self.border_color.
10369
+ * use options.shadow_color.
10370
+ * To specify a different border color (that is, the color of the image border) use options.border_color.
10354
10371
  * Both of these methods accept either a color name or a Pixel argument.
10355
10372
  * @param angle [Float] The resulting image is rotated by this amount, measured in degrees.
10356
- * @yield []
10373
+ * @yield [Magick::Image::Info]
10357
10374
  *
10358
10375
  * @return [Magick::Image] a new image
10359
10376
  */
@@ -12325,7 +12342,7 @@ Image_segment(int argc, VALUE *argv, VALUE self)
12325
12342
  * @return [Hash] the properties
12326
12343
  *
12327
12344
  * @overload properties
12328
- * @yield []
12345
+ * @yield [Magick::Image::Info]
12329
12346
  * @return [Magick::Image] self
12330
12347
  */
12331
12348
  VALUE
data/ext/RMagick/rminfo.c CHANGED
@@ -2405,7 +2405,7 @@ rm_info_new(void)
2405
2405
  * @overload initialize
2406
2406
  *
2407
2407
  * @overload initialize
2408
- * @yield []
2408
+ * @yield [Magick::Image::Info]
2409
2409
  *
2410
2410
  * @return self
2411
2411
  */
@@ -2417,6 +2417,7 @@ Info_initialize(VALUE self)
2417
2417
  if (rb_proc_arity(rb_block_proc()) == 0)
2418
2418
  {
2419
2419
  // Run the block in self's context
2420
+ rb_warn("passing a block without an image argument is deprecated");
2420
2421
  rb_obj_instance_eval(0, NULL, self);
2421
2422
  }
2422
2423
  else
@@ -22,7 +22,7 @@
22
22
  * No Ruby usage (internal function)
23
23
  *
24
24
  * Notes:
25
- * - If the Magick::Montage#texture method wrote a texture file, the file is
25
+ * - If the Magick::ImageList::Montage#texture method wrote a texture file, the file is
26
26
  * deleted here.
27
27
  *
28
28
  * @param obj the montage object
@@ -73,7 +73,7 @@ Montage_alloc(VALUE class)
73
73
 
74
74
  if (!montage_info)
75
75
  {
76
- rb_raise(rb_eNoMemError, "not enough memory to initialize Magick::Montage object");
76
+ rb_raise(rb_eNoMemError, "not enough memory to initialize Magick::ImageList::Montage object");
77
77
  }
78
78
 
79
79
  montage = ALLOC(Montage);
@@ -439,11 +439,11 @@ Montage_title_eq(VALUE self, VALUE title)
439
439
 
440
440
 
441
441
  /**
442
- * Return a new Magick::Montage object.
442
+ * Return a new Magick::ImageList::Montage object.
443
443
  *
444
444
  * No Ruby usage (internal function)
445
445
  *
446
- * @return a new Magick::Montage object
446
+ * @return a new Magick::ImageList::Montage object
447
447
  */
448
448
  VALUE
449
449
  rm_montage_new(void)
@@ -172,7 +172,7 @@ VALUE
172
172
  Pixel_alpha_eq(VALUE self, VALUE v)
173
173
  {
174
174
  Pixel *pixel;
175
-
175
+
176
176
  rb_check_frozen(self);
177
177
  Data_Get_Struct(self, Pixel, pixel);
178
178
  #if defined(IMAGEMAGICK_7)
@@ -381,8 +381,8 @@ Color_to_PixelColor(PixelColor *pp, VALUE color)
381
381
  pp->green = pixel->green;
382
382
  pp->blue = pixel->blue;
383
383
  #if defined(IMAGEMAGICK_7)
384
- pp->alpha = pixel->alpha;
385
384
  pp->black = pixel->black;
385
+ rm_set_pixelinfo_alpha(pp, pixel->alpha);
386
386
  #else
387
387
  pp->opacity = pixel->opacity;
388
388
  #endif
@@ -285,7 +285,7 @@ Export_ColorInfo(ColorInfo *ci, VALUE st)
285
285
  ci->color.green = (MagickRealType) pixel.green;
286
286
  ci->color.blue = (MagickRealType) pixel.blue;
287
287
  #if defined(IMAGEMAGICK_7)
288
- ci->color.alpha = (MagickRealType) OpaqueAlpha;
288
+ rm_set_pixelinfo_alpha(&ci->color, (MagickRealType) OpaqueAlpha);
289
289
  #else
290
290
  ci->color.opacity = (MagickRealType) OpaqueOpacity;
291
291
  #endif
@@ -672,10 +672,10 @@ Import_RectangleInfo(RectangleInfo *rect)
672
672
  VALUE height;
673
673
  VALUE x, y;
674
674
 
675
- width = UINT2NUM(rect->width);
676
- height = UINT2NUM(rect->height);
677
- x = INT2NUM(rect->x);
678
- y = INT2NUM(rect->y);
675
+ width = ULONG2NUM(rect->width);
676
+ height = ULONG2NUM(rect->height);
677
+ x = LONG2NUM(rect->x);
678
+ y = LONG2NUM(rect->y);
679
679
 
680
680
  RB_GC_GUARD(width);
681
681
  RB_GC_GUARD(height);
@@ -760,7 +760,7 @@ Import_SegmentInfo(SegmentInfo *segment)
760
760
  RB_GC_GUARD(y1);
761
761
  RB_GC_GUARD(x2);
762
762
  RB_GC_GUARD(y2);
763
-
763
+
764
764
  return rb_funcall(Class_Segment, rm_ID_new, 4, x1, y1, x2, y2);
765
765
  }
766
766
 
data/ext/RMagick/rmutil.c CHANGED
@@ -858,6 +858,25 @@ rm_magick_error(const char *msg)
858
858
  RB_GC_GUARD(mesg);
859
859
  }
860
860
 
861
+ #if defined(IMAGEMAGICK_7)
862
+ /**
863
+ * Sets the alpha channel of a pixel color
864
+ *
865
+ * No Ruby usage (internal function)
866
+ *
867
+ * @param pixel the Pixel
868
+ * @param value the value
869
+ */
870
+ void
871
+ rm_set_pixelinfo_alpha(PixelInfo *pixel, const MagickRealType value)
872
+ {
873
+ pixel->alpha = value;
874
+ if (value != (MagickRealType) OpaqueAlpha)
875
+ {
876
+ pixel->alpha_trait = BlendPixelTrait;
877
+ }
878
+ }
879
+ #endif
861
880
 
862
881
  /**
863
882
  * Initialize a new ImageMagickError object - store the "loc" string in the
@@ -1008,6 +1027,7 @@ rm_get_optional_arguments(VALUE img)
1008
1027
 
1009
1028
  if (rb_proc_arity(rb_block_proc()) == 0)
1010
1029
  {
1030
+ rb_warn("passing a block without an image argument is deprecated");
1011
1031
  rb_obj_instance_eval(0, NULL, opt_args);
1012
1032
  }
1013
1033
  else
@@ -1,5 +1,5 @@
1
1
  module Magick
2
- VERSION = '4.2.2'
2
+ VERSION = '4.2.5'
3
3
  MIN_RUBY_VERSION = '2.3.0'
4
4
  MIN_IM_VERSION = '6.7.7'
5
5
  end
@@ -84,15 +84,12 @@ module Magick
84
84
  # ...
85
85
  # end
86
86
  def trace_proc=(p)
87
- m = Mutex.new
88
- m.synchronize do
89
- if @trace_proc.nil? && !p.nil? && !@exit_block_set_up
90
- at_exit { @trace_proc = nil }
91
- @exit_block_set_up = true
92
- end
93
-
94
- @trace_proc = p
87
+ if @trace_proc.nil? && !p.nil? && !@exit_block_set_up
88
+ at_exit { @trace_proc = nil }
89
+ @exit_block_set_up = true
95
90
  end
91
+
92
+ @trace_proc = p
96
93
  end
97
94
  end
98
95
 
data/lib/rvg/rvg.rb CHANGED
@@ -85,7 +85,7 @@ module Magick
85
85
  @background_image.change_geometry(Magick::Geometry.new(width, height)) do |new_cols, new_rows|
86
86
  bg_image = @background_image.resize(new_cols, new_rows)
87
87
  if bg_image.columns != width || bg_image.rows != height
88
- bg = Magick::Image.new(width, height) { self.background_color = bgcolor }
88
+ bg = Magick::Image.new(width, height) { |options| options.background_color = bgcolor }
89
89
  bg_image = bg.composite!(bg_image, Magick::CenterGravity, Magick::OverCompositeOp)
90
90
  end
91
91
  bg_image
@@ -96,7 +96,7 @@ module Magick
96
96
  end
97
97
  else
98
98
  bgcolor = bgfill
99
- canvas = Magick::Image.new(Integer(@width), Integer(@height)) { self.background_color = bgcolor }
99
+ canvas = Magick::Image.new(Integer(@width), Integer(@height)) { |options| options.background_color = bgcolor }
100
100
  end
101
101
  canvas[:desc] = @desc if @desc
102
102
  canvas[:title] = @title if @title
data/rmagick.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.required_ruby_version = ">= #{Magick::MIN_RUBY_VERSION}"
27
27
  s.requirements << "ImageMagick #{Magick::MIN_IM_VERSION} or later"
28
28
 
29
- s.add_development_dependency 'pry', '~> 0.12.2'
29
+ s.add_development_dependency 'pry', '~> 0.14'
30
30
  s.add_development_dependency 'rake-compiler', '~> 1.0'
31
31
  s.add_development_dependency 'rspec', '~> 3.8'
32
32
  s.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmagick
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.2
4
+ version: 4.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Hunter
8
8
  - Omer Bar-or
9
9
  - Benjamin Thomas
10
10
  - Moncef Maiza
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-02-23 00:00:00.000000000 Z
14
+ date: 2022-04-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: pry
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: 0.12.2
22
+ version: '0.14'
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 0.12.2
29
+ version: '0.14'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rake-compiler
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -202,7 +202,7 @@ homepage: https://github.com/rmagick/rmagick
202
202
  licenses:
203
203
  - MIT
204
204
  metadata: {}
205
- post_install_message:
205
+ post_install_message:
206
206
  rdoc_options: []
207
207
  require_paths:
208
208
  - lib
@@ -220,8 +220,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  version: '0'
221
221
  requirements:
222
222
  - ImageMagick 6.7.7 or later
223
- rubygems_version: 3.1.4
224
- signing_key:
223
+ rubygems_version: 3.2.32
224
+ signing_key:
225
225
  specification_version: 4
226
226
  summary: Ruby binding to ImageMagick
227
227
  test_files: []