rmagick 4.2.0 → 4.2.4

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: 260708d7b56c2e75a8a67393fc27c96897fd58c473f46c57c1febec5816200e9
4
- data.tar.gz: b5b17d6e606f44be1d09986e58988eaad715f2879570a3c16016ff6261cb5bd5
3
+ metadata.gz: 49c8cb7d9f379a29133d870ab4542f9e30c9f1828343c8dacc466b4795b86bb4
4
+ data.tar.gz: b3c32bda2622044535255bd080cb16e0fe2d7101f74be85db077cf4057ca8c21
5
5
  SHA512:
6
- metadata.gz: 1809116920cca2eb49f10412879badd216e2e00819796f4f7fb7d1ebd04792a206363f70d42893d2277260ec2fda028c66c7e33027c4ec6d5591c8826e6114b8
7
- data.tar.gz: 9e0edf4cc0afd66eeba825feb37a233e02365daec3737561ab8f101fe7b781953e9bfbe811a88823b66974db6e9a9d1bd1f70175b581b1ddc9691167e2c23a16
6
+ metadata.gz: 7510f2cbddbccf9c2002b81e42409cf2b59eecf8768bae710ea81bfe5d773e948b841c995d9eca261d249808087ecc72ff4a93f183e5dd77eccef8fb4414224b
7
+ data.tar.gz: 6570f951140ad45e61d09a8d9183a65f8e5c08d731ccce314c0e79e037c763d86d8bd7cb1f7dd88365e23da55a9b001e547d8004c4df74d0a4c3ff5d5c358d59
@@ -5,13 +5,12 @@ on:
5
5
  branches:
6
6
  - main
7
7
  pull_request:
8
- branches:
9
- - main
8
+ workflow_dispatch:
10
9
 
11
10
  jobs:
12
11
  lint:
13
12
  runs-on: ubuntu-latest
14
- timeout-minutes: 10
13
+ timeout-minutes: 20
15
14
  steps:
16
15
  - uses: actions/checkout@v2
17
16
  - name: Set up Ruby 2.3
@@ -25,15 +24,15 @@ jobs:
25
24
 
26
25
  test-linux:
27
26
  runs-on: ubuntu-latest
28
- timeout-minutes: 10
27
+ timeout-minutes: 20
29
28
  strategy:
30
29
  matrix:
31
- 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']
32
31
  imagemagick-version:
33
32
  - { full: 6.7.7-10, major-minor: '6.7' }
34
33
  - { full: 6.8.9-10, major-minor: '6.8' }
35
- - { full: 6.9.11-58, major-minor: '6.9' }
36
- - { full: 7.0.10-58, major-minor: '7.0' }
34
+ - { full: 6.9.12-29, major-minor: '6.9' }
35
+ - { full: 7.1.0-14, major-minor: '7.0' }
37
36
 
38
37
  name: Linux, Ruby ${{ matrix.ruby-version }}, IM ${{ matrix.imagemagick-version.major-minor }}
39
38
  steps:
@@ -56,10 +55,10 @@ jobs:
56
55
  timeout-minutes: 20
57
56
  strategy:
58
57
  matrix:
59
- ruby-version: ['2.6', '2.7', '3.0']
58
+ ruby-version: ['2.6', '2.7', '3.0', '3.1']
60
59
  imagemagick-version:
61
- - { full: 6.9.11-58, major-minor: '6.9' }
62
- - { full: 7.0.10-58, major-minor: '7.0' }
60
+ - { full: 6.9.12-29, major-minor: '6.9' }
61
+ - { full: 7.1.0-14, major-minor: '7.0' }
63
62
 
64
63
  name: macOS, Ruby ${{ matrix.ruby-version }}, IM ${{ matrix.imagemagick-version.major-minor }}
65
64
  steps:
@@ -75,34 +74,3 @@ jobs:
75
74
  run: |
76
75
  bundle install --path=vendor/bundle --jobs 4 --retry 3
77
76
  bundle exec rake
78
-
79
- test-windows:
80
- runs-on: windows-latest
81
- timeout-minutes: 10
82
- strategy:
83
- matrix:
84
- ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0']
85
- imagemagick-version:
86
- - { full: 6.8.9-10, major-minor: '6.8' }
87
- - { full: 6.9.11-29, major-minor: '6.9' } # seems that binary file mirroring have stopped.
88
- - { full: 7.0.10-29, major-minor: '7.0' } # seems that binary file mirroring have stopped.
89
- name: MSWin, Ruby ${{ matrix.ruby-version }}, IM ${{ matrix.imagemagick-version.major-minor }}
90
- steps:
91
- - uses: actions/checkout@v2
92
- - name: Set up Ruby ${{ matrix.ruby-version }}
93
- uses: ruby/setup-ruby@master
94
- with:
95
- ruby-version: ${{ matrix.ruby-version }}
96
- - name: Install ImageMagick
97
- run: |
98
- $imagemagick_version = "${{ matrix.imagemagick-version.full }}"
99
- $imagemagick_version_without_patch = $imagemagick_version.split("-")[0]
100
- $installer_name = "ImageMagick-$($imagemagick_version)-Q16-x64-dll.exe"
101
- $url = "https://ftp.icm.edu.pl/pub/graphics/ImageMagick/binaries/$($installer_name)"
102
- choco install wget
103
- choco install ghostscript -Version 9.50
104
- wget $url --progress=dot
105
- cmd.exe /D /S /C "$($installer_name) /DIR=D:\ImageMagick /VERYSILENT /TASKS=install_Devel"
106
- - name: Build and test with Rake
107
- run: |
108
- 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,8 +3,60 @@
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.4
7
+
8
+ Improvements
9
+
10
+ - spec_helper: drop require_relative to lib directory (#1306)
11
+ - Fix build error with Ruby 3.1 on macOS (#1313)
12
+
13
+ Bug Fixes
14
+
15
+ - remove Mutex in trace_proc= (#1303)
16
+ - channel_mean_spec: fix floating point comparison (#1307)
17
+ - changed_predicate_spec: ensure target directory exists (#1305)
18
+ - Doc: Fix documentation of Magick::Image#crop (#1311)
19
+ - Magick::UndefinedKernel should also not be used when creating a new KernelInfo. (#1312)
20
+
21
+ ## RMagick 4.2.3
22
+
23
+ Bug Fixes
24
+
25
+ - Re-add block syntax deprecation warning and fix in RMagick source (#1279) (#1280)
26
+ - Doc: Replace Magick::Montage with Magick::ImageList::Montage (#1281)
27
+ - Update shadow example (#1297)
28
+ - Escape the backslashes in windows error message (#1298)
29
+ - Also set the alpha value of the target pixel (#1299)
30
+ - Set alpha_trait to BlendPixelTrait when the alpha value of the pixel is not opaque. (#1300)
31
+
32
+ ## RMagick 4.2.2
33
+
34
+ Bug Fixes:
35
+
36
+ - Remove deprecation warning about block syntax (#1272)
37
+
38
+ You are still recommended to use the block parameter instead of `self.` but
39
+ we're silencing the deprecation warning until we can get RMagick's code up to
40
+ that standard.
41
+
42
+ ## RMagick 4.2.1
43
+
44
+ Bug Fixes:
45
+
46
+ - Fix compilation with optimization on glibc (#1263)
47
+
6
48
  ## RMagick 4.2.0
7
49
 
50
+ This adds a deprecation warning when using a block for image operations.
51
+ Instead of setting properties on `self`, you should accept a block argument and
52
+ modify that instead. In a future version we we no longer be binding the block
53
+ to the image.
54
+
55
+ ```diff
56
+ - img.to_blob { self.quality = 75 }
57
+ + img.to_blob { |image| image.quality = 75 }
58
+ ```
59
+
8
60
  Improvements:
9
61
 
10
62
  - Updated error messages if runtime ImageMagick version was not matched with when installed rmagick (#1213)
@@ -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,
@@ -69,7 +68,6 @@ module RMagick
69
68
  check_partial_imagemagick_versions
70
69
 
71
70
  # Save flags
72
- $CFLAGS = "#{ENV['CFLAGS']} " + `pkg-config --cflags #{$magick_package}`.chomp
73
71
  $CPPFLAGS = "#{ENV['CPPFLAGS']} " + `pkg-config --cflags #{$magick_package}`.chomp
74
72
  $LDFLAGS = "#{ENV['LDFLAGS']} " + `pkg-config --libs #{$magick_package}`.chomp
75
73
  $LOCAL_LIBS = "#{ENV['LIBS']} " + `pkg-config --libs #{$magick_package}`.chomp
@@ -96,7 +94,7 @@ module RMagick
96
94
 
97
95
  end
98
96
 
99
- $CFLAGS << (have_macro('__GNUC__') ? ' -std=gnu99' : ' -std=c99')
97
+ $CPPFLAGS << (have_macro('__GNUC__') ? ' -std=gnu99' : ' -std=c99')
100
98
  end
101
99
 
102
100
  def exit_failure(msg)
@@ -258,7 +256,7 @@ module RMagick
258
256
  Retry with '--with-opt-dir' option.
259
257
  Usage: gem install rmagick -- '--with-opt-dir=\"[path to ImageMagick]\"'
260
258
  e.g.
261
- gem install rmagick -- '--with-opt-dir=\"C:\Program Files\ImageMagick-6.9.1-Q16\"'
259
+ gem install rmagick -- '--with-opt-dir=\"C:\\Program Files\\ImageMagick-6.9.1-Q16\"'
262
260
  END_MINGW
263
261
  end
264
262
 
@@ -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
@@ -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
  {
@@ -1009,7 +1009,7 @@ ImageList_remap(int argc, VALUE *argv, VALUE self)
1009
1009
  *
1010
1010
  * @overload to_blob
1011
1011
  * Runs an info parm block if present - the user can specify the image format and depth
1012
- * @yield []
1012
+ * @yield [Magick::Image::Info]
1013
1013
  *
1014
1014
  * @return [String] the blob
1015
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!
@@ -5551,17 +5551,16 @@ Image_dissolve(int argc, VALUE *argv, VALUE self)
5551
5551
  * the source image will be taken into account in the mapping.
5552
5552
  *
5553
5553
  * @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")
5554
+ * When a block is given, distort yields with a block argument you can optionally use to set attributes.
5555
+ * - options.define("distort:viewport", "WxH+X+Y")
5557
5556
  * - Specify the size and offset of the generated viewport image of the distorted image space. W and
5558
5557
  * H are the width and height, and X and Y are the offset.
5559
- * - self.define("distort:scale", N)
5558
+ * - options.define("distort:scale", N)
5560
5559
  * - N is an integer factor. Scale the output image (viewport or otherwise) by that factor without
5561
5560
  * changing the viewed contents of the distorted image. This can be used either for
5562
5561
  * 'super-sampling' the image for a higher quality result, or for panning and zooming around
5563
5562
  * the image (with appropriate viewport changes, or post-distort cropping and resizing).
5564
- * - self.verbose(true)
5563
+ * - options.verbose(true)
5565
5564
  * - Attempt to output the internal coefficients, and the -fx equivalent to the distortion, for
5566
5565
  expert study, and debugging purposes. This many not be available for all distorts.
5567
5566
  * @param type [Magick::DistortMethod] a DistortMethod value
@@ -5570,13 +5569,13 @@ Image_dissolve(int argc, VALUE *argv, VALUE self)
5570
5569
  * image is adjusted to ensure the whole source image will just fit within the final destination
5571
5570
  * image, which will be sized and offset accordingly. Also in many cases the virtual offset of
5572
5571
  * the source image will be taken into account in the mapping.
5573
- * @yield []
5572
+ * @yield [Magick::OptionalMethodArguments]
5574
5573
  *
5575
5574
  * @return [Magick::Image] a new image
5576
5575
  * @example
5577
- * img.distort(Magick::ScaleRotateTranslateDistortion, [0]) do
5578
- * self.define "distort:viewport", "44x44+15+0"
5579
- * self.define "distort:scale", 2
5576
+ * img.distort(Magick::ScaleRotateTranslateDistortion, [0]) do |options|
5577
+ * options.define "distort:viewport", "44x44+15+0"
5578
+ * options.define "distort:scale", 2
5580
5579
  * end
5581
5580
  */
5582
5581
  VALUE
@@ -6882,7 +6881,7 @@ Image_frame(int argc, VALUE *argv, VALUE self)
6882
6881
  * @overload from_blob(blob)
6883
6882
  * This yields {Magick::Image::Info} to block with its object's scope.
6884
6883
  * @param blob [String] the blob data
6885
- * @yield []
6884
+ * @yield [Magick::Image::Info]
6886
6885
  *
6887
6886
  * @return [Array<Magick::Image>] an array of new images
6888
6887
  * @see Image#to_blob
@@ -8968,7 +8967,7 @@ Image_matte_flood_fill(int argc, VALUE *argv, VALUE self)
8968
8967
  rb_raise(rb_eNoMemError, "not enough memory to continue");
8969
8968
  }
8970
8969
  #if defined(IMAGEMAGICK_7)
8971
- draw_info->fill.alpha = alpha;
8970
+ rm_set_pixelinfo_alpha(&draw_info->fill, alpha);
8972
8971
  #else
8973
8972
  draw_info->fill.opacity = QuantumRange - alpha;
8974
8973
  #endif
@@ -8979,6 +8978,11 @@ Image_matte_flood_fill(int argc, VALUE *argv, VALUE self)
8979
8978
  target_mpp.red = (MagickRealType) image->border_color.red;
8980
8979
  target_mpp.green = (MagickRealType) image->border_color.green;
8981
8980
  target_mpp.blue = (MagickRealType) image->border_color.blue;
8981
+ #if defined(IMAGEMAGICK_7)
8982
+ rm_set_pixelinfo_alpha(&target_mpp, (MagickRealType) image->border_color.alpha);
8983
+ #else
8984
+ target_mpp.opacity = (MagickRealType) image->border_color.opacity;
8985
+ #endif
8982
8986
  }
8983
8987
  else
8984
8988
  {
@@ -8986,6 +8990,11 @@ Image_matte_flood_fill(int argc, VALUE *argv, VALUE self)
8986
8990
  target_mpp.red = (MagickRealType) target.red;
8987
8991
  target_mpp.green = (MagickRealType) target.green;
8988
8992
  target_mpp.blue = (MagickRealType) target.blue;
8993
+ #if defined(IMAGEMAGICK_7)
8994
+ rm_set_pixelinfo_alpha(&target_mpp, (MagickRealType) target.alpha);
8995
+ #else
8996
+ target_mpp.opacity = (MagickRealType) target.opacity;
8997
+ #endif
8989
8998
  }
8990
8999
 
8991
9000
  #if defined(IMAGEMAGICK_7)
@@ -10349,11 +10358,11 @@ Image_pixel_interpolation_method_eq(VALUE self, VALUE method)
10349
10358
  * If present a block, optional arguments may be specified in a block associated with the method.
10350
10359
  * These arguments control the shadow color and how the label is rendered.
10351
10360
  * 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.
10361
+ * use options.shadow_color.
10362
+ * To specify a different border color (that is, the color of the image border) use options.border_color.
10354
10363
  * Both of these methods accept either a color name or a Pixel argument.
10355
10364
  * @param angle [Float] The resulting image is rotated by this amount, measured in degrees.
10356
- * @yield []
10365
+ * @yield [Magick::Image::Info]
10357
10366
  *
10358
10367
  * @return [Magick::Image] a new image
10359
10368
  */
@@ -12325,7 +12334,7 @@ Image_segment(int argc, VALUE *argv, VALUE self)
12325
12334
  * @return [Hash] the properties
12326
12335
  *
12327
12336
  * @overload properties
12328
- * @yield []
12337
+ * @yield [Magick::Image::Info]
12329
12338
  * @return [Magick::Image] self
12330
12339
  */
12331
12340
  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
  */
@@ -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
@@ -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
@@ -12,6 +12,11 @@
12
12
 
13
13
  #include "rmagick.h"
14
14
  #include <errno.h>
15
+ #if defined(_WIN32)
16
+ #include <Windows.h>
17
+ #else
18
+ #include <pthread.h>
19
+ #endif
15
20
 
16
21
  static VALUE rescue_not_str(VALUE, VALUE ATTRIBUTE_UNUSED) ATTRIBUTE_NORETURN;
17
22
  static void handle_exception(ExceptionInfo *, Image *, ErrorRetention);
@@ -853,6 +858,25 @@ rm_magick_error(const char *msg)
853
858
  RB_GC_GUARD(mesg);
854
859
  }
855
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
856
880
 
857
881
  /**
858
882
  * Initialize a new ImageMagickError object - store the "loc" string in the
@@ -1889,10 +1913,8 @@ unsigned long long
1889
1913
  rm_current_thread_id()
1890
1914
  {
1891
1915
  #if defined(_WIN32)
1892
- #include <Windows.h>
1893
1916
  return (unsigned long long)GetCurrentThreadId();
1894
1917
  #else
1895
- #include <pthread.h>
1896
1918
  return (unsigned long long)pthread_self();
1897
1919
  #endif
1898
1920
  }
@@ -1,5 +1,5 @@
1
1
  module Magick
2
- VERSION = '4.2.0'
2
+ VERSION = '4.2.4'
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmagick
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Hunter
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-02-05 00:00:00.000000000 Z
14
+ date: 2021-12-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: pry
@@ -220,7 +220,7 @@ 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
223
+ rubygems_version: 3.2.32
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: Ruby binding to ImageMagick