rmagick 3.2.0 → 4.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: 1bc6ac748ddb89b0be62b816518a4193167fb74eab1d482187a2e8fc5b3bc707
4
- data.tar.gz: 509ab59e79d7ba1a47e18dacdf5032a014df73e791c63313f1faa88efc1a6a64
3
+ metadata.gz: ee811873773369d58f0dc4111203635ef513ef4f71563e9c89b18370c11c4c15
4
+ data.tar.gz: 2b8c09fc168e2709803328a71d8465e4ea64f5b4ce01370021cd7ba63b4dbed8
5
5
  SHA512:
6
- metadata.gz: eaf280335cb5d4e9fc67c769d3b91308ab84689012e399eaf92043ab4058655fcac0087836bfed05647e2f813c30d823f9d664cc31143a02b7ba76c0747b412d
7
- data.tar.gz: 8d08619eb5ae6bf689e0c05d59da465d9b53c1c090733fe723d5d0f020e332bafc841860f86b6d38e21bb85fb12da59ebf2a97e3a6f8136f9c405565c8c01d64
6
+ metadata.gz: 304f95885436b898fb2dbb609123583c17fae2a1ae78442fa0e5f6c4673073aff0f445ab5b31e699db56a6e9631ce4109cd16dde93ef974bb4b216aadbbcbc7c
7
+ data.tar.gz: 9e5b5ab7b36cb5f26e3c878b01b3694ddaa10829dfca6049e314e961f8514a9f6495ce2f3ea6a6e78d78871b08c6a6171c0b77f72994547982cb5efb481b7a06
@@ -3,6 +3,57 @@
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.0.0
7
+
8
+ This release removes a *lot* of deprecated functionality, so first upgrade to
9
+ 3.2 and handle any deprecation warnings you see there before upgrading to 4.0.
10
+ There are a handful of removals that we could not, or forgot to deprecate, so
11
+ pay special attention to those below. This clears the road for ImageMagick 7
12
+ support in the very near future.
13
+
14
+ Breaking Changes:
15
+
16
+ - Removed deprecated Image#matte and Image#matte= (#731)
17
+ - Removed deprecated Draw#matte. (#736)
18
+ - Removed deprecated ImageList#fx. (#732)
19
+ - Removed deprecated Info#group and Info#group=. (#733)
20
+ - Removed deprecated KernelInfo#show. (#734)
21
+ - Removed deprecated Pixel#opacity and Pixel#opacity=. (#735)
22
+ - Removed deprecated KernelInfo#zero_nans. (#741)
23
+ - Removed deprecated ImageList#map (#740)
24
+ - Removed deprecated Pixel#from_HSL. (#742)
25
+ - Removed deprecated Image#alpha=. (#739)
26
+ - Removed deprecated Pixel#to_HSL. (#745)
27
+ - Removed deprecated Image#blur and Image#blur=. (#746)
28
+ - Removed deprecated Image#sync_profiles. (#754)
29
+ - Removed deprecated Image#opacity=. (#753)
30
+ - Removed deprecated Image#combine. (#752)
31
+ - Removed deprecated Image#map. (#751)
32
+ - Removed deprecated Image#mask=. (#750)
33
+ - Removed deprecated opacity arguments. (#757)
34
+ - Removed deprecated `OpaqueOpacity` and `TransparentOpacity`. (#765)
35
+ - Removed obsolete enumerations. (#766)
36
+
37
+ The following changes *did not have deprecation warnings* in 3.2, so you'll
38
+ want to double check that you update your code if you were relying on the
39
+ existing behavior:
40
+
41
+ - Changed Color#to_s to return an string that contains alpha instead of opacity. (#760)
42
+ - Changed Pixel#to_s to return a string that contains alpha instead of opacity. (#762)
43
+ - Changed Pixel#hash to use alpha instead of opacity. (#763)
44
+ - Changed Pixel#<=> to use alpha instead of opacity. (#764)
45
+ - Removed `BicubicInterpolatePixel` (use `CatromInterpolatePixel` instead) (#768)
46
+ - Removed `FilterInterpolatePixel` (no replacement) (#768)
47
+ - Renamed `NearestNeighborInterpolatePixel` to `NearestInterpolatePixel` (#768)
48
+
49
+ Enhancements:
50
+
51
+ - Add SetQuantumOperator (#755)
52
+
53
+ Bug Fixes:
54
+
55
+ - Fix SEGV in Image#each_profile (#737)
56
+
6
57
  ## RMagick 3.2.0
7
58
 
8
59
  This is expected to be the final deprecation release before RMagick 4.0. We
@@ -16,7 +16,8 @@ regwidth = shorts.columns / 2
16
16
  regheight = shorts.rows / 2
17
17
 
18
18
  mask = Image.new(regwidth, regheight) { self.background_color = 'white' }
19
- mask.opacity = 0.50 * TransparentOpacity
19
+ mask.alpha(Magick::ActivateAlphaChannel)
20
+ mask.quantum_operator(SetQuantumOperator, 0.50 * QuantumRange, AlphaChannel)
20
21
 
21
22
  black = Image.new(shorts.columns, shorts.rows) { self.background_color = 'black' }
22
23
  pairs = ImageList.new
@@ -21,7 +21,7 @@ module Magick
21
21
  self.red = bg.red
22
22
  self.green = bg.green
23
23
  self.blue = bg.blue
24
- self.opacity = bg.opacity
24
+ self.alpha = bg.alpha
25
25
  end
26
26
  end
27
27
 
@@ -97,7 +97,7 @@ module Magick
97
97
  blue_column[y].green = 0
98
98
  rgb_column[y].blue = QuantumRange
99
99
  end
100
- int_column[y].opacity = TransparentOpacity if yf >= HISTOGRAM_ROWS - (int[x] * scale)
100
+ int_column[y].alpha = TransparentAlpha if yf >= HISTOGRAM_ROWS - (int[x] * scale)
101
101
  end
102
102
 
103
103
  rgb_histogram.store_pixels(x, 0, 1, HISTOGRAM_ROWS, rgb_column)
@@ -20,16 +20,16 @@ module Magick
20
20
  puts "\t\tRed: #{channel_depth(Magick::RedChannel)}-bits\n"
21
21
  puts "\t\tGreen: #{channel_depth(Magick::GreenChannel)}-bits\n"
22
22
  puts "\t\tBlue: #{channel_depth(Magick::BlueChannel)}-bits\n"
23
- puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if matte
23
+ puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if alpha
24
24
  when Magick::CMYKColorspace
25
25
  puts "\t\tCyan : #{channel_depth(Magick::CyanChannel)}-bits\n"
26
26
  puts "\t\tMagenta: #{channel_depth(Magick::MagentaChannel)}-bits\n"
27
27
  puts "\t\tYellow: #{channel_depth(Magick::YellowChannel)}-bits\n"
28
28
  puts "\t\tBlack: #{channel_depth(Magick::BlackChannel)}-bits\n"
29
- puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if matte
29
+ puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if alpha
30
30
  when Magick::GRAYColorspace
31
31
  puts "\t\tGray: #{channel_depth(Magick::GrayChannel)}-bits\n"
32
- puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if matte
32
+ puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if alpha
33
33
  end
34
34
  scale = Magick::QuantumRange / (Magick::QuantumRange >> (Magick::MAGICKCORE_QUANTUM_DEPTH - channel_depth))
35
35
  puts "\tChannel statistics:\n"
@@ -78,7 +78,7 @@ module Magick
78
78
  puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[0] / scale, channel_mean(Magick::GrayChannel)[0] / Magick::QuantumRange)
79
79
  puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[1] / scale, channel_mean(Magick::GrayChannel)[1] / Magick::QuantumRange)
80
80
  end
81
- if matte
81
+ if alpha
82
82
  puts "\t\tOpacity:\n"
83
83
  puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[0] / scale, channel_extrema(Magick::OpacityChannel)[0] / Magick::QuantumRange)
84
84
  puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[1] / scale, channel_extrema(Magick::OpacityChannel)[1] / Magick::QuantumRange)
@@ -45,18 +45,18 @@ gc.draw(oval)
45
45
 
46
46
  oval = oval.blur_image(0, 20)
47
47
 
48
- # The CopyOpacityCompositeOp transforms the opacity level of each image pixel
48
+ # The CopyAlphaCompositeOp transforms the opacity level of each image pixel
49
49
  # according to the intensity of the composite image pixels. In this case, the
50
50
  # black pixels outside the oval become transparent and the white pixels inside
51
51
  # the oval remain opaque. Each gray pixel around the border of the oval has a
52
52
  # varying level of transparency depending on how dark or light it is.
53
53
 
54
54
  ballerina.alpha(Magick::ActivateAlphaChannel) # Ensure the ballerina image's opacity channel is enabled.
55
- oval.alpha(Magick::DeactivateAlphaChannel) # Force the CopyOpacityCompositeOp to use pixel intensity
55
+ oval.alpha(Magick::DeactivateAlphaChannel) # Force the CopyAlphaCompositeOp to use pixel intensity
56
56
  # to determine how much transparency to add to the ballerina
57
57
  # pixels.
58
58
 
59
- ballerina = ballerina.composite(oval, CenterGravity, CopyOpacityCompositeOp)
59
+ ballerina = ballerina.composite(oval, CenterGravity, CopyAlphaCompositeOp)
60
60
 
61
61
  # Since the vignette has multiple levels of transparency, we can't
62
62
  # save it as a GIF or a JPEG. The PNG format can handle it, though.
@@ -234,6 +234,7 @@ typedef enum _QuantumExpressionOperator
234
234
  PoissonNoiseQuantumOperator, /**< poisson noise */
235
235
  UniformNoiseQuantumOperator, /**< uniform noise */
236
236
  CosineQuantumOperator, /**< cosine */
237
+ SetQuantumOperator, /**< set */
237
238
  SineQuantumOperator, /**< sine */
238
239
  AddModulusQuantumOperator, /**< add modulus */
239
240
  MeanQuantumOperator, /**< mean */
@@ -607,8 +608,6 @@ extern VALUE ImageList_composite_layers(int, VALUE *, VALUE);
607
608
  extern VALUE ImageList_deconstruct(VALUE);
608
609
  extern VALUE ImageList_display(VALUE);
609
610
  extern VALUE ImageList_flatten_images(VALUE);
610
- extern VALUE ImageList_fx(int, VALUE *, VALUE);
611
- extern VALUE ImageList_map(int, VALUE *, VALUE);
612
611
  extern VALUE ImageList_montage(VALUE);
613
612
  extern VALUE ImageList_morph(VALUE, VALUE);
614
613
  extern VALUE ImageList_mosaic(VALUE);
@@ -645,7 +644,6 @@ ATTR_ACCESSOR(Info, font)
645
644
  ATTR_ACCESSOR(Info, format)
646
645
  ATTR_ACCESSOR(Info, fuzz)
647
646
  ATTR_ACCESSOR(Info, gravity)
648
- ATTR_ACCESSOR(Info, group)
649
647
  ATTR_ACCESSOR(Info, image_type)
650
648
  ATTR_ACCESSOR(Info, interlace)
651
649
  ATTR_ACCESSOR(Info, label)
@@ -689,9 +687,7 @@ extern GravityType rm_gravity_to_enum(const char *);
689
687
  extern VALUE KernelInfo_alloc(VALUE);
690
688
 
691
689
  extern VALUE KernelInfo_initialize(VALUE, VALUE);
692
- extern VALUE KernelInfo_zero_nans(VALUE);
693
690
  extern VALUE KernelInfo_unity_add(VALUE, VALUE);
694
- extern VALUE KernelInfo_show(VALUE);
695
691
  extern VALUE KernelInfo_scale(VALUE, VALUE, VALUE);
696
692
  extern VALUE KernelInfo_scale_geometry(VALUE, VALUE);
697
693
  extern VALUE KernelInfo_clone(VALUE);
@@ -700,14 +696,12 @@ extern VALUE KernelInfo_builtin(VALUE, VALUE, VALUE);
700
696
 
701
697
 
702
698
  // rmimage.c
703
- ATTR_WRITER(Image, alpha)
704
699
  ATTR_ACCESSOR(Image, background_color)
705
700
  ATTR_READER(Image, base_columns)
706
701
  ATTR_READER(Image, base_filename)
707
702
  ATTR_READER(Image, base_rows)
708
703
  ATTR_ACCESSOR(Image, bias)
709
704
  ATTR_ACCESSOR(Image, black_point_compensation)
710
- ATTR_ACCESSOR(Image, blur)
711
705
  ATTR_ACCESSOR(Image, border_color)
712
706
  ATTR_READER(Image, bounding_box)
713
707
  ATTR_ACCESSOR(Image, chromaticity)
@@ -737,8 +731,6 @@ ATTR_ACCESSOR(Image, image_type)
737
731
  ATTR_ACCESSOR(Image, interlace)
738
732
  ATTR_ACCESSOR(Image, iptc_profile)
739
733
  ATTR_ACCESSOR(Image, iterations)
740
- ATTR_WRITER(Image, mask)
741
- ATTR_ACCESSOR(Image, matte)
742
734
  ATTR_ACCESSOR(Image, matte_color)
743
735
  ATTR_READER(Image, mean_error_per_pixel)
744
736
  ATTR_READER(Image, mime_type)
@@ -748,7 +740,6 @@ ATTR_READER(Image, normalized_mean_error)
748
740
  ATTR_READER(Image, normalized_maximum_error)
749
741
  ATTR_READER(Image, number_colors)
750
742
  ATTR_ACCESSOR(Image, offset)
751
- ATTR_WRITER(Image, opacity)
752
743
  ATTR_ACCESSOR(Image, orientation)
753
744
  ATTR_ACCESSOR(Image, page)
754
745
  ATTR_ACCESSOR(Image, pixel_interpolation_method)
@@ -819,7 +810,6 @@ extern VALUE Image_color_flood_fill(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
819
810
  extern VALUE Image_color_histogram(VALUE);
820
811
  extern VALUE Image_colorize(int, VALUE *, VALUE);
821
812
  extern VALUE Image_colormap(int, VALUE *, VALUE);
822
- extern VALUE Image_combine(int, VALUE *, VALUE);
823
813
  extern VALUE Image_composite(int, VALUE *, VALUE);
824
814
  extern VALUE Image_composite_affine(VALUE, VALUE, VALUE);
825
815
  extern VALUE Image_composite_bang(int, VALUE *, VALUE);
@@ -899,7 +889,6 @@ extern VALUE Image_liquid_rescale(int, VALUE *, VALUE);
899
889
  extern VALUE Image__load(VALUE, VALUE);
900
890
  extern VALUE Image_magnify(VALUE);
901
891
  extern VALUE Image_magnify_bang(VALUE);
902
- extern VALUE Image_map(int, VALUE *, VALUE);
903
892
  extern VALUE Image_marshal_dump(VALUE);
904
893
  extern VALUE Image_marshal_load(VALUE, VALUE);
905
894
  extern VALUE Image_mask(int, VALUE *, VALUE);
@@ -975,7 +964,6 @@ extern VALUE Image_stereo(VALUE, VALUE);
975
964
  extern VALUE Image_store_pixels(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
976
965
  extern VALUE Image_strip_bang(VALUE);
977
966
  extern VALUE Image_swirl(VALUE, VALUE);
978
- extern VALUE Image_sync_profiles(VALUE);
979
967
  extern VALUE Image_texture_flood_fill(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
980
968
  extern VALUE Image_threshold(VALUE, VALUE);
981
969
  extern VALUE Image_thumbnail(int, VALUE *, VALUE);
@@ -1024,7 +1012,6 @@ ATTR_ACCESSOR(Pixel, red)
1024
1012
  ATTR_ACCESSOR(Pixel, green)
1025
1013
  ATTR_ACCESSOR(Pixel, blue)
1026
1014
  ATTR_ACCESSOR(Pixel, alpha)
1027
- ATTR_ACCESSOR(Pixel, opacity)
1028
1015
  ATTR_ACCESSOR(Pixel, cyan)
1029
1016
  ATTR_ACCESSOR(Pixel, magenta)
1030
1017
  ATTR_ACCESSOR(Pixel, yellow)
@@ -1037,7 +1024,6 @@ extern VALUE Pixel_dup(VALUE);
1037
1024
  extern VALUE Pixel_eql_q(VALUE, VALUE);
1038
1025
  extern VALUE Pixel_fcmp(int, VALUE *, VALUE);
1039
1026
  extern VALUE Pixel_from_color(VALUE, VALUE);
1040
- extern VALUE Pixel_from_HSL(VALUE, VALUE);
1041
1027
  extern VALUE Pixel_from_hsla(int, VALUE *, VALUE);
1042
1028
  extern VALUE Pixel_hash(VALUE);
1043
1029
  extern VALUE Pixel_initialize(int, VALUE *, VALUE);
@@ -1047,7 +1033,6 @@ extern VALUE Pixel_marshal_dump(VALUE);
1047
1033
  extern VALUE Pixel_marshal_load(VALUE, VALUE);
1048
1034
  extern VALUE Pixel_spaceship(VALUE, VALUE);
1049
1035
  extern VALUE Pixel_to_color(int, VALUE *, VALUE);
1050
- extern VALUE Pixel_to_HSL(VALUE);
1051
1036
  extern VALUE Pixel_to_hsla(VALUE);
1052
1037
  extern VALUE Pixel_to_s(VALUE);
1053
1038
 
@@ -426,132 +426,6 @@ ImageList_flatten_images(VALUE self)
426
426
  }
427
427
 
428
428
 
429
- /**
430
- * Apply fx on the images.
431
- *
432
- * Ruby usage:
433
- * - @verbatim ImageList#fx(expression) @endverbatim
434
- * - @verbatim ImageList#fx(expression, channel) @endverbatim
435
- * - @verbatim ImageList#fx(expression, channel, ...) @endverbatim
436
- *
437
- * Notes:
438
- * - Default channel is AllChannels
439
- *
440
- * @param argc number of input arguments
441
- * @param argv array of input arguments
442
- * @param self this object
443
- * @return a new image
444
- * @deprecated This method has been deprecated. Please use Image_fx.
445
- */
446
- VALUE
447
- ImageList_fx(int argc, VALUE *argv, VALUE self)
448
- {
449
- Image *images, *new_image;
450
- char *expression;
451
- ChannelType channels;
452
- ExceptionInfo *exception;
453
-
454
- rb_warning("ImageList#fx is deprecated; use Image#fx");
455
-
456
- channels = extract_channels(&argc, argv);
457
-
458
- // There must be exactly 1 remaining argument.
459
- if (argc == 0)
460
- {
461
- rb_raise(rb_eArgError, "wrong number of arguments (0 for 1 or more)");
462
- }
463
- else if (argc > 1)
464
- {
465
- raise_ChannelType_error(argv[argc-1]);
466
- }
467
-
468
- expression = StringValuePtr(argv[0]);
469
-
470
- images = images_from_imagelist(self);
471
- exception = AcquireExceptionInfo();
472
- new_image = FxImageChannel(images, channels, expression, exception);
473
- rm_split(images);
474
- rm_check_exception(exception, new_image, DestroyOnError);
475
- (void) DestroyExceptionInfo(exception);
476
-
477
- rm_ensure_result(new_image);
478
-
479
- return rm_image_new(new_image);
480
- }
481
-
482
-
483
- /**
484
- * Call MapImages.
485
- *
486
- * Ruby usage:
487
- * - @verbatim ImageList#map(reference) @endverbatim
488
- * - @verbatim ImageList#map(reference, dither) @endverbatim
489
- *
490
- * Notes:
491
- * - Default dither is false
492
- * - Sets \@scene to self.scene
493
- *
494
- * @param argc number of input arguments
495
- * @param argv array of input arguments
496
- * @param self this object
497
- * @return a new ImageList with mapped images.
498
- */
499
- VALUE
500
- ImageList_map(int argc, VALUE *argv, VALUE self)
501
- {
502
- Image *images, *new_images = NULL;
503
- Image *map;
504
- unsigned int dither = MagickFalse;
505
- VALUE scene, new_imagelist, t;
506
- ExceptionInfo *exception;
507
-
508
- QuantizeInfo quantize_info;
509
- rb_warning("ImageList#map is deprecated. Use ImageList#remap instead.");
510
-
511
- switch (argc)
512
- {
513
- case 2:
514
- dither = RTEST(argv[1]);
515
- case 1:
516
- t = rm_cur_image(argv[0]);
517
- map = rm_check_destroyed(t);
518
- break;
519
- default:
520
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
521
- break;
522
- }
523
-
524
-
525
- // Convert image array to image sequence, clone image sequence.
526
- images = images_from_imagelist(self);
527
-
528
- exception = AcquireExceptionInfo();
529
- new_images = CloneImageList(images, exception);
530
- rm_split(images);
531
- rm_check_exception(exception, new_images, DestroyOnError);
532
- (void) DestroyExceptionInfo(exception);
533
-
534
- rm_ensure_result(new_images);
535
-
536
- // Call ImageMagick
537
- GetQuantizeInfo(&quantize_info);
538
- quantize_info.dither = dither;
539
- (void) RemapImages(&quantize_info, new_images, map);
540
- rm_check_image_exception(new_images, DestroyOnError);
541
-
542
- // Set @scene in new ImageList object to same value as in self.
543
- new_imagelist = rm_imagelist_from_images(new_images);
544
- scene = rb_iv_get(self, "@scene");
545
- (void) imagelist_scene_eq(new_imagelist, scene);
546
-
547
- RB_GC_GUARD(scene);
548
- RB_GC_GUARD(new_imagelist);
549
- RB_GC_GUARD(t);
550
-
551
- return new_imagelist;
552
- }
553
-
554
-
555
429
  /**
556
430
  * Call MontageImages.
557
431
  *
@@ -41,22 +41,6 @@ static void call_trace_proc(Image *, const char *);
41
41
  static const char *BlackPointCompensationKey = "PROFILE:black-point-compensation";
42
42
 
43
43
 
44
- /**
45
- * Converts the opacity value to alpha and raises a warning.
46
- *
47
- * No Ruby usage (internal function)
48
- *
49
- * @opacity an opacity value
50
- */
51
- static Quantum
52
- get_alpha_from_opacity(VALUE opacity)
53
- {
54
- VALUE method = rb_id2str(rb_frame_this_func());
55
- rb_warning("Image#%"PRIsVALUE" requires a named argument for 'alpha' and now expects an alpha value instead of an opacity value.", method);
56
-
57
- return QuantumRange - APP2QUANTUM(opacity);
58
- }
59
-
60
44
  /**
61
45
  * Returns the alpha value from the hash.
62
46
  *
@@ -65,8 +49,13 @@ get_alpha_from_opacity(VALUE opacity)
65
49
  * @hash the hash
66
50
  */
67
51
  static Quantum
68
- get_alpha_from_hash(VALUE hash)
52
+ get_named_alpha_value(VALUE hash)
69
53
  {
54
+ if (TYPE(hash) != T_HASH)
55
+ {
56
+ rb_raise(rb_eArgError, "missing keyword: alpha");
57
+ }
58
+
70
59
  if (FIX2ULONG(rb_hash_size(hash)) != 1)
71
60
  {
72
61
  rb_raise(rb_eArgError, "wrong number of arguments");
@@ -81,25 +70,6 @@ get_alpha_from_hash(VALUE hash)
81
70
  return APP2QUANTUM(alpha);
82
71
  }
83
72
 
84
- /**
85
- * Checks if opacity_or_alpha is a named argument called alpha and returns the alpha value or
86
- * converts the unnamed opacity value to alpha.
87
- *
88
- * No Ruby usage (internal function)
89
- *
90
- * @opacity_or_alpha an opacity or a named alpha value
91
- */
92
- static Quantum
93
- get_named_alpha_value(VALUE opacity_or_alpha)
94
- {
95
- if (TYPE(opacity_or_alpha) != T_HASH)
96
- {
97
- return get_alpha_from_opacity(opacity_or_alpha);
98
- }
99
-
100
- return get_alpha_from_hash(opacity_or_alpha);
101
- }
102
-
103
73
 
104
74
  /**
105
75
  * Call Adaptive(Blur|Sharpen)Image.
@@ -672,30 +642,6 @@ Image_alpha_q(VALUE self)
672
642
  }
673
643
 
674
644
 
675
- /**
676
- * Equivalent to -alpha option.
677
- *
678
- * Ruby usage:
679
- * - @verbatim Image#alpha=(alpha) @endverbatim
680
- *
681
- * @param self this object
682
- * @param type the alpha type
683
- * @return alpha
684
- * @deprecated This method has been deprecated. Please use Image_alpha.
685
- * @see Image_alpha
686
- * @see mogrify.c (in ImageMagick)
687
- */
688
- VALUE
689
- Image_alpha_eq(VALUE self, VALUE type)
690
- {
691
- VALUE argv[1];
692
- argv[0] = type;
693
- rb_warning("Image#alpha= is deprecated; use Image#alpha.");
694
- Image_alpha(1, argv, self);
695
- return type;
696
- }
697
-
698
-
699
645
  /**
700
646
  * Transform an image as dictated by the affine matrix argument.
701
647
  *
@@ -1363,7 +1309,6 @@ get_relative_offsets(VALUE grav, Image *image, Image *mark, long *x_offset, long
1363
1309
  case NorthGravity:
1364
1310
  case SouthGravity:
1365
1311
  case CenterGravity:
1366
- case StaticGravity:
1367
1312
  *x_offset += (long)(image->columns/2) - (long)(mark->columns/2);
1368
1313
  break;
1369
1314
  default:
@@ -1379,7 +1324,6 @@ get_relative_offsets(VALUE grav, Image *image, Image *mark, long *x_offset, long
1379
1324
  case EastGravity:
1380
1325
  case WestGravity:
1381
1326
  case CenterGravity:
1382
- case StaticGravity:
1383
1327
  *y_offset += (long)(image->rows/2) - (long)(mark->rows/2);
1384
1328
  break;
1385
1329
  case NorthEastGravity:
@@ -1429,7 +1373,6 @@ get_offsets_from_gravity(GravityType gravity, Image *image, Image *mark
1429
1373
  *x_offset = 0;
1430
1374
  *y_offset = ((long)(image->rows) - (long)(mark->rows)) / 2;
1431
1375
  break;
1432
- case StaticGravity:
1433
1376
  case CenterGravity:
1434
1377
  default:
1435
1378
  *x_offset = ((long)(image->columns) - (long)(mark->columns)) / 2;
@@ -1756,53 +1699,6 @@ Image_blue_shift(int argc, VALUE *argv, VALUE self)
1756
1699
  }
1757
1700
 
1758
1701
 
1759
- /**
1760
- * Get the blur attribute.
1761
- *
1762
- * Ruby usage:
1763
- * - @verbatim Image#blur @endverbatim
1764
- *
1765
- * @param self this object
1766
- * @return the blur
1767
- * @deprecated This method has been deprecated.
1768
- */
1769
- VALUE
1770
- Image_blur(VALUE self)
1771
- {
1772
- Image *image;
1773
-
1774
- rb_warning("Image#blur is deprecated");
1775
- (void) rm_check_destroyed(self);
1776
- Data_Get_Struct(self, Image, image);
1777
- return C_dbl_to_R_dbl(image->blur);
1778
- }
1779
-
1780
-
1781
- /**
1782
- * Set the blur attribute.
1783
- *
1784
- * Ruby usage:
1785
- * - @verbatim Image#blur= @endverbatim
1786
- *
1787
- * @param self this object
1788
- * @param value the blur
1789
- * @return value
1790
- * @deprecated This method has been deprecated.
1791
- */
1792
- VALUE
1793
- Image_blur_eq(VALUE self, VALUE value)
1794
- {
1795
- Image *image;
1796
-
1797
- rb_warning("Image#blur= is deprecated");
1798
- (void) rm_check_destroyed(self);
1799
- rb_check_frozen(self);
1800
- Data_Get_Struct(self, Image, image);
1801
- image->blur = R_dbl_to_C_dbl(value);
1802
- return value;
1803
- }
1804
-
1805
-
1806
1702
  /**
1807
1703
  * Call BlurImageChannel.
1808
1704
  *
@@ -3127,88 +3023,6 @@ Image_colorspace_eq(VALUE self, VALUE colorspace)
3127
3023
  DEF_ATTR_READER(Image, columns, int)
3128
3024
 
3129
3025
 
3130
- /**
3131
- * Combine the Red channel of the first image with the Green channel of the
3132
- * 2nd image and the Blue channel of the 3rd image. Any of the image arguments
3133
- * may be omitted or replaced by nil.
3134
- *
3135
- * Ruby usage:
3136
- * - @verbatim new_image = Image.combine(red) @endverbatim
3137
- * - @verbatim new_image = Image.combine(red, green) @endverbatim
3138
- * - @verbatim new_image = Image.combine(red, green, blue) @endverbatim
3139
- * - @verbatim new_image = Image.combine(red, green, blue, opacity) @endverbatim
3140
- *
3141
- * Notes:
3142
- * - Calls CombineImages.
3143
- *
3144
- * @param argc number of input arguments
3145
- * @param argv array of input arguments
3146
- * @param self this object
3147
- * @return a new image
3148
- * @deprecated This method has been deprecated. Please use ImageList_combine.
3149
- */
3150
- VALUE Image_combine(int argc, VALUE *argv, VALUE self ATTRIBUTE_UNUSED)
3151
- {
3152
- ChannelType channel = 0;
3153
- Image *image, *images = NULL, *new_image;
3154
- ExceptionInfo *exception;
3155
-
3156
- rb_warning("Image#combine is deprecated; use ImageList#combine.");
3157
-
3158
- switch (argc)
3159
- {
3160
- case 4:
3161
- if (argv[3] != Qnil)
3162
- {
3163
- channel |= OpacityChannel;
3164
- image = rm_check_destroyed(argv[3]);
3165
- AppendImageToList(&images, image);
3166
- }
3167
- case 3:
3168
- if (argv[2] != Qnil)
3169
- {
3170
- channel |= BlueChannel;
3171
- image = rm_check_destroyed(argv[2]);
3172
- AppendImageToList(&images, image);
3173
- }
3174
- case 2:
3175
- if (argv[1] != Qnil)
3176
- {
3177
- channel |= GreenChannel;
3178
- image = rm_check_destroyed(argv[1]);
3179
- AppendImageToList(&images, image);
3180
- }
3181
- case 1:
3182
- if (argv[0] != Qnil)
3183
- {
3184
- channel |= RedChannel;
3185
- image = rm_check_destroyed(argv[0]);
3186
- AppendImageToList(&images, image);
3187
- }
3188
- break;
3189
- default:
3190
- rb_raise(rb_eArgError, "wrong number of arguments (1 to 4 expected, got %d)", argc);
3191
- }
3192
-
3193
- if (channel == 0)
3194
- {
3195
- rb_raise(rb_eArgError, "no images to combine");
3196
- }
3197
-
3198
- exception = AcquireExceptionInfo();
3199
- ReverseImageList(&images);
3200
- new_image = CombineImages(images, channel, exception);
3201
- rm_check_exception(exception, images, RetainOnError);
3202
- (void) DestroyExceptionInfo(exception);
3203
- rm_split(images);
3204
-
3205
- rm_ensure_result(new_image);
3206
-
3207
- return rm_image_new(new_image);
3208
-
3209
- }
3210
-
3211
-
3212
3026
  /**
3213
3027
  * Compare one or more channels in two images and returns the specified
3214
3028
  * distortion metric and a comparison image.
@@ -3393,7 +3207,6 @@ composite(int bang, int argc, VALUE *argv, VALUE self, ChannelType channels)
3393
3207
  x_offset = 0;
3394
3208
  y_offset = ((long)(image->rows) - (long)(comp_image->rows)) / 2;
3395
3209
  break;
3396
- case StaticGravity:
3397
3210
  case CenterGravity:
3398
3211
  default:
3399
3212
  x_offset = ((long)(image->columns) - (long)(comp_image->columns)) / 2;
@@ -3441,7 +3254,6 @@ composite(int bang, int argc, VALUE *argv, VALUE self, ChannelType channels)
3441
3254
  case NorthGravity:
3442
3255
  case SouthGravity:
3443
3256
  case CenterGravity:
3444
- case StaticGravity:
3445
3257
  x_offset += (long)(image->columns/2) - (long)(comp_image->columns/2);
3446
3258
  break;
3447
3259
  default:
@@ -3457,7 +3269,6 @@ composite(int bang, int argc, VALUE *argv, VALUE self, ChannelType channels)
3457
3269
  case EastGravity:
3458
3270
  case WestGravity:
3459
3271
  case CenterGravity:
3460
- case StaticGravity:
3461
3272
  y_offset += (long)(image->rows/2) - (long)(comp_image->rows/2);
3462
3273
  break;
3463
3274
  case NorthEastGravity:
@@ -5546,7 +5357,8 @@ VALUE
5546
5357
  Image_each_profile(VALUE self)
5547
5358
  {
5548
5359
  Image *image;
5549
- VALUE ary, val;
5360
+ VALUE ary;
5361
+ VALUE val = Qnil;
5550
5362
  char *name;
5551
5363
  const StringInfo *profile;
5552
5364
 
@@ -6268,9 +6080,6 @@ Image_export_pixels_to_str(int argc, VALUE *argv, VALUE self)
6268
6080
  case FloatPixel:
6269
6081
  sz = sizeof(float);
6270
6082
  break;
6271
- case IntegerPixel:
6272
- sz = sizeof(unsigned int);
6273
- break;
6274
6083
  case LongPixel:
6275
6084
  sz = sizeof(unsigned long);
6276
6085
  break;
@@ -7492,9 +7301,6 @@ Image_import_pixels(int argc, VALUE *argv, VALUE self)
7492
7301
  case ShortPixel:
7493
7302
  type_sz = sizeof(unsigned short);
7494
7303
  break;
7495
- case IntegerPixel:
7496
- type_sz = sizeof(unsigned int);
7497
- break;
7498
7304
  case LongPixel:
7499
7305
  type_sz = sizeof(unsigned long);
7500
7306
  break;
@@ -8384,63 +8190,6 @@ Image_magnify_bang(VALUE self)
8384
8190
  }
8385
8191
 
8386
8192
 
8387
- /**
8388
- * Call MapImage.
8389
- *
8390
- * Ruby usage:
8391
- * - @verbatim Image#map(map_image) @endverbatim
8392
- * - @verbatim Image#map(map_image, dither) @endverbatim
8393
- *
8394
- * Notes:
8395
- * - Default dither is false
8396
- *
8397
- * @param argc number of input arguments
8398
- * @param argv array of input arguments
8399
- * @param self this object
8400
- * @return a new image
8401
- */
8402
- VALUE
8403
- Image_map(int argc, VALUE *argv, VALUE self)
8404
- {
8405
- Image *image, *new_image;
8406
- Image *map;
8407
- VALUE map_obj, map_arg;
8408
- unsigned int dither = MagickFalse;
8409
-
8410
- QuantizeInfo quantize_info;
8411
- rb_warning("Image#map is deprecated. Use Image#remap instead");
8412
-
8413
- image = rm_check_destroyed(self);
8414
-
8415
- switch (argc)
8416
- {
8417
- case 2:
8418
- dither = RTEST(argv[1]);
8419
- case 1:
8420
- map_arg = argv[0];
8421
- break;
8422
- default:
8423
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
8424
- break;
8425
- }
8426
-
8427
- map_obj = rm_cur_image(map_arg);
8428
- map = rm_check_destroyed(map_obj);
8429
-
8430
- new_image = rm_clone_image(image);
8431
-
8432
- GetQuantizeInfo(&quantize_info);
8433
- quantize_info.dither=dither;
8434
- (void) RemapImage(&quantize_info, new_image, map);
8435
- rm_check_image_exception(new_image, DestroyOnError);
8436
-
8437
- RB_GC_GUARD(map_obj);
8438
- RB_GC_GUARD(map_arg);
8439
-
8440
- return rm_image_new(new_image);
8441
- }
8442
-
8443
-
8444
8193
  /**
8445
8194
  * Support Marshal.dump >= 1.8.
8446
8195
  *
@@ -8648,29 +8397,6 @@ set_image_mask(Image *image, VALUE mask)
8648
8397
  }
8649
8398
 
8650
8399
 
8651
- /**
8652
- * Set the image mask.
8653
- *
8654
- * Ruby usage:
8655
- * - @verbatim Image#mask= @endverbatim
8656
- *
8657
- * @param self this object
8658
- * @param mask the mask to use
8659
- * @return copy of the current clip-mask or nil
8660
- * @deprecated This method has been deprecated. Please use Image_mask(mask-image).
8661
- * @see Image_mask(mask-image)
8662
- * @see get_image_mask
8663
- */
8664
- VALUE
8665
- Image_mask_eq(VALUE self, VALUE mask)
8666
- {
8667
- VALUE v[1];
8668
- v[0] = mask;
8669
- rb_warning("Image#mask= is deprecated; use Image#mask.");
8670
- return Image_mask(1, v, self);
8671
- }
8672
-
8673
-
8674
8400
  /**
8675
8401
  * Associate a clip mask with the image.
8676
8402
  *
@@ -8715,62 +8441,6 @@ Image_mask(int argc, VALUE *argv, VALUE self)
8715
8441
  }
8716
8442
 
8717
8443
 
8718
- /**
8719
- * Get matte attribute.
8720
- *
8721
- * Ruby usage:
8722
- * - @verbatim Image#matte @endverbatim
8723
- *
8724
- * @param self this object
8725
- * @return the matte
8726
- * @deprecated This method has been deprecated. Please use Image_alpha.
8727
- * @see Image_alpha
8728
- * @see Image_alpha_eq
8729
- */
8730
- VALUE
8731
- Image_matte(VALUE self)
8732
- {
8733
- Image *image;
8734
-
8735
- image = rm_check_destroyed(self);
8736
- rb_warning("Image#matte is deprecated; use Image#alpha.");
8737
- return image->matte ? Qtrue : Qfalse;
8738
- }
8739
-
8740
-
8741
- /**
8742
- * Set matte attribute.
8743
- *
8744
- * Ruby usage:
8745
- * - @verbatim Image#matte= @endverbatim
8746
- *
8747
- * @param self this object
8748
- * @param matte the matte
8749
- * @return the matte
8750
- * @deprecated This method has been deprecated. Please use Image_alpha.
8751
- * @see Image_alpha_eq
8752
- * @see Image_alpha
8753
- */
8754
- VALUE
8755
- Image_matte_eq(VALUE self, VALUE matte)
8756
- {
8757
- VALUE alpha_channel_type;
8758
-
8759
- if (RTEST(matte))
8760
- {
8761
- alpha_channel_type = rb_const_get(Module_Magick, rb_intern("ActivateAlphaChannel"));
8762
- }
8763
- else
8764
- {
8765
- alpha_channel_type = rb_const_get(Module_Magick, rb_intern("DeactivateAlphaChannel"));
8766
- }
8767
-
8768
- rb_warning("Image#matte= is deprecated; use Image#alpha.");
8769
-
8770
- return Image_alpha_eq(self, alpha_channel_type);
8771
- }
8772
-
8773
-
8774
8444
  /**
8775
8445
  * Return the matte color.
8776
8446
  *
@@ -8831,7 +8501,6 @@ Image_matte_flood_fill(int argc, VALUE *argv, VALUE self)
8831
8501
  DrawInfo *draw_info;
8832
8502
  MagickPixel target_mpp;
8833
8503
  MagickBooleanType invert;
8834
- int start_index;
8835
8504
 
8836
8505
  image = rm_check_destroyed(self);
8837
8506
 
@@ -8840,26 +8509,17 @@ Image_matte_flood_fill(int argc, VALUE *argv, VALUE self)
8840
8509
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 5)", argc);
8841
8510
  }
8842
8511
 
8843
- if (TYPE(argv[4]) == T_HASH)
8844
- {
8845
- alpha = get_alpha_from_hash(argv[4]);
8846
- start_index = 1;
8847
- }
8848
- else
8849
- {
8850
- alpha = get_alpha_from_opacity(argv[1]);
8851
- start_index = 2;
8852
- }
8512
+ alpha = get_named_alpha_value(argv[4]);
8853
8513
 
8854
8514
  Color_to_PixelColor(&target, argv[0]);
8855
- VALUE_TO_ENUM(argv[start_index + 2], method, PaintMethod);
8515
+ VALUE_TO_ENUM(argv[3], method, PaintMethod);
8856
8516
  if (!(method == FloodfillMethod || method == FillToBorderMethod))
8857
8517
  {
8858
8518
  rb_raise(rb_eArgError, "paint method_obj must be FloodfillMethod or "
8859
8519
  "FillToBorderMethod (%d given)", method);
8860
8520
  }
8861
- x = NUM2LONG(argv[start_index]);
8862
- y = NUM2LONG(argv[start_index + 1]);
8521
+ x = NUM2LONG(argv[1]);
8522
+ y = NUM2LONG(argv[2]);
8863
8523
  if ((unsigned long)x > image->columns || (unsigned long)y > image->rows)
8864
8524
  {
8865
8525
  rb_raise(rb_eArgError, "target out of range. %ldx%ld given, image is %lux%lu"
@@ -9325,8 +8985,6 @@ Image_negate_channel(int argc, VALUE *argv, VALUE self)
9325
8985
  grayscale = RTEST(argv[0]);
9326
8986
  }
9327
8987
 
9328
- Data_Get_Struct(self, Image, image);
9329
-
9330
8988
  new_image = rm_clone_image(image);
9331
8989
 
9332
8990
  (void) NegateImageChannel(new_image, channels, grayscale);
@@ -9968,14 +9626,7 @@ Image_paint_transparent(int argc, VALUE *argv, VALUE self)
9968
9626
  invert = RTEST(argv[2]);
9969
9627
  }
9970
9628
  case 2:
9971
- if (TYPE(argv[argc - 1]) == T_HASH)
9972
- {
9973
- alpha = get_alpha_from_hash(argv[argc - 1]);
9974
- }
9975
- else
9976
- {
9977
- alpha = get_alpha_from_opacity(argv[1]);
9978
- }
9629
+ alpha = get_named_alpha_value(argv[argc - 1]);
9979
9630
  case 1:
9980
9631
  Color_to_MagickPixel(image, &color, argv[0]);
9981
9632
  break;
@@ -10531,6 +10182,9 @@ Image_quantum_operator(int argc, VALUE *argv, VALUE self)
10531
10182
  case CosineQuantumOperator:
10532
10183
  qop = CosineEvaluateOperator;
10533
10184
  break;
10185
+ case SetQuantumOperator:
10186
+ qop = SetEvaluateOperator;
10187
+ break;
10534
10188
  case SineQuantumOperator:
10535
10189
  qop = SineEvaluateOperator;
10536
10190
  break;
@@ -12095,33 +11749,6 @@ Image_segment(int argc, VALUE *argv, VALUE self)
12095
11749
  }
12096
11750
 
12097
11751
 
12098
- /**
12099
- * Call SetImageOpacity.
12100
- *
12101
- * Ruby usage:
12102
- * - @verbatim Image#opacity= @endverbatim
12103
- *
12104
- * @param self this object
12105
- * @param opacity_arg the opacity
12106
- * @return opacity_arg
12107
- * @deprecated This method has been deprecated. Please use Image_alpha.
12108
- */
12109
- VALUE
12110
- Image_opacity_eq(VALUE self, VALUE opacity_arg)
12111
- {
12112
- Image *image;
12113
- Quantum opacity;
12114
-
12115
- rb_warning("Image#opacity is deprecated; use Image#alpha");
12116
-
12117
- image = rm_check_frozen(self);
12118
- opacity = APP2QUANTUM(opacity_arg);
12119
- (void) SetImageOpacity(image, opacity);
12120
- rm_check_image_exception(image, RetainOnError);
12121
- return opacity_arg;
12122
- }
12123
-
12124
-
12125
11752
  /**
12126
11753
  * Traverse the attributes and yield to the block. If no block, return a hash
12127
11754
  * of all the attribute keys & values.
@@ -13245,30 +12872,6 @@ Image_swirl(VALUE self, VALUE degrees_obj)
13245
12872
  }
13246
12873
 
13247
12874
 
13248
- /**
13249
- * Synchronize image properties with the image profiles.
13250
- *
13251
- * Ruby usage:
13252
- * - @verbatim Image#sync_profiles @endverbatim
13253
- *
13254
- * @param self this object
13255
- * @return true if succeeded, otherwise false
13256
- * @deprecated This method has been deprecated.
13257
- */
13258
- VALUE
13259
- Image_sync_profiles(VALUE self)
13260
- {
13261
- rb_warning("Image#sync_profiles is deprecated");
13262
- Image *image = rm_check_destroyed(self);
13263
- VALUE okay = SyncImageProfiles(image) ? Qtrue : Qfalse;
13264
- rm_check_image_exception(image, RetainOnError);
13265
-
13266
- RB_GC_GUARD(okay);
13267
-
13268
- return okay;
13269
- }
13270
-
13271
-
13272
12875
  /**
13273
12876
  * Emulates Magick++'s floodFillTexture.
13274
12877
  *
@@ -13967,14 +13570,7 @@ Image_transparent_chroma(int argc, VALUE *argv, VALUE self)
13967
13570
  invert = RTEST(argv[2]);
13968
13571
  }
13969
13572
  case 3:
13970
- if (TYPE(argv[argc - 1]) == T_HASH)
13971
- {
13972
- alpha = get_alpha_from_hash(argv[argc - 1]);
13973
- }
13974
- else
13975
- {
13976
- alpha = get_alpha_from_opacity(argv[2]);
13977
- }
13573
+ alpha = get_named_alpha_value(argv[argc - 1]);
13978
13574
  case 2:
13979
13575
  Color_to_MagickPixel(image, &high, argv[1]);
13980
13576
  Color_to_MagickPixel(image, &low, argv[0]);
@@ -15230,7 +14826,6 @@ cropper(int bang, int argc, VALUE *argv, VALUE self)
15230
14826
  case NorthGravity:
15231
14827
  case SouthGravity:
15232
14828
  case CenterGravity:
15233
- case StaticGravity:
15234
14829
  nx += image->columns/2 - columns/2;
15235
14830
  break;
15236
14831
  default:
@@ -15246,7 +14841,6 @@ cropper(int bang, int argc, VALUE *argv, VALUE self)
15246
14841
  case EastGravity:
15247
14842
  case WestGravity:
15248
14843
  case CenterGravity:
15249
- case StaticGravity:
15250
14844
  ny += image->rows/2 - rows/2;
15251
14845
  break;
15252
14846
  case NorthEastGravity:
@@ -15312,7 +14906,6 @@ cropper(int bang, int argc, VALUE *argv, VALUE self)
15312
14906
  nx = image->columns - columns;
15313
14907
  ny = image->rows - rows;
15314
14908
  break;
15315
- case StaticGravity:
15316
14909
  case CenterGravity:
15317
14910
  nx = (image->columns - columns) / 2;
15318
14911
  ny = (image->rows - rows) / 2;