rmagick 2.6.0 → 2.7.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.

@@ -1,4 +1,4 @@
1
- /* $Id: rmilist.c,v 1.84 2008/09/10 22:08:55 rmagick Exp $ */
1
+ /* $Id: rmilist.c,v 1.87 2008/09/28 00:23:10 rmagick Exp $ */
2
2
  /*============================================================================\
3
3
  | Copyright (C) 2008 by Timothy P. Hunter
4
4
  | Name: rmilist.c
@@ -17,51 +17,6 @@ static VALUE ImageList_new(void);
17
17
 
18
18
 
19
19
 
20
- /*
21
- Method: ImageList#affinity(affinity_image=nil, dither_method=RiemersmaDitherMethod)
22
- Purpose: Call AffinityImages
23
- Note: See Image_affinity. Immediate - modifies images in-place
24
- */
25
- VALUE
26
- ImageList_affinity(int argc, VALUE *argv, VALUE self)
27
- {
28
- #if defined(HAVE_AFFINITYIMAGES)
29
- Image *images, *affinity_image = NULL;
30
- QuantizeInfo quantize_info;
31
-
32
- images = images_from_imagelist(self);
33
-
34
- if (argc > 0 && argv[0] != Qnil)
35
- {
36
- volatile VALUE t = rm_cur_image(argv[0]);
37
- affinity_image = rm_check_destroyed(t);
38
- }
39
-
40
- GetQuantizeInfo(&quantize_info);
41
-
42
- if (argc > 1)
43
- {
44
- VALUE_TO_ENUM(argv[1], quantize_info.dither_method, DitherMethod);
45
- quantize_info.dither = MagickTrue;
46
- }
47
- if (argc > 2)
48
- {
49
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
50
- }
51
-
52
- (void) AffinityImages(&quantize_info, images, affinity_image);
53
- rm_check_image_exception(images, RetainOnError);
54
- rm_split(images);
55
-
56
- return self;
57
- #else
58
- self = self;
59
- argc = argc;
60
- argv = argv;
61
- rm_not_implemented();
62
- return(VALUE)0;
63
- #endif
64
- }
65
20
 
66
21
 
67
22
  /*
@@ -396,8 +351,8 @@ ImageList_map(int argc, VALUE *argv, VALUE self)
396
351
  volatile VALUE scene, new_imagelist, t;
397
352
  ExceptionInfo exception;
398
353
 
399
- #if defined(HAVE_AFFINITYIMAGES)
400
- rb_warning("ImageList#map is deprecated. Use ImageList#affinity instead.");
354
+ #if defined(HAVE_REMAPIMAGES)
355
+ rb_warning("ImageList#map is deprecated. Use ImageList#remap instead.");
401
356
  #endif
402
357
 
403
358
  switch (argc)
@@ -663,6 +618,11 @@ ImageList_optimize_layers(VALUE self, VALUE method)
663
618
  case MergeLayer:
664
619
  new_images = MergeImageLayers(images, mthd, &exception);
665
620
  break;
621
+ #endif
622
+ #if defined(HAVE_ENUM_TRIMBOUNDSLAYER)
623
+ case TrimBoundsLayer:
624
+ new_images = MergeImageLayers(images, mthd, &exception);
625
+ break;
666
626
  #endif
667
627
  default:
668
628
  rb_raise(rb_eArgError, "undefined layer method");
@@ -841,7 +801,7 @@ ImageList_quantize(int argc, VALUE *argv, VALUE self)
841
801
  case 4:
842
802
  quantize_info.tree_depth = (unsigned long)NUM2INT(argv[3]);
843
803
  case 3:
844
- #if defined(HAVE_TYPE_DITHERMETHOD)
804
+ #if defined(HAVE_TYPE_DITHERMETHOD) && defined(HAVE_ENUM_NODITHERMETHOD)
845
805
  if (rb_obj_is_kind_of(argv[2], Class_DitherMethod))
846
806
  {
847
807
  VALUE_TO_ENUM(argv[2], quantize_info.dither_method, DitherMethod);
@@ -896,6 +856,57 @@ ImageList_quantize(int argc, VALUE *argv, VALUE self)
896
856
  }
897
857
 
898
858
 
859
+ /*
860
+ Method: ImageList#remap(remap_image=nil, dither_method=RiemersmaDitherMethod)
861
+ Purpose: Call RemapImages
862
+ Note: See Image_remap. Immediate - modifies images in-place
863
+ */
864
+ VALUE
865
+ ImageList_remap(int argc, VALUE *argv, VALUE self)
866
+ {
867
+ #if defined(HAVE_REMAPIMAGES) || defined(HAVE_AFFINITYIMAGES)
868
+ Image *images, *remap_image = NULL;
869
+ QuantizeInfo quantize_info;
870
+
871
+ images = images_from_imagelist(self);
872
+
873
+ if (argc > 0 && argv[0] != Qnil)
874
+ {
875
+ volatile VALUE t = rm_cur_image(argv[0]);
876
+ remap_image = rm_check_destroyed(t);
877
+ }
878
+
879
+ GetQuantizeInfo(&quantize_info);
880
+
881
+ if (argc > 1)
882
+ {
883
+ VALUE_TO_ENUM(argv[1], quantize_info.dither_method, DitherMethod);
884
+ quantize_info.dither = MagickTrue;
885
+ }
886
+ if (argc > 2)
887
+ {
888
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
889
+ }
890
+
891
+ #if defined(HAVE_REMAPIMAGES)
892
+ (void) RemapImages(&quantize_info, images, remap_image);
893
+ #else
894
+ (void) AffinityImages(&quantize_info, images, remap_image);
895
+ #endif
896
+ rm_check_image_exception(images, RetainOnError);
897
+ rm_split(images);
898
+
899
+ return self;
900
+ #else
901
+ self = self;
902
+ argc = argc;
903
+ argv = argv;
904
+ rm_not_implemented();
905
+ return(VALUE)0;
906
+ #endif
907
+ }
908
+
909
+
899
910
  /*
900
911
  Method: ImageList#to_blob
901
912
  Purpose: returns the imagelist as a blob (a String)
@@ -1,4 +1,4 @@
1
- /* $Id: rmimage.c,v 1.319 2008/09/10 22:16:58 rmagick Exp $ */
1
+ /* $Id: rmimage.c,v 1.322 2008/09/28 00:23:10 rmagick Exp $ */
2
2
  /*============================================================================\
3
3
  | Copyright (C) 2008 by Timothy P. Hunter
4
4
  | Name: rmimage.c
@@ -569,56 +569,6 @@ Image_alpha_eq(VALUE self, VALUE type)
569
569
  }
570
570
 
571
571
 
572
-
573
- /*
574
- Method: Image#affinity(affinity_image, dither_method=RiemersmaDitherMethod)
575
- Purpose: Call AffinityImage
576
- Notes: Immediate - modifies image in-place
577
- */
578
- VALUE
579
- Image_affinity(int argc, VALUE *argv, VALUE self)
580
- {
581
- #if defined(HAVE_AFFINITYIMAGE)
582
- Image *image, *affinity_image;
583
- QuantizeInfo quantize_info;
584
-
585
- image = rm_check_frozen(self);
586
- if (argc > 0)
587
- {
588
- volatile VALUE t = rm_cur_image(argv[0]);
589
- affinity_image = rm_check_destroyed(t);
590
- }
591
-
592
- GetQuantizeInfo(&quantize_info);
593
-
594
- switch (argc)
595
- {
596
- case 2:
597
- VALUE_TO_ENUM(argv[1], quantize_info.dither_method, DitherMethod);
598
- quantize_info.dither = MagickTrue;
599
- break;
600
- case 1:
601
- break;
602
- default:
603
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
604
- break;
605
- }
606
-
607
-
608
- (void) AffinityImage(&quantize_info, image, affinity_image);
609
- rm_check_image_exception(image, RetainOnError);
610
-
611
- return self;
612
- #else
613
- self = self;
614
- argc = argc;
615
- argv = argv;
616
- rm_not_implemented();
617
- return(VALUE)0;
618
- #endif
619
- }
620
-
621
-
622
572
  /*
623
573
  Method: Image#affine_transform(affine_matrix)
624
574
  Purpose: transforms an image as dictated by the affine matrix argument
@@ -6251,8 +6201,8 @@ Image_map(int argc, VALUE *argv, VALUE self)
6251
6201
 
6252
6202
  image = rm_check_destroyed(self);
6253
6203
 
6254
- #if defined(HAVE_AFFINITYIMAGE)
6255
- rb_warning("Image#map is deprecated. Use Image#affinity instead");
6204
+ #if defined(HAVE_REMAPIMAGE)
6205
+ rb_warning("Image#map is deprecated. Use Image#remap instead");
6256
6206
  #endif
6257
6207
 
6258
6208
  switch (argc)
@@ -7827,7 +7777,7 @@ Image_quantize(int argc, VALUE *argv, VALUE self)
7827
7777
  case 4:
7828
7778
  quantize_info.tree_depth = NUM2UINT(argv[3]);
7829
7779
  case 3:
7830
- #if defined(HAVE_TYPE_DITHERMETHOD)
7780
+ #if defined(HAVE_TYPE_DITHERMETHOD) && defined(HAVE_ENUM_NODITHERMETHOD)
7831
7781
  if (rb_obj_is_kind_of(argv[2], Class_DitherMethod))
7832
7782
  {
7833
7783
  VALUE_TO_ENUM(argv[2], quantize_info.dither_method, DitherMethod);
@@ -8246,6 +8196,58 @@ Image_reduce_noise(VALUE self, VALUE radius)
8246
8196
  }
8247
8197
 
8248
8198
 
8199
+ /*
8200
+ Method: Image#remap(remap_image, dither_method=RiemersmaDitherMethod)
8201
+ Purpose: Call RemapImage
8202
+ Notes: Immediate - modifies image in-place
8203
+ */
8204
+ VALUE
8205
+ Image_remap(int argc, VALUE *argv, VALUE self)
8206
+ {
8207
+ #if defined(HAVE_REMAPIMAGE) || defined(HAVE_AFFINITYIMAGE)
8208
+ Image *image, *remap_image;
8209
+ QuantizeInfo quantize_info;
8210
+
8211
+ image = rm_check_frozen(self);
8212
+ if (argc > 0)
8213
+ {
8214
+ volatile VALUE t = rm_cur_image(argv[0]);
8215
+ remap_image = rm_check_destroyed(t);
8216
+ }
8217
+
8218
+ GetQuantizeInfo(&quantize_info);
8219
+
8220
+ switch (argc)
8221
+ {
8222
+ case 2:
8223
+ VALUE_TO_ENUM(argv[1], quantize_info.dither_method, DitherMethod);
8224
+ quantize_info.dither = MagickTrue;
8225
+ break;
8226
+ case 1:
8227
+ break;
8228
+ default:
8229
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 2)", argc);
8230
+ break;
8231
+ }
8232
+
8233
+ #if defined(HAVE_REMAPIMAGE)
8234
+ (void) RemapImage(&quantize_info, image, remap_image);
8235
+ #else
8236
+ (void) AffinityImage(&quantize_info, image, remap_image);
8237
+ #endif
8238
+ rm_check_image_exception(image, RetainOnError);
8239
+
8240
+ return self;
8241
+ #else
8242
+ self = self;
8243
+ argc = argc;
8244
+ argv = argv;
8245
+ rm_not_implemented();
8246
+ return(VALUE)0;
8247
+ #endif
8248
+ }
8249
+
8250
+
8249
8251
  /*
8250
8252
  Method: Image#rendering_intent=
8251
8253
  Purpose: get rendering_intent
@@ -10851,7 +10853,7 @@ void add_format_prefix(Info *info, VALUE file)
10851
10853
  char magic[MaxTextExtent];
10852
10854
  size_t magic_l;
10853
10855
  size_t prefix_l;
10854
- void *p;
10856
+ char *p;
10855
10857
 
10856
10858
  // Convert arg to string. If an exception occurs raise an error condition.
10857
10859
  file = rb_rescue(rb_String, file, file_arg_rescue, file);
@@ -10872,7 +10874,7 @@ void add_format_prefix(Info *info, VALUE file)
10872
10874
  if (p)
10873
10875
  {
10874
10876
  memset(magic, '\0', sizeof(magic));
10875
- magic_l = p - (void *)filename;
10877
+ magic_l = p - filename;
10876
10878
  memcpy(magic, filename, magic_l);
10877
10879
 
10878
10880
  GetExceptionInfo(&exception);
@@ -1,4 +1,4 @@
1
- /* $Id: rmmain.c,v 1.266 2008/08/31 20:00:39 rmagick Exp $ */
1
+ /* $Id: rmmain.c,v 1.271 2008/09/28 00:23:10 rmagick Exp $ */
2
2
  /*============================================================================\
3
3
  | Copyright (C) 2008 by Timothy P. Hunter
4
4
  | Name: rmmain.c
@@ -481,7 +481,7 @@ Init_RMagick2(void)
481
481
  rb_define_method(Class_Image, "add_noise_channel", Image_add_noise_channel, -1);
482
482
  rb_define_method(Class_Image, "add_profile", Image_add_profile, 1);
483
483
  rb_define_method(Class_Image, "affine_transform", Image_affine_transform, 1);
484
- rb_define_method(Class_Image, "affinity", Image_affinity, -1);
484
+ rb_define_method(Class_Image, "remap", Image_remap, -1);
485
485
  rb_define_method(Class_Image, "alpha", Image_alpha, -1);
486
486
  rb_define_method(Class_Image, "alpha?", Image_alpha_q, 0);
487
487
  rb_define_method(Class_Image, "[]", Image_aref, 1);
@@ -688,7 +688,7 @@ Init_RMagick2(void)
688
688
 
689
689
  // Define an alias for Object#display before we override it
690
690
  rb_define_alias(Class_ImageList, "__display__", "display");
691
- rb_define_method(Class_ImageList, "affinity", ImageList_affinity, -1);
691
+ rb_define_method(Class_ImageList, "remap", ImageList_remap, -1);
692
692
  rb_define_method(Class_ImageList, "animate", ImageList_animate, -1);
693
693
  rb_define_method(Class_ImageList, "append", ImageList_append, 1);
694
694
  rb_define_method(Class_ImageList, "average", ImageList_average, 0);
@@ -1032,8 +1032,15 @@ Init_RMagick2(void)
1032
1032
  ENUMERATOR(UndefinedAlphaChannel)
1033
1033
  ENUMERATOR(ActivateAlphaChannel)
1034
1034
  ENUMERATOR(DeactivateAlphaChannel)
1035
- ENUMERATOR(ResetAlphaChannel)
1035
+ ENUMERATOR(ResetAlphaChannel) /* deprecated */
1036
1036
  ENUMERATOR(SetAlphaChannel)
1037
+ #if defined(HAVE_ENUM_COPYALPHACHANNEL)
1038
+ ENUMERATOR(CopyAlphaChannel)
1039
+ ENUMERATOR(ExtractAlphaChannel)
1040
+ ENUMERATOR(OpaqueAlphaChannel)
1041
+ ENUMERATOR(ShapeAlphaChannel)
1042
+ ENUMERATOR(TransparentAlphaChannel)
1043
+ #endif
1037
1044
  END_ENUM
1038
1045
  #endif
1039
1046
 
@@ -1276,6 +1283,9 @@ Init_RMagick2(void)
1276
1283
  ENUMERATOR(ScaleRotateTranslateDistortion)
1277
1284
  #if defined(HAVE_ENUM_SHEPARDSDISTORTION)
1278
1285
  ENUMERATOR(ShepardsDistortion)
1286
+ #endif
1287
+ #if defined(HAVE_ENUM_BARRELINVERSEDISTORTION)
1288
+ ENUMERATOR(BarrelInverseDistortion)
1279
1289
  #endif
1280
1290
  END_ENUM
1281
1291
  #endif
@@ -1283,7 +1293,9 @@ Init_RMagick2(void)
1283
1293
  #if defined(HAVE_TYPE_DITHERMETHOD)
1284
1294
  DEF_ENUM(DitherMethod)
1285
1295
  ENUMERATOR(UndefinedDitherMethod)
1296
+ #if defined(HAVE_ENUM_NODITHERMETHOD)
1286
1297
  ENUMERATOR(NoDitherMethod)
1298
+ #endif
1287
1299
  ENUMERATOR(RiemersmaDitherMethod)
1288
1300
  ENUMERATOR(FloydSteinbergDitherMethod)
1289
1301
  END_ENUM
@@ -1433,6 +1445,9 @@ Init_RMagick2(void)
1433
1445
  #endif
1434
1446
  #if defined(HAVE_ENUM_FLATTENLAYER)
1435
1447
  ENUMERATOR(FlattenLayer)
1448
+ #endif
1449
+ #if defined(HAVE_ENUM_TRIMBOUNDSLAYER)
1450
+ ENUMERATOR(TrimBoundsLayer)
1436
1451
  #endif
1437
1452
  END_ENUM
1438
1453
 
@@ -1768,7 +1783,7 @@ version_constants(void)
1768
1783
  rb_define_const(Module_Magick, "Version", str);
1769
1784
 
1770
1785
  sprintf(long_version,
1771
- "This is %s ($Date: 2008/08/31 20:00:39 $) Copyright (C) 2008 by Timothy P. Hunter\n"
1786
+ "This is %s ($Date: 2008/09/28 00:23:10 $) Copyright (C) 2008 by Timothy P. Hunter\n"
1772
1787
  "Built with %s\n"
1773
1788
  "Built for %s\n"
1774
1789
  "Web page: http://rmagick.rubyforge.org\n"
@@ -1,4 +1,4 @@
1
- /* $Id: rmutil.c,v 1.162 2008/09/03 00:00:35 rmagick Exp $ */
1
+ /* $Id: rmutil.c,v 1.163 2008/09/25 23:25:36 rmagick Exp $ */
2
2
  /*============================================================================\
3
3
  | Copyright (C) 2008 by Timothy P. Hunter
4
4
  | Name: rmutil.c
@@ -1957,7 +1957,9 @@ LAYERMETHODTYPE_NAME(LAYERMETHODTYPE method)
1957
1957
  #if defined(HAVE_ENUM_FLATTENLAYER)
1958
1958
  ENUM_TO_NAME(FlattenLayer)
1959
1959
  #endif
1960
-
1960
+ #if defined(HAVE_ENUM_TRIMBOUNDSLAYER)
1961
+ ENUM_TO_NAME(TrimBoundsLayer)
1962
+ #endif
1961
1963
  }
1962
1964
 
1963
1965
  return "UndefinedLayer";
@@ -1,4 +1,4 @@
1
- # $Id: RMagick.rb,v 1.74 2008/08/28 23:25:46 rmagick Exp $
1
+ # $Id: RMagick.rb,v 1.75 2008/09/28 00:24:41 rmagick Exp $
2
2
  #==============================================================================
3
3
  # Copyright (C) 2008 by Timothy P. Hunter
4
4
  # Name: RMagick.rb
@@ -734,6 +734,8 @@ end # module Magick::IPTC
734
734
  class Image
735
735
  include Comparable
736
736
 
737
+ alias_method :affinity, :remap
738
+
737
739
  # Provide an alternate version of Draw#annotate, for folks who
738
740
  # want to find it in this class.
739
741
  def annotate(draw, width, height, x, y, text, &block)
@@ -1467,6 +1469,9 @@ public
1467
1469
  alias_method :map!, :collect!
1468
1470
  alias_method :__map__!, :collect!
1469
1471
 
1472
+ # ImageMagic used affinity in 6.4.3, switch to remap in 6.4.4.
1473
+ alias_method :affinity, :remap
1474
+
1470
1475
  def compact
1471
1476
  current = get_current()
1472
1477
  ilist = self.class.new
@@ -1,7 +1,7 @@
1
1
  require 'date'
2
2
  Gem::Specification.new do |s|
3
3
  s.name = %q{rmagick}
4
- s.version = "2.6.0"
4
+ s.version = "2.7.0"
5
5
  s.date = Date.today.to_s
6
6
  s.summary = %q{Ruby binding to ImageMagick}
7
7
  s.description = %q{RMagick is an interface between Ruby and ImageMagick.}
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: 2.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Hunter
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-10 00:00:00 -04:00
12
+ date: 2008-09-28 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -145,7 +145,6 @@ files:
145
145
  - doc/ex/text01.rb
146
146
  - doc/ex/composite_layers.rb
147
147
  - doc/ex/level_colors.rb
148
- - doc/ex/affinity_images.rb
149
148
  - doc/ex/polyline.rb
150
149
  - doc/ex/get_pixels.rb
151
150
  - doc/ex/equalize.rb
@@ -182,10 +181,11 @@ files:
182
181
  - doc/ex/wave.rb
183
182
  - doc/ex/shave.rb
184
183
  - doc/ex/composite_tiled.rb
185
- - doc/ex/affinity.rb
186
184
  - doc/ex/pattern2.rb
185
+ - doc/ex/remap_images.rb
187
186
  - doc/ex/bounding_box.rb
188
187
  - doc/ex/rvg_clippath.rb
188
+ - doc/ex/remap.rb
189
189
  - doc/ex/median_filter.rb
190
190
  - doc/ex/arcs01.rb
191
191
  - doc/ex/stroke_dasharray.rb