rmagick 4.3.0 → 5.0.0

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: baffdb83618f956f81c5e8bf81873465642c2727f279514d416553b092590086
4
- data.tar.gz: 2d65e812017b48d555ad5e0865b24074910f495e2ef94b9c70e9b7a53980acb6
3
+ metadata.gz: fc51525cc3880511b635e26bf96e54159785ecabc95af81dda6f374f073074f5
4
+ data.tar.gz: 0f51ed92105011c4d7854946f2cf81c86a6fc5c0fcb48b0bd620e0e6b1f92d01
5
5
  SHA512:
6
- metadata.gz: 6040c8ff49d8eb0441b4ebd8fe2c30de695c28f95d17f4475851eae564e25383558f6588595b6e21d887c8edf20965b4f4a8587122925be8ffdac702bdecb4af
7
- data.tar.gz: 2012804b6a11228f960c89d8b3748e7917a9faa7ea8d717d18327f2ef3c3d390c1e892e9980c9d909d6bdf9a7594a0987c87797872043ab45775443d080b3df2
6
+ metadata.gz: 9aaca50c60d675aae5e868bf882ad14a544d92586ec02844b4be1a754acac6bac81f4729cf64c14cfe9cb1cfcf0d57b7eaecf179b8ab4097dee94ce44def05c8
7
+ data.tar.gz: 7279013b8d46a66dae34870f7f2918043a8e0305c0e7b79623b8dd66e3409a7707baf3dfd551c17927fce8718de57be2d170cfb0b7a2d156ee5420e9bcd9a814
data/.rubocop_todo.yml CHANGED
@@ -182,7 +182,6 @@ Naming/ConstantName:
182
182
  # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
183
183
  Naming/FileName:
184
184
  Exclude:
185
- - 'deprecated/RMagick.rb'
186
185
  - 'doc/ex/InitialCoords.rb'
187
186
  - 'doc/ex/NewCoordSys.rb'
188
187
  - 'doc/ex/OrigCoordSys.rb'
data/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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 5.0.0
7
+
8
+ Improvements
9
+
10
+ - Improve installer in order to avoid SEGV within pkg-config command (#1359)
11
+ - Clean up the documents and comment in source code referring to something that no longer exist (#1363)
12
+ - Remove deprecated 'tile' attribute in Draw#marshal_dump (#1364)
13
+ - Remove deprecated #instance_eval calling when block was given with Magick::ImageList#montage, Magick::Image::Info.new and more (#1362)
14
+ - Remove deprecated RMagick.rb file (#1361)
15
+ - Remove deprecated Magick.trace_proc= (#1351)
16
+ - Remove deprecated Magick::{Image, Image::Info}#monitor= (#1356)
17
+
6
18
  ## RMagick 4.3.0
7
19
 
8
20
  Deprecates
@@ -9,6 +9,33 @@ module RMagick
9
9
  RMAGICK_VERS = ::Magick::VERSION
10
10
  MIN_RUBY_VERS = ::Magick::MIN_RUBY_VERSION
11
11
 
12
+ # ImageMagick 6.7 package
13
+ IM6_7_PACKAGES = ['ImageMagick'].freeze
14
+
15
+ # ImageMagick 6.8+ packages
16
+ IM6_PACKAGES = %w[
17
+ ImageMagick-6.Q64HDRI
18
+ ImageMagick-6.Q32HDRI
19
+ ImageMagick-6.Q16HDRI
20
+ ImageMagick-6.Q8HDRI
21
+ ImageMagick-6.Q64
22
+ ImageMagick-6.Q32
23
+ ImageMagick-6.Q16
24
+ ImageMagick-6.Q8
25
+ ].freeze
26
+
27
+ # ImageMagick 7 packages
28
+ IM7_PACKAGES = %w[
29
+ ImageMagick-7.Q64HDRI
30
+ ImageMagick-7.Q32HDRI
31
+ ImageMagick-7.Q16HDRI
32
+ ImageMagick-7.Q8HDRI
33
+ ImageMagick-7.Q64
34
+ ImageMagick-7.Q32
35
+ ImageMagick-7.Q16
36
+ ImageMagick-7.Q8
37
+ ].freeze
38
+
12
39
  attr_reader :headers
13
40
 
14
41
  def initialize
@@ -123,31 +150,40 @@ module RMagick
123
150
  exit(1)
124
151
  end
125
152
 
153
+ def detect_imagemagick_packages(packages)
154
+ packages.select do |package|
155
+ system "pkg-config --exists #{package}"
156
+ end
157
+ end
158
+
159
+ def installed_im6_packages
160
+ @installed_im6_packages ||= detect_imagemagick_packages(IM6_PACKAGES)
161
+ end
162
+
163
+ def installed_im7_packages
164
+ @installed_im7_packages ||= detect_imagemagick_packages(IM7_PACKAGES)
165
+ end
166
+
126
167
  def determine_imagemagick_package
127
- packages = `pkg-config --list-all`.scan(/(ImageMagick\-[\.A-Z0-9]+) .*/).flatten
168
+ packages = [installed_im7_packages, installed_im6_packages].flatten
128
169
 
129
- # For ancient version of ImageMagick 6 we need a different regex
130
170
  if packages.empty?
131
- packages = `pkg-config --list-all`.scan(/(ImageMagick) .*/).flatten
171
+ # ImageMagick 6.7 does not have package file like ImageMagick-6.Q16.pc
172
+ packages = detect_imagemagick_packages(IM6_7_PACKAGES)
132
173
  end
133
174
 
134
175
  if packages.empty?
135
176
  exit_failure "Can't install RMagick #{RMAGICK_VERS}. Can't find ImageMagick with pkg-config\n"
136
177
  end
137
178
 
138
- if packages.length > 1
139
-
140
- im7_packages = packages.grep(/\AImageMagick-7/)
141
-
142
- if im7_packages.any?
143
- checking_for('forced use of ImageMagick 6') do
144
- if ENV['USE_IMAGEMAGICK_6']
145
- packages -= im7_packages
146
- true
147
- else
148
- packages = im7_packages
149
- false
150
- end
179
+ if installed_im6_packages.any? && installed_im7_packages.any?
180
+ checking_for('forced use of ImageMagick 6') do
181
+ if ENV['USE_IMAGEMAGICK_6']
182
+ packages = installed_im6_packages
183
+ true
184
+ else
185
+ packages = installed_im7_packages
186
+ false
151
187
  end
152
188
  end
153
189
  end
@@ -90,8 +90,8 @@
90
90
 
91
91
  //! Trace new image creation in bang methods
92
92
  #define UPDATE_DATA_PTR(_obj_, _new_) \
93
- do { (void) rm_trace_creation(_new_);\
94
- DATA_PTR(_obj_) = (void *)(_new_);\
93
+ do { \
94
+ DATA_PTR(_obj_) = (void *)(_new_); \
95
95
  } while(0)
96
96
 
97
97
 
@@ -396,7 +396,6 @@ EXTERN VALUE Class_KernelInfoType;
396
396
  /**
397
397
  * Commonly-used IDs
398
398
  */
399
- EXTERN ID rm_ID_trace_proc; /**< "@trace_proc" */
400
399
  EXTERN ID rm_ID_call; /**< "call" */
401
400
  EXTERN ID rm_ID_changed; /**< "changed" */
402
401
  EXTERN ID rm_ID_cur_image; /**< "cur_image" */
@@ -411,8 +410,6 @@ EXTERN ID rm_ID_push; /**< "push" */
411
410
  EXTERN ID rm_ID_values; /**< "values" */
412
411
  EXTERN ID rm_ID_width; /**< "width" */
413
412
 
414
- EXTERN unsigned long long rm_main_thread_id;
415
-
416
413
  #if !defined(min)
417
414
  #define min(a, b) ((a)<(b)?(a):(b)) /**< min of two values */
418
415
  #endif
@@ -1019,7 +1016,6 @@ extern VALUE Image_write(VALUE, VALUE);
1019
1016
 
1020
1017
  extern VALUE rm_image_new(Image *);
1021
1018
  extern void rm_image_destroy(void *);
1022
- extern void rm_trace_creation(Image *);
1023
1019
 
1024
1020
 
1025
1021
  // rmfill.c
@@ -1193,7 +1189,6 @@ typedef enum
1193
1189
  extern void rm_check_exception(ExceptionInfo *, Image *, ErrorRetention);
1194
1190
  extern void rm_ensure_result(Image *);
1195
1191
  extern Image *rm_clone_image(Image *);
1196
- extern MagickBooleanType rm_progress_monitor(const char *, const MagickOffsetType, const MagickSizeType, void *);
1197
1192
  extern VALUE rm_exif_by_entry(Image *);
1198
1193
  extern VALUE rm_exif_by_number(Image *);
1199
1194
  extern void rm_get_optional_arguments(VALUE);
@@ -1202,7 +1197,6 @@ extern void rm_error_handler(const ExceptionType, const char *, const char *);
1202
1197
  extern void rm_warning_handler(const ExceptionType, const char *, const char *);
1203
1198
  extern MagickBooleanType rm_should_raise_exception(ExceptionInfo *, const ExceptionRetention);
1204
1199
  extern void rm_raise_exception(ExceptionInfo *);
1205
- extern unsigned long long rm_current_thread_id();
1206
1200
  #if defined(IMAGEMAGICK_6)
1207
1201
  extern void rm_check_image_exception(Image *, ErrorRetention);
1208
1202
  #endif
data/ext/RMagick/rmdraw.c CHANGED
@@ -493,31 +493,17 @@ Draw_marshal_dump(VALUE self)
493
493
 
494
494
  ddraw = rb_hash_new();
495
495
 
496
- // rb_hash_aset(ddraw, CSTR2SYM("primitive"), MAGICK_STRING_TO_OBJ(draw->info->primitive)); internal
497
- // rb_hash_aset(ddraw, CSTR2SYM("geometry"), MAGICK_STRING_TO_OBJ(draw->info->geometry)); set by "text" primitive
498
- // rb_hash_aset(ddraw, CSTR2SYM("viewbox"), Import_RectangleInfo(&draw->info->viewbox)); internal
499
496
  rb_hash_aset(ddraw, CSTR2SYM("affine"), Import_AffineMatrix(&draw->info->affine));
500
497
  rb_hash_aset(ddraw, CSTR2SYM("gravity"), INT2FIX(draw->info->gravity));
501
498
  rb_hash_aset(ddraw, CSTR2SYM("fill"), Pixel_from_PixelColor(&draw->info->fill));
502
499
  rb_hash_aset(ddraw, CSTR2SYM("stroke"), Pixel_from_PixelColor(&draw->info->stroke));
503
500
  rb_hash_aset(ddraw, CSTR2SYM("stroke_width"), rb_float_new(draw->info->stroke_width));
504
- // rb_hash_aset(ddraw, CSTR2SYM("gradient"), Qnil); // not used yet
505
501
  rb_hash_aset(ddraw, CSTR2SYM("fill_pattern"), image_to_str(draw->info->fill_pattern));
506
- rb_hash_aset(ddraw, CSTR2SYM("tile"), Qnil); // deprecated
507
502
  rb_hash_aset(ddraw, CSTR2SYM("stroke_pattern"), image_to_str(draw->info->stroke_pattern));
508
503
  rb_hash_aset(ddraw, CSTR2SYM("stroke_antialias"), draw->info->stroke_antialias ? Qtrue : Qfalse);
509
504
  rb_hash_aset(ddraw, CSTR2SYM("text_antialias"), draw->info->text_antialias ? Qtrue : Qfalse);
510
- // rb_hash_aset(ddraw, CSTR2SYM("fill_rule"), INT2FIX(draw->info->fill_rule)); internal
511
- // rb_hash_aset(ddraw, CSTR2SYM("linecap"), INT2FIX(draw->info->linecap));
512
- // rb_hash_aset(ddraw, CSTR2SYM("linejoin"), INT2FIX(draw->info->linejoin));
513
- // rb_hash_aset(ddraw, CSTR2SYM("miterlimit"), ULONG2NUM(draw->info->miterlimit));
514
- // rb_hash_aset(ddraw, CSTR2SYM("dash_offset"), rb_float_new(draw->info->dash_offset));
515
505
  rb_hash_aset(ddraw, CSTR2SYM("decorate"), INT2FIX(draw->info->decorate));
516
- // rb_hash_aset(ddraw, CSTR2SYM("compose"), INT2FIX(draw->info->compose)); set via "image" primitive
517
- // rb_hash_aset(ddraw, CSTR2SYM("text"), MAGICK_STRING_TO_OBJ(draw->info->text)); set via "text" primitive
518
- // rb_hash_aset(ddraw, CSTR2SYM("face"), Qnil); internal
519
506
  rb_hash_aset(ddraw, CSTR2SYM("font"), MAGICK_STRING_TO_OBJ(draw->info->font));
520
- // rb_hash_aset(ddraw, CSTR2SYM("metrics"), Qnil); internal
521
507
  rb_hash_aset(ddraw, CSTR2SYM("family"), MAGICK_STRING_TO_OBJ(draw->info->family));
522
508
  rb_hash_aset(ddraw, CSTR2SYM("style"), INT2FIX(draw->info->style));
523
509
  rb_hash_aset(ddraw, CSTR2SYM("stretch"), INT2FIX(draw->info->stretch));
@@ -527,26 +513,17 @@ Draw_marshal_dump(VALUE self)
527
513
  rb_hash_aset(ddraw, CSTR2SYM("density"), MAGICK_STRING_TO_OBJ(draw->info->density));
528
514
  rb_hash_aset(ddraw, CSTR2SYM("align"), INT2FIX(draw->info->align));
529
515
  rb_hash_aset(ddraw, CSTR2SYM("undercolor"), Pixel_from_PixelColor(&draw->info->undercolor));
530
- // rb_hash_aset(ddraw, CSTR2SYM("border_color"), Pixel_from_PixelColor(&draw->info->border_color)); Montage and Polaroid
531
- // rb_hash_aset(ddraw, CSTR2SYM("server_name"), MAGICK_STRING_TO_OBJ(draw->info->server_name));
532
- // rb_hash_aset(ddraw, CSTR2SYM("dash_pattern"), dash_pattern_to_array(draw->info->dash_pattern)); internal
533
- // rb_hash_aset(ddraw, CSTR2SYM("clip_mask"), MAGICK_STRING_TO_OBJ(draw->info->clip_mask)); internal
534
- // rb_hash_aset(ddraw, CSTR2SYM("bounds"), Import_SegmentInfo(&draw->info->bounds)); internal
535
516
  rb_hash_aset(ddraw, CSTR2SYM("clip_units"), INT2FIX(draw->info->clip_units));
536
517
  #if defined(IMAGEMAGICK_7)
537
518
  rb_hash_aset(ddraw, CSTR2SYM("alpha"), QUANTUM2NUM(draw->info->alpha));
538
519
  #else
539
520
  rb_hash_aset(ddraw, CSTR2SYM("opacity"), QUANTUM2NUM(draw->info->opacity));
540
521
  #endif
541
- // rb_hash_aset(ddraw, CSTR2SYM("render"), draw->info->render ? Qtrue : Qfalse); internal
542
- // rb_hash_aset(ddraw, CSTR2SYM("element_reference"), Qnil); // not used yet
543
- // rb_hash_aset(ddraw, CSTR2SYM("debug"), draw->info->debug ? Qtrue : Qfalse);
544
522
  rb_hash_aset(ddraw, CSTR2SYM("kerning"), rb_float_new(draw->info->kerning));
545
523
  rb_hash_aset(ddraw, CSTR2SYM("interword_spacing"), rb_float_new(draw->info->interword_spacing));
546
524
 
547
525
  // Non-DrawInfo fields
548
526
  rb_hash_aset(ddraw, CSTR2SYM("primitives"), draw->primitives);
549
- // rb_hash_aset(ddraw, CSTR2SYM("shadow_color"), Pixel_from_PixelColor(&draw->shadow_color)); Polaroid-only
550
527
 
551
528
  return ddraw;
552
529
  }
@@ -565,20 +542,17 @@ Draw_marshal_load(VALUE self, VALUE ddraw)
565
542
  VALUE val;
566
543
 
567
544
  Data_Get_Struct(self, Draw, draw);
568
-
545
+
569
546
  if (draw->info == NULL)
570
547
  {
571
548
  ImageInfo *image_info;
572
549
 
573
550
  image_info = CloneImageInfo(NULL);
574
551
  draw->info = CloneDrawInfo(image_info, (DrawInfo *) NULL);
575
- DestroyImageInfo(image_info);
552
+ DestroyImageInfo(image_info);
576
553
  }
577
554
  OBJ_TO_MAGICK_STRING(draw->info->geometry, rb_hash_aref(ddraw, CSTR2SYM("geometry")));
578
555
 
579
- //val = rb_hash_aref(ddraw, CSTR2SYM("viewbox"));
580
- //Export_RectangleInfo(&draw->info->viewbox, val);
581
-
582
556
  val = rb_hash_aref(ddraw, CSTR2SYM("affine"));
583
557
  Export_AffineMatrix(&draw->info->affine, val);
584
558
 
@@ -853,16 +827,7 @@ VALUE Draw_annotate(
853
827
  // allowing the app a chance to modify the object's attributes
854
828
  if (rb_block_given_p())
855
829
  {
856
- if (rb_proc_arity(rb_block_proc()) == 0)
857
- {
858
- // Run the block in self's context
859
- rb_warn("passing a block without an image argument is deprecated");
860
- rb_obj_instance_eval(0, NULL, self);
861
- }
862
- else
863
- {
864
- rb_yield(self);
865
- }
830
+ rb_yield(self);
866
831
  }
867
832
 
868
833
  // Translate & store in Draw structure
@@ -973,7 +938,7 @@ Draw_clone(VALUE self)
973
938
  * @param image [Magick::Image, Magick::ImageList] Either an imagelist or an image. If an
974
939
  * imagelist, uses the current image.
975
940
  * @param operator [Magick::CompositeOperator] the operator
976
- *
941
+ *
977
942
  * @return [Magick::Draw] self
978
943
  */
979
944
  VALUE
@@ -1394,16 +1359,7 @@ DrawOptions_initialize(VALUE self)
1394
1359
 
1395
1360
  if (rb_block_given_p())
1396
1361
  {
1397
- if (rb_proc_arity(rb_block_proc()) == 0)
1398
- {
1399
- // Run the block in self's context
1400
- rb_warn("passing a block without an image argument is deprecated");
1401
- rb_obj_instance_eval(0, NULL, self);
1402
- }
1403
- else
1404
- {
1405
- rb_yield(self);
1406
- }
1362
+ rb_yield(self);
1407
1363
  }
1408
1364
 
1409
1365
  return self;
@@ -1466,16 +1422,7 @@ PolaroidOptions_initialize(VALUE self)
1466
1422
 
1467
1423
  if (rb_block_given_p())
1468
1424
  {
1469
- if (rb_proc_arity(rb_block_proc()) == 0)
1470
- {
1471
- // Run the block in self's context
1472
- rb_warn("passing a block without an image argument is deprecated");
1473
- rb_obj_instance_eval(0, NULL, self);
1474
- }
1475
- else
1476
- {
1477
- rb_yield(self);
1478
- }
1425
+ rb_yield(self);
1479
1426
  }
1480
1427
 
1481
1428
  return self;
@@ -429,7 +429,7 @@ ImageList_flatten_images(VALUE self)
429
429
  * Creates {Magick::ImageList::Montage} object, yields to block
430
430
  * if present in {Magick::ImageList::Montage} object's scope.
431
431
  * @yield [Magick::ImageList::Montage]
432
- *
432
+ *
433
433
  * @return [Magick::ImageList] a new image list
434
434
  */
435
435
  VALUE
@@ -444,17 +444,7 @@ ImageList_montage(VALUE self)
444
444
  montage_obj = rm_montage_new();
445
445
  if (rb_block_given_p())
446
446
  {
447
- // Run the block in the instance's context, allowing the app to modify the
448
- // object's attributes.
449
- if (rb_proc_arity(rb_block_proc()) == 0)
450
- {
451
- rb_warn("passing a block without an image argument is deprecated");
452
- rb_obj_instance_eval(0, NULL, montage_obj);
453
- }
454
- else
455
- {
456
- rb_yield(montage_obj);
457
- }
447
+ rb_yield(montage_obj);
458
448
  }
459
449
 
460
450
  Data_Get_Struct(montage_obj, Montage, montage);
@@ -63,9 +63,7 @@ static VALUE scale(int, int, VALUE *, VALUE, scaler_t);
63
63
  static VALUE threshold_image(int, VALUE *, VALUE, thresholder_t);
64
64
  static VALUE xform_image(int, VALUE, VALUE, VALUE, VALUE, VALUE, xformer_t);
65
65
  static VALUE array_from_images(Image *);
66
- static void call_trace_proc(Image *, const char *);
67
66
  static VALUE file_arg_rescue(VALUE, VALUE ATTRIBUTE_UNUSED) ATTRIBUTE_NORETURN;
68
- static VALUE rm_trace_creation_handle_exception(VALUE, VALUE) ATTRIBUTE_NORETURN;
69
67
 
70
68
  static const char *BlackPointCompensationKey = "PROFILE:black-point-compensation";
71
69
 
@@ -9190,42 +9188,6 @@ Image_modulate(int argc, VALUE *argv, VALUE self)
9190
9188
  }
9191
9189
 
9192
9190
 
9193
- /**
9194
- * Establish a progress monitor.
9195
- *
9196
- * - A progress monitor is a callable object. Save the monitor proc as the client_data and establish
9197
- * `progress_monitor' as the monitor exit. When `progress_monitor' is called, retrieve the proc
9198
- * and call it.
9199
- *
9200
- * @param monitor [Proc] the progress monitor
9201
- * @return [Proc] the given value
9202
- * @example
9203
- * img.monitor = Proc.new do |method, offset, span|
9204
- * print "%s is %3.0f%% complete.\n", method, (offset.to_f/span)*100)
9205
- * true
9206
- * end
9207
- * @deprecated Magick::Image#monitor= is deprecated. This method will be removed in RMagick 5.0.
9208
- */
9209
- VALUE
9210
- Image_monitor_eq(VALUE self, VALUE monitor)
9211
- {
9212
- Image *image = rm_check_frozen(self);
9213
-
9214
- rb_warning("Magick::Image#monitor= is deprecated. This method will be removed in RMagick 5.0.");
9215
-
9216
- if (NIL_P(monitor))
9217
- {
9218
- image->progress_monitor = NULL;
9219
- }
9220
- else
9221
- {
9222
- SetImageProgressMonitor(image, rm_progress_monitor, (void *)monitor);
9223
- }
9224
-
9225
- return monitor;
9226
- }
9227
-
9228
-
9229
9191
  /**
9230
9192
  * Return true if all the pixels in the image have the same red, green, and blue intensities and the
9231
9193
  * intensity is either 0 or {Magick::QuantumRange}.
@@ -9550,8 +9512,6 @@ rm_image_new(Image *image)
9550
9512
  {
9551
9513
  rm_ensure_result(image);
9552
9514
 
9553
- rm_trace_creation(image);
9554
-
9555
9515
  return Data_Wrap_Struct(Class_Image, NULL, rm_image_destroy, image);
9556
9516
  }
9557
9517
 
@@ -15813,75 +15773,6 @@ raise_ChannelType_error(VALUE arg)
15813
15773
  }
15814
15774
 
15815
15775
 
15816
-
15817
- /**
15818
- * If Magick.trace_proc is not nil, build an argument list and call the proc.
15819
- *
15820
- * No Ruby usage (internal function)
15821
- *
15822
- * @param image the image
15823
- * @param which which operation the proc is being called for
15824
- */
15825
- static void call_trace_proc(Image *image, const char *which)
15826
- {
15827
- VALUE trace;
15828
- VALUE trace_args[4];
15829
-
15830
- if (rb_ivar_defined(Module_Magick, rm_ID_trace_proc) == Qtrue)
15831
- {
15832
- trace = rb_ivar_get(Module_Magick, rm_ID_trace_proc);
15833
- if (!NIL_P(trace))
15834
- {
15835
- // Maybe the stack won't get extended until we need the space.
15836
- char buffer[MaxTextExtent];
15837
-
15838
- trace_args[0] = ID2SYM(rb_intern(which));
15839
-
15840
- build_inspect_string(image, buffer, sizeof(buffer));
15841
- trace_args[1] = rb_str_new2(buffer);
15842
-
15843
- snprintf(buffer, sizeof(buffer), "%p", (void *)image);
15844
- trace_args[2] = rb_str_new2(buffer+2); // don't use leading 0x
15845
- trace_args[3] = ID2SYM(rb_frame_this_func());
15846
- rb_funcall2(trace, rm_ID_call, 4, (VALUE *)trace_args);
15847
- }
15848
- }
15849
-
15850
- RB_GC_GUARD(trace);
15851
- }
15852
-
15853
-
15854
- static VALUE
15855
- rm_trace_creation_body(VALUE img)
15856
- {
15857
- Image *image = (Image *)img;
15858
- call_trace_proc(image, "c");
15859
- return Qnil;
15860
- }
15861
-
15862
- static VALUE
15863
- rm_trace_creation_handle_exception(VALUE img, VALUE exc)
15864
- {
15865
- Image *image = (Image *)img;
15866
- DestroyImage(image);
15867
- rb_exc_raise(exc);
15868
- }
15869
-
15870
- /**
15871
- * Trace image creation
15872
- *
15873
- * No Ruby usage (internal function)
15874
- *
15875
- * @param image the image
15876
- * @see call_trace_proc
15877
- */
15878
- void rm_trace_creation(Image *image)
15879
- {
15880
- rb_rescue(rm_trace_creation_body, (VALUE)image, rm_trace_creation_handle_exception, (VALUE)image);
15881
- }
15882
-
15883
-
15884
-
15885
15776
  /**
15886
15777
  * Destroy an image. Called from GC when all references to the image have gone
15887
15778
  * out of scope.
@@ -15900,7 +15791,6 @@ void rm_image_destroy(void *img)
15900
15791
 
15901
15792
  if (img != NULL)
15902
15793
  {
15903
- call_trace_proc(image, "d");
15904
15794
  DestroyImage(image);
15905
15795
  }
15906
15796
  }
data/ext/RMagick/rminfo.c CHANGED
@@ -1554,35 +1554,6 @@ Info_matte_color_eq(VALUE self, VALUE matte_arg)
1554
1554
  return matte_arg;
1555
1555
  }
1556
1556
 
1557
- /**
1558
- * Establish a progress monitor.
1559
- *
1560
- * @param monitor [Proc] the monitor
1561
- * @return [Proc] monitor
1562
- * @see Image#monitor=
1563
- * @deprecated Magick::Image::Info#monitor= is deprecated. This method will be removed in RMagick 5.0.
1564
- */
1565
- VALUE
1566
- Info_monitor_eq(VALUE self, VALUE monitor)
1567
- {
1568
- Info *info;
1569
-
1570
- Data_Get_Struct(self, Info, info);
1571
-
1572
- rb_warning("Magick::Image::Info#monitor= is deprecated. This method will be removed in RMagick 5.0.");
1573
-
1574
- if (NIL_P(monitor))
1575
- {
1576
- info->progress_monitor = NULL;
1577
- }
1578
- else
1579
- {
1580
- SetImageInfoProgressMonitor(info, rm_progress_monitor, (void *)monitor);
1581
- }
1582
-
1583
- return monitor;
1584
- }
1585
-
1586
1557
  /**
1587
1558
  * Get the monochrome value.
1588
1559
  *
@@ -2417,16 +2388,7 @@ Info_initialize(VALUE self)
2417
2388
  {
2418
2389
  if (rb_block_given_p())
2419
2390
  {
2420
- if (rb_proc_arity(rb_block_proc()) == 0)
2421
- {
2422
- // Run the block in self's context
2423
- rb_warn("passing a block without an image argument is deprecated");
2424
- rb_obj_instance_eval(0, NULL, self);
2425
- }
2426
- else
2427
- {
2428
- rb_yield(self);
2429
- }
2391
+ rb_yield(self);
2430
2392
  }
2431
2393
  return self;
2432
2394
  }
data/ext/RMagick/rmmain.c CHANGED
@@ -242,13 +242,10 @@ Init_RMagick2(void)
242
242
 
243
243
  test_Magick_version();
244
244
 
245
- rm_main_thread_id = rm_current_thread_id();
246
-
247
245
  /*-----------------------------------------------------------------------*/
248
246
  /* Create IDs for frequently used methods, etc. */
249
247
  /*-----------------------------------------------------------------------*/
250
248
 
251
- rm_ID_trace_proc = rb_intern("@trace_proc");
252
249
  rm_ID_call = rb_intern("call");
253
250
  rm_ID_changed = rb_intern("changed");
254
251
  rm_ID_cur_image = rb_intern("cur_image");
@@ -358,7 +355,6 @@ Init_RMagick2(void)
358
355
  rb_define_method(Class_Image, "matte_color=", Image_matte_color_eq, 1);
359
356
  rb_define_method(Class_Image, "mean_error_per_pixel", Image_mean_error_per_pixel, 0);
360
357
  rb_define_method(Class_Image, "mime_type", Image_mime_type, 0);
361
- rb_define_method(Class_Image, "monitor=", Image_monitor_eq, 1);
362
358
  rb_define_method(Class_Image, "montage", Image_montage, 0);
363
359
  rb_define_method(Class_Image, "normalized_mean_error", Image_normalized_mean_error, 0);
364
360
  rb_define_method(Class_Image, "normalized_maximum_error", Image_normalized_maximum_error, 0);
@@ -620,7 +616,7 @@ Init_RMagick2(void)
620
616
  rb_define_method(Class_Image, "write", Image_write, 1);
621
617
 
622
618
  /*-----------------------------------------------------------------------*/
623
- /* Class Magick::ImageList methods (see also RMagick.rb) */
619
+ /* Class Magick::ImageList methods */
624
620
  /*-----------------------------------------------------------------------*/
625
621
 
626
622
  Class_ImageList = rb_define_class_under(Module_Magick, "ImageList", rb_cObject);
@@ -735,8 +731,7 @@ Init_RMagick2(void)
735
731
  // include Comparable
736
732
  rb_include_module(Class_Pixel, rb_mComparable);
737
733
 
738
- // Magick::Pixel has 4 constructors: "new" "from_color", "from_hsla",
739
- // and the deprecated "from_HSL".
734
+ // Magick::Pixel has 3 constructors: "new" "from_color", "from_hsla"
740
735
  rb_define_alloc_func(Class_Pixel, Pixel_alloc);
741
736
  rb_define_singleton_method(Class_Pixel, "from_color", Pixel_from_color, 1);
742
737
  rb_define_singleton_method(Class_Pixel, "from_hsla", Pixel_from_hsla, -1);
@@ -878,7 +873,6 @@ Init_RMagick2(void)
878
873
  rb_define_method(Class_Info, "label=", Info_label_eq, 1);
879
874
  rb_define_method(Class_Info, "matte_color", Info_matte_color, 0);
880
875
  rb_define_method(Class_Info, "matte_color=", Info_matte_color_eq, 1);
881
- rb_define_method(Class_Info, "monitor=", Info_monitor_eq, 1);
882
876
  rb_define_method(Class_Info, "monochrome", Info_monochrome, 0);
883
877
  rb_define_method(Class_Info, "monochrome=", Info_monochrome_eq, 1);
884
878
  rb_define_method(Class_Info, "number_scenes", Info_number_scenes, 0);
@@ -1852,7 +1846,7 @@ Init_RMagick2(void)
1852
1846
  *
1853
1847
  * Notes:
1854
1848
  * - Bypass the test by defining the constant RMAGICK_BYPASS_VERSION_TEST to
1855
- * 'true' at the top level, before requiring 'RMagick'
1849
+ * 'true' at the top level, before requiring 'rmagick'
1856
1850
  */
1857
1851
  static void
1858
1852
  test_Magick_version(void)
data/ext/RMagick/rmutil.c CHANGED
@@ -1025,15 +1025,7 @@ rm_get_optional_arguments(VALUE img)
1025
1025
  argv[0] = img;
1026
1026
  opt_args = rb_class_new_instance(1, argv, optional_method_arguments);
1027
1027
 
1028
- if (rb_proc_arity(rb_block_proc()) == 0)
1029
- {
1030
- rb_warn("passing a block without an image argument is deprecated");
1031
- rb_obj_instance_eval(0, NULL, opt_args);
1032
- }
1033
- else
1034
- {
1035
- rb_yield(opt_args);
1036
- }
1028
+ rb_yield(opt_args);
1037
1029
  }
1038
1030
 
1039
1031
  RB_GC_GUARD(optional_method_arguments);
@@ -1273,7 +1265,7 @@ void rm_sync_image_options(Image *image, Info *info)
1273
1265
  /**
1274
1266
  * Replicate old (ImageMagick < 6.3.2) EXIF:* functionality using
1275
1267
  * GetImageProperty by returning the exif entries as a single string, separated
1276
- * by \n's. Do this so that RMagick.rb works no matter which version of
1268
+ * by \n's. Do this so that RMagick works no matter which version of
1277
1269
  * ImageMagick is in use.
1278
1270
  *
1279
1271
  * No Ruby usage (internal function)
@@ -1392,7 +1384,7 @@ rm_exif_by_entry(Image *image)
1392
1384
  /**
1393
1385
  * Replicate old (ImageMagick < 6.3.2) EXIF:! functionality using
1394
1386
  * GetImageProperty by returning the exif entries as a single string, separated
1395
- * by \n's. Do this so that RMagick.rb works no matter which version of
1387
+ * by \n's. Do this so that RMagick works no matter which version of
1396
1388
  * ImageMagick is in use.
1397
1389
  *
1398
1390
  * No Ruby usage (internal function)
@@ -1538,64 +1530,6 @@ rm_clone_image(Image *image)
1538
1530
  }
1539
1531
 
1540
1532
 
1541
- /**
1542
- * SetImage(Info)ProgressMonitor exit.
1543
- *
1544
- * No Ruby usage (internal function)
1545
- *
1546
- * Notes:
1547
- * - ImageMagick's "tag" argument is unused. We pass along the method name
1548
- * instead.
1549
- *
1550
- * @param tag ImageMagick argument (unused)
1551
- * @param of the offset type
1552
- * @param sp the size type
1553
- * @param client_data pointer to the progress method to call
1554
- * @return true if calling client_data returns a non-nil value, otherwise false
1555
- */
1556
- MagickBooleanType
1557
- rm_progress_monitor(
1558
- const char *tag ATTRIBUTE_UNUSED,
1559
- const MagickOffsetType of,
1560
- const MagickSizeType sp,
1561
- void *client_data)
1562
- {
1563
- VALUE rval;
1564
- VALUE method, offset, span;
1565
-
1566
- // Check running thread.
1567
- if (rm_current_thread_id() != rm_main_thread_id)
1568
- {
1569
- // ImageMagick might call back in a different thread than Ruby is running in.
1570
- // If it is a different thread, it would not have a Ruby GVL and
1571
- // it could not retrieve properly Ruby stack.
1572
-
1573
- // Unfortunately, there is no API available to check if the current thread has a GVL,
1574
- // so the thread id was checked in here.
1575
- return MagickTrue;
1576
- }
1577
-
1578
- #if defined(HAVE_LONG_LONG) // defined in Ruby's defines.h
1579
- offset = rb_ll2inum(of);
1580
- span = rb_ull2inum(sp);
1581
- #else
1582
- offset = rb_int2big((long)of);
1583
- span = rb_uint2big((unsigned long)sp);
1584
- #endif
1585
-
1586
- method = rb_id2str(rb_frame_this_func());
1587
-
1588
- rval = rb_funcall((VALUE)client_data, rm_ID_call, 3, method, offset, span);
1589
-
1590
- RB_GC_GUARD(rval);
1591
- RB_GC_GUARD(method);
1592
- RB_GC_GUARD(offset);
1593
- RB_GC_GUARD(span);
1594
-
1595
- return RTEST(rval) ? MagickTrue : MagickFalse;
1596
- }
1597
-
1598
-
1599
1533
  /**
1600
1534
  * Remove the ImageMagick links between images in an scene sequence.
1601
1535
  *
@@ -1901,20 +1835,3 @@ rm_raise_exception(ExceptionInfo *exception)
1901
1835
 
1902
1836
  rm_magick_error(msg);
1903
1837
  }
1904
-
1905
- /**
1906
- * Get current thread id.
1907
- *
1908
- * No Ruby usage (internal function)
1909
- *
1910
- * @return thread id
1911
- */
1912
- unsigned long long
1913
- rm_current_thread_id()
1914
- {
1915
- #if defined(_WIN32)
1916
- return (unsigned long long)GetCurrentThreadId();
1917
- #else
1918
- return (unsigned long long)pthread_self();
1919
- #endif
1920
- }
@@ -1,5 +1,5 @@
1
1
  module Magick
2
- VERSION = '4.3.0'
2
+ VERSION = '5.0.0'
3
3
  MIN_RUBY_VERSION = '2.3.0'
4
4
  MIN_IM_VERSION = '6.7.7'
5
5
  end
@@ -24,8 +24,6 @@ require 'RMagick2.so'
24
24
 
25
25
  module Magick
26
26
  @formats = nil
27
- @trace_proc = nil
28
- @exit_block_set_up = nil
29
27
  IMAGEMAGICK_VERSION = Magick::Magick_version.split[1].split('-').first
30
28
 
31
29
  class << self
@@ -62,39 +60,6 @@ module Magick
62
60
  @formats
63
61
  end
64
62
  end
65
-
66
- # If the Magick module attribute +trace_proc+ is set to a Proc object,
67
- # RMagick calls the proc whenever an image is created or destroyed.
68
- #
69
- # You can use this proc to keep track of which images your program has created
70
- # and which have been destroyed.
71
- #
72
- # @param p [Proc] The proc object.
73
- # The following value will be passed into the proc object.
74
- # - +which+ - A symbol that indicates which operation the proc is being called for.
75
- # If the proc is called for an image creation, the value is +:c+.
76
- # If called for an image destruction, the value is +:d+.
77
- # - +description+ - A string describing the image. This is the same string that
78
- # would be returned by calling the image's inspect method.
79
- # - +id+ - A unique identifier for the image. This identifier is not the same as the object's +object_id+.
80
- # - +method+ - The name of the method responsible for creating or destroying the image.
81
- #
82
- # @example
83
- # Magick.trace_proc = proc do |which, description, id, method|
84
- # ...
85
- # end
86
- #
87
- # @deprecated Magick.trace_proc= is deprecated. This method will be removed in RMagick 5.0.
88
- def trace_proc=(p)
89
- warn 'Magick.trace_proc= is deprecated. This method will be removed in RMagick 5.0.'
90
-
91
- if @trace_proc.nil? && !p.nil? && !@exit_block_set_up
92
- at_exit { @trace_proc = nil }
93
- @exit_block_set_up = true
94
- end
95
-
96
- @trace_proc = p
97
- end
98
63
  end
99
64
 
100
65
  # Geometry class and related enum constants
data/rmagick.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  files = tracked_files.reject { |file| file[file_exclusion_regex] }
19
19
 
20
20
  s.files = files
21
- s.require_paths << 'ext' << 'deprecated'
21
+ s.require_paths << 'ext'
22
22
 
23
23
  s.extensions = %w[ext/RMagick/extconf.rb]
24
24
  s.required_ruby_version = ">= #{Magick::MIN_RUBY_VERSION}"
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.3.0
4
+ version: 5.0.0
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: 2022-09-23 00:00:00.000000000 Z
14
+ date: 2022-10-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: pry
@@ -169,7 +169,6 @@ files:
169
169
  - Rakefile
170
170
  - before_install_linux.sh
171
171
  - before_install_osx.sh
172
- - deprecated/RMagick.rb
173
172
  - ext/RMagick/extconf.rb
174
173
  - ext/RMagick/rmagick.c
175
174
  - ext/RMagick/rmagick.h
@@ -212,7 +211,6 @@ rdoc_options: []
212
211
  require_paths:
213
212
  - lib
214
213
  - ext
215
- - deprecated
216
214
  required_ruby_version: !ruby/object:Gem::Requirement
217
215
  requirements:
218
216
  - - ">="
@@ -1,6 +0,0 @@
1
- # This file is added to the require_paths in rmagick.gemspec
2
- # That should be removed as well when this file is removed
3
-
4
- warn '[DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead'
5
-
6
- require 'rmagick_internal'