rmagick 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.appveyor.yml +32 -6
  3. data/.circleci/config.yml +1 -1
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +9 -9
  6. data/.rubocop_todo.yml +351 -17
  7. data/.travis.yml +14 -1
  8. data/CHANGELOG.md +55 -0
  9. data/CONTRIBUTING.md +11 -18
  10. data/README.textile +2 -2
  11. data/Rakefile +1 -1
  12. data/before_install_linux.sh +56 -19
  13. data/doc/ex/sparse_color.rb +5 -0
  14. data/doc/magick.html +9 -4
  15. data/doc/rvg.html +2 -2
  16. data/doc/rvgtut.html +1 -1
  17. data/examples/histogram.rb +1 -1
  18. data/ext/RMagick/extconf.rb +90 -264
  19. data/ext/RMagick/rmagick.c +28 -6
  20. data/ext/RMagick/rmagick.h +53 -199
  21. data/ext/RMagick/rmdraw.c +52 -70
  22. data/ext/RMagick/rmenum.c +332 -274
  23. data/ext/RMagick/rmfill.c +62 -112
  24. data/ext/RMagick/rmilist.c +27 -62
  25. data/ext/RMagick/rmimage.c +424 -634
  26. data/ext/RMagick/rminfo.c +46 -37
  27. data/ext/RMagick/rmkinfo.c +47 -42
  28. data/ext/RMagick/rmmain.c +125 -180
  29. data/ext/RMagick/rmmontage.c +5 -5
  30. data/ext/RMagick/rmpixel.c +133 -62
  31. data/ext/RMagick/rmstruct.c +14 -181
  32. data/ext/RMagick/rmutil.c +195 -111
  33. data/lib/rmagick/version.rb +2 -3
  34. data/lib/rvg/deep_equal.rb +1 -1
  35. data/lib/rvg/misc.rb +4 -4
  36. data/lib/rvg/units.rb +2 -2
  37. data/rmagick.gemspec +2 -2
  38. data/spec/rmagick/ImageList1_spec.rb +2 -2
  39. data/spec/rmagick/draw_spec.rb +4 -4
  40. data/spec/rmagick/image/composite_spec.rb +6 -1
  41. data/spec/rmagick/image/properties_spec.rb +8 -8
  42. data/test/Draw.rb +414 -0
  43. data/test/Enum.rb +76 -0
  44. data/test/Fill.rb +93 -0
  45. data/test/Image1.rb +9 -1
  46. data/test/Image2.rb +14 -4
  47. data/test/Image3.rb +73 -3
  48. data/test/ImageList1.rb +22 -9
  49. data/test/ImageList2.rb +41 -9
  50. data/test/Image_attributes.rb +45 -8
  51. data/test/Info.rb +102 -6
  52. data/test/Magick.rb +8 -1
  53. data/test/PolaroidOptions.rb +23 -0
  54. data/test/test_all_basic.rb +4 -0
  55. metadata +28 -8
  56. data/.hound.yml +0 -2
  57. data/wercker.yml +0 -10
@@ -107,7 +107,7 @@ Montage_background_color_eq(VALUE self, VALUE color)
107
107
  Montage *montage;
108
108
 
109
109
  Data_Get_Struct(self, Montage, montage);
110
- Color_to_PixelPacket(&montage->info->background_color, color);
110
+ Color_to_PixelColor(&montage->info->background_color, color);
111
111
  return self;
112
112
  }
113
113
 
@@ -128,7 +128,7 @@ Montage_border_color_eq(VALUE self, VALUE color)
128
128
  Montage *montage;
129
129
 
130
130
  Data_Get_Struct(self, Montage, montage);
131
- Color_to_PixelPacket(&montage->info->border_color, color);
131
+ Color_to_PixelColor(&montage->info->border_color, color);
132
132
  return self;
133
133
  }
134
134
 
@@ -212,7 +212,7 @@ Montage_fill_eq(VALUE self, VALUE color)
212
212
  Montage *montage;
213
213
 
214
214
  Data_Get_Struct(self, Montage, montage);
215
- Color_to_PixelPacket(&montage->info->fill, color);
215
+ Color_to_PixelColor(&montage->info->fill, color);
216
216
  return self;
217
217
  }
218
218
 
@@ -350,7 +350,7 @@ Montage_matte_color_eq(VALUE self, VALUE color)
350
350
  Montage *montage;
351
351
 
352
352
  Data_Get_Struct(self, Montage, montage);
353
- Color_to_PixelPacket(&montage->info->matte_color, color);
353
+ Color_to_PixelColor(&montage->info->matte_color, color);
354
354
  return self;
355
355
  }
356
356
 
@@ -413,7 +413,7 @@ Montage_stroke_eq(VALUE self, VALUE color)
413
413
  Montage *montage;
414
414
 
415
415
  Data_Get_Struct(self, Montage, montage);
416
- Color_to_PixelPacket(&montage->info->stroke, color);
416
+ Color_to_PixelColor(&montage->info->stroke, color);
417
417
  return self;
418
418
  }
419
419
 
@@ -13,11 +13,54 @@
13
13
  #include "rmagick.h"
14
14
 
15
15
 
16
+ /*
17
+ * Declare Pixel channel attribute writers
18
+ */
19
+ //! Pixel channel attribute writer.
20
+ #define DEF_PIXEL_CHANNEL_WRITER(_channel_) \
21
+ extern VALUE \
22
+ Pixel_##_channel_##_eq(VALUE self, VALUE v) \
23
+ { \
24
+ Pixel *pixel; \
25
+ \
26
+ rb_check_frozen(self); \
27
+ Data_Get_Struct(self, Pixel, pixel); \
28
+ pixel->_channel_ = APP2QUANTUM(v); \
29
+ (void) rb_funcall(self, rm_ID_changed, 0); \
30
+ (void) rb_funcall(self, rm_ID_notify_observers, 1, self); \
31
+ return QUANTUM2NUM((pixel->_channel_)); \
32
+ }
16
33
 
17
34
 
18
- static void Color_Name_to_PixelPacket(PixelPacket *, VALUE);
35
+ /*
36
+ * Declare Pixel CMYK channel attribute accessors
37
+ */
38
+ //! Pixel CMYK channel attribute accessor.
39
+ #define DEF_PIXEL_CMYK_CHANNEL_ACCESSOR(_cmyk_channel_, _rgb_channel_) \
40
+ extern VALUE \
41
+ Pixel_##_cmyk_channel_##_eq(VALUE self, VALUE v) \
42
+ { \
43
+ Pixel *pixel; \
44
+ \
45
+ rb_check_frozen(self); \
46
+ Data_Get_Struct(self, Pixel, pixel); \
47
+ pixel->_rgb_channel_ = APP2QUANTUM(v); \
48
+ (void) rb_funcall(self, rm_ID_changed, 0); \
49
+ (void) rb_funcall(self, rm_ID_notify_observers, 1, self); \
50
+ return QUANTUM2NUM(pixel->_rgb_channel_); \
51
+ } \
52
+ \
53
+ extern VALUE \
54
+ Pixel_##_cmyk_channel_(VALUE self) \
55
+ { \
56
+ Pixel *pixel; \
57
+ \
58
+ Data_Get_Struct(self, Pixel, pixel); \
59
+ return INT2NUM(pixel->_rgb_channel_); \
60
+ }
19
61
 
20
62
 
63
+ static void Color_Name_to_PixelColor(PixelColor *, VALUE);
21
64
 
22
65
 
23
66
  /**
@@ -176,44 +219,48 @@ color_arg_rescue(VALUE arg)
176
219
 
177
220
 
178
221
  /**
179
- * Convert either a String color name or a Magick::Pixel to a PixelPacket.
222
+ * Convert either a String color name or a Magick::Pixel to a PixelColor.
180
223
  *
181
224
  * No Ruby usage (internal function)
182
225
  *
183
- * @param pp the PixelPacket to modify
226
+ * @param pp the PixelColor to modify
184
227
  * @param color the color name or Magick::Pixel
185
228
  */
186
229
  void
187
- Color_to_PixelPacket(PixelPacket *pp, VALUE color)
230
+ Color_to_PixelColor(PixelColor *pp, VALUE color)
188
231
  {
189
232
  Pixel *pixel;
190
233
 
191
234
  // Allow color name or Pixel
192
235
  if (CLASS_OF(color) == Class_Pixel)
193
236
  {
237
+ memset(pp, 0, sizeof(*pp));
194
238
  Data_Get_Struct(color, Pixel, pixel);
195
- *pp = *pixel;
239
+ pp->red = pixel->red;
240
+ pp->green = pixel->green;
241
+ pp->blue = pixel->blue;
242
+ pp->opacity = pixel->opacity;
196
243
  }
197
244
  else
198
245
  {
199
246
  // require 'to_str' here instead of just 'to_s'.
200
247
  color = rb_rescue(rb_str_to_str, color, color_arg_rescue, color);
201
- Color_Name_to_PixelPacket(pp, color);
248
+ Color_Name_to_PixelColor(pp, color);
202
249
  }
203
250
  }
204
251
 
205
252
 
206
253
  /**
207
- * Convert a color name to a PixelPacket
254
+ * Convert a color name to a PixelColor
208
255
  *
209
256
  * No Ruby usage (internal function)
210
257
  *
211
- * @param color the PixelPacket to modify
258
+ * @param color the PixelColor to modify
212
259
  * @param name_arg the coor name
213
260
  * @throw ArgumentError
214
261
  */
215
262
  static void
216
- Color_Name_to_PixelPacket(PixelPacket *color, VALUE name_arg)
263
+ Color_Name_to_PixelColor(PixelColor *color, VALUE name_arg)
217
264
  {
218
265
  MagickBooleanType okay;
219
266
  char *name;
@@ -221,7 +268,7 @@ Color_Name_to_PixelPacket(PixelPacket *color, VALUE name_arg)
221
268
 
222
269
  exception = AcquireExceptionInfo();
223
270
  name = StringValuePtr(name_arg);
224
- okay = QueryColorDatabase(name, color, exception);
271
+ okay = QueryColorCompliance(name, AllCompliance, color, exception);
225
272
  (void) DestroyExceptionInfo(exception);
226
273
  if (!okay)
227
274
  {
@@ -408,7 +455,7 @@ Pixel_fcmp(int argc, VALUE *argv, VALUE self)
408
455
  rb_raise(rb_eNoMemError, "not enough memory to continue");
409
456
  }
410
457
 
411
- image = AcquireImage(info);
458
+ image = rm_acquire_image(info);
412
459
 
413
460
  // Delete Info now in case we have to raise an exception
414
461
  (void) DestroyImageInfo(info);
@@ -448,14 +495,14 @@ Pixel_fcmp(int argc, VALUE *argv, VALUE self)
448
495
  VALUE
449
496
  Pixel_from_color(VALUE class, VALUE name)
450
497
  {
451
- PixelPacket pp;
498
+ PixelColor pp;
452
499
  ExceptionInfo *exception;
453
500
  MagickBooleanType okay;
454
501
 
455
502
  class = class; // defeat "never referenced" message from icc
456
503
 
457
504
  exception = AcquireExceptionInfo();
458
- okay = QueryColorDatabase(StringValuePtr(name), &pp, exception);
505
+ okay = QueryColorCompliance(StringValuePtr(name), AllCompliance, &pp, exception);
459
506
  CHECK_EXCEPTION()
460
507
  (void) DestroyExceptionInfo(exception);
461
508
 
@@ -464,7 +511,7 @@ Pixel_from_color(VALUE class, VALUE name)
464
511
  rb_raise(rb_eArgError, "invalid color name: %s", StringValuePtr(name));
465
512
  }
466
513
 
467
- return Pixel_from_PixelPacket(&pp);
514
+ return Pixel_from_PixelColor(&pp);
468
515
  }
469
516
 
470
517
 
@@ -492,7 +539,7 @@ VALUE
492
539
  Pixel_from_hsla(int argc, VALUE *argv, VALUE class)
493
540
  {
494
541
  double h, s, l, a = 1.0;
495
- MagickPixelPacket pp;
542
+ MagickPixel pp;
496
543
  ExceptionInfo *exception;
497
544
  char name[50];
498
545
  MagickBooleanType alpha = MagickFalse;
@@ -533,15 +580,6 @@ Pixel_from_hsla(int argc, VALUE *argv, VALUE class)
533
580
  rb_raise(rb_eRangeError, "hue %g out of range [0.0, 360.0)", h);
534
581
  }
535
582
 
536
- // Ugly way of checking for change in ImageMagick 6.5.6-5 to see whether
537
- // saturation/lightness should be out of 255 or out of 100.
538
- if(MagickLibVersion < 0x656 ||
539
- (MagickLibVersion == 0x656 && strcmp(MagickLibSubversion,"-5") <= 0) )
540
- {
541
- s = s/2.55;
542
- l = l/2.55;
543
- }
544
-
545
583
  memset(name, 0, sizeof(name));
546
584
  if (alpha)
547
585
  {
@@ -559,7 +597,7 @@ Pixel_from_hsla(int argc, VALUE *argv, VALUE class)
559
597
 
560
598
  (void) DestroyExceptionInfo(exception);
561
599
 
562
- return Pixel_from_MagickPixelPacket(&pp);
600
+ return Pixel_from_MagickPixel(&pp);
563
601
  }
564
602
 
565
603
 
@@ -577,7 +615,7 @@ Pixel_from_hsla(int argc, VALUE *argv, VALUE class)
577
615
  VALUE
578
616
  Pixel_from_HSL(VALUE class, VALUE hsl)
579
617
  {
580
- PixelPacket rgb;
618
+ PixelColor rgb;
581
619
  double hue, saturation, luminosity;
582
620
 
583
621
  class = class; // defeat "never referenced" message from icc
@@ -596,23 +634,23 @@ Pixel_from_HSL(VALUE class, VALUE hsl)
596
634
  rb_warning("Pixel#from_HSL is deprecated; use from_hsla");
597
635
  ConvertHSLToRGB(hue, saturation, luminosity,
598
636
  &rgb.red, &rgb.green, &rgb.blue);
599
- return Pixel_from_PixelPacket(&rgb);
637
+ return Pixel_from_PixelColor(&rgb);
600
638
  }
601
639
 
602
640
 
603
641
  /**
604
- * Create a Magick::Pixel object from a MagickPixelPacket structure.
642
+ * Create a Magick::Pixel object from a MagickPixel structure.
605
643
  *
606
644
  * No Ruby usage (internal function)
607
645
  *
608
646
  * Notes:
609
647
  * - Bypasses normal Pixel.new, Pixel#initialize methods
610
648
  *
611
- * @param pp the MagickPixelPacket
649
+ * @param pp the MagickPixel
612
650
  * @return a new Magick::Pixel object
613
651
  */
614
652
  VALUE
615
- Pixel_from_MagickPixelPacket(const MagickPixelPacket *pp)
653
+ Pixel_from_MagickPixel(const MagickPixel *pp)
616
654
  {
617
655
  Pixel *pixel;
618
656
 
@@ -642,8 +680,38 @@ Pixel_from_PixelPacket(const PixelPacket *pp)
642
680
  {
643
681
  Pixel *pixel;
644
682
 
645
- pixel = ALLOC(Pixel);
646
- *pixel = *pp;
683
+ pixel = ALLOC(Pixel);
684
+ pixel->red = pp->red;
685
+ pixel->green = pp->green;
686
+ pixel->blue = pp->blue;
687
+ pixel->opacity = pp->opacity;
688
+
689
+ return Data_Wrap_Struct(Class_Pixel, NULL, destroy_Pixel, pixel);
690
+ }
691
+
692
+
693
+ /**
694
+ * Create a Magick::Pixel object from a PixelColor structure.
695
+ *
696
+ * No Ruby usage (internal function)
697
+ *
698
+ * Notes:
699
+ * - Bypasses normal Pixel.new, Pixel#initialize methods
700
+ *
701
+ * @param pp the PixelColor
702
+ * @return a new Magick::Pixel object
703
+ */
704
+ VALUE
705
+ Pixel_from_PixelColor(const PixelColor *pp)
706
+ {
707
+ Pixel *pixel;
708
+
709
+ pixel = ALLOC(Pixel);
710
+ pixel->red = pp->red;
711
+ pixel->green = pp->green;
712
+ pixel->blue = pp->blue;
713
+ pixel->opacity = pp->opacity;
714
+
647
715
  return Data_Wrap_Struct(Class_Pixel, NULL, destroy_Pixel, pixel);
648
716
  }
649
717
 
@@ -960,6 +1028,28 @@ Pixel_to_HSL(VALUE self)
960
1028
  }
961
1029
 
962
1030
 
1031
+ /**
1032
+ * Convert a Pixel to a MagickPixel.
1033
+ *
1034
+ * No Ruby usage (internal function)
1035
+ *
1036
+ * Notes:
1037
+ * - Same code as the private function SetMagickPixelPacket in ImageMagick.
1038
+ *
1039
+ * @param pixel the pixel
1040
+ * @param pp the MagickPixel to be modified
1041
+ */
1042
+ static void
1043
+ rm_set_magick_pixel_packet(Pixel *pixel, MagickPixel *pp)
1044
+ {
1045
+ pp->red = (MagickRealType) pixel->red;
1046
+ pp->green = (MagickRealType) pixel->green;
1047
+ pp->blue = (MagickRealType) pixel->blue;
1048
+ pp->opacity = (MagickRealType) pixel->opacity;
1049
+ pp->index = (MagickRealType) 0.0;
1050
+ }
1051
+
1052
+
963
1053
  /**
964
1054
  * Return the color name corresponding to the pixel values.
965
1055
  *
@@ -988,7 +1078,7 @@ Pixel_to_color(int argc, VALUE *argv, VALUE self)
988
1078
  Info *info;
989
1079
  Image *image;
990
1080
  Pixel *pixel;
991
- MagickPixelPacket mpp;
1081
+ MagickPixel mpp;
992
1082
  MagickBooleanType hex = MagickFalse;
993
1083
  char name[MaxTextExtent];
994
1084
  ExceptionInfo *exception;
@@ -1031,17 +1121,22 @@ Pixel_to_color(int argc, VALUE *argv, VALUE self)
1031
1121
  Data_Get_Struct(self, Pixel, pixel);
1032
1122
 
1033
1123
  info = CloneImageInfo(NULL);
1034
- image = AcquireImage(info);
1124
+ image = rm_acquire_image(info);
1125
+ (void) DestroyImageInfo(info);
1126
+
1127
+ if (!image)
1128
+ {
1129
+ rb_raise(rb_eNoMemError, "not enough memory to continue.");
1130
+ }
1131
+
1035
1132
  image->depth = depth;
1036
1133
  image->matte = matte;
1037
- (void) DestroyImageInfo(info);
1038
1134
 
1039
- GetMagickPixelPacket(image, &mpp);
1135
+ rm_init_magickpixel(image, &mpp);
1040
1136
  rm_set_magick_pixel_packet(pixel, &mpp);
1041
1137
 
1042
1138
  exception = AcquireExceptionInfo();
1043
1139
 
1044
- #if defined(HAVE_NEW_QUERYMAGICKCOLORNAME)
1045
1140
  // Support for hex-format color names moved out of QueryMagickColorname
1046
1141
  // in 6.4.1-9. The 'hex' argument was removed as well.
1047
1142
  if (hex)
@@ -1057,9 +1152,7 @@ Pixel_to_color(int argc, VALUE *argv, VALUE self)
1057
1152
  {
1058
1153
  (void) QueryMagickColorname(image, &mpp, compliance, name, exception);
1059
1154
  }
1060
- #else
1061
- (void) QueryMagickColorname(image, &mpp, compliance, hex, name, exception);
1062
- #endif
1155
+
1063
1156
  (void) DestroyImage(image);
1064
1157
  CHECK_EXCEPTION()
1065
1158
  (void) DestroyExceptionInfo(exception);
@@ -1090,25 +1183,3 @@ Pixel_to_s(VALUE self)
1090
1183
  return rb_str_new2(buff);
1091
1184
  }
1092
1185
 
1093
-
1094
- /**
1095
- * Convert a PixelPacket to a MagickPixelPacket.
1096
- *
1097
- * No Ruby usage (internal function)
1098
- *
1099
- * Notes:
1100
- * - Same code as the private function SetMagickPixelPacket in ImageMagick.
1101
- *
1102
- * @param pixel the pixel
1103
- * @param pp the MagickPixelPacket to be modified
1104
- */
1105
- void
1106
- rm_set_magick_pixel_packet(Pixel *pixel, MagickPixelPacket *pp)
1107
- {
1108
- pp->red = (MagickRealType) pixel->red;
1109
- pp->green = (MagickRealType) pixel->green;
1110
- pp->blue = (MagickRealType) pixel->blue;
1111
- pp->opacity = (MagickRealType) pixel->opacity;
1112
- pp->index = (MagickRealType) 0.0;
1113
- }
1114
-
@@ -15,16 +15,6 @@
15
15
 
16
16
 
17
17
 
18
- static const char *ComplianceType_name(ComplianceType *);
19
- static VALUE ComplianceType_new(ComplianceType);
20
- static const char *StretchType_name(StretchType);
21
- static VALUE StretchType_new(StretchType);
22
- static const char *StyleType_name(StyleType);
23
- static VALUE StyleType_new(StyleType);
24
-
25
-
26
-
27
-
28
18
  /**
29
19
  * Given a C AffineMatrix, create the equivalent AffineMatrix object.
30
20
  *
@@ -244,7 +234,7 @@ Import_ColorInfo(const ColorInfo *ci)
244
234
 
245
235
  compliance_type = ci->compliance;
246
236
  compliance = ComplianceType_new(compliance_type);
247
- color = Pixel_from_MagickPixelPacket(&(ci->color));
237
+ color = Pixel_from_MagickPixel(&(ci->color));
248
238
 
249
239
  RB_GC_GUARD(name);
250
240
  RB_GC_GUARD(compliance);
@@ -266,7 +256,7 @@ Import_ColorInfo(const ColorInfo *ci)
266
256
  void
267
257
  Export_ColorInfo(ColorInfo *ci, VALUE st)
268
258
  {
269
- Pixel *pixel;
259
+ PixelColor pixel;
270
260
  VALUE members, m;
271
261
 
272
262
  if (CLASS_OF(st) != Class_Color)
@@ -292,13 +282,13 @@ Export_ColorInfo(ColorInfo *ci, VALUE st)
292
282
  m = rb_ary_entry(members, 2);
293
283
  if (m != Qnil)
294
284
  {
295
- Data_Get_Struct(m, Pixel, pixel);
285
+ Color_to_PixelColor(&pixel, m);
296
286
  // For >= 6.3.0, ColorInfo.color is a MagickPixelPacket so we have to
297
287
  // convert the PixelPacket.
298
- GetMagickPixelPacket(NULL, &ci->color);
299
- ci->color.red = (MagickRealType) pixel->red;
300
- ci->color.green = (MagickRealType) pixel->green;
301
- ci->color.blue = (MagickRealType) pixel->blue;
288
+ rm_init_magickpixel(NULL, &ci->color);
289
+ ci->color.red = (MagickRealType) pixel.red;
290
+ ci->color.green = (MagickRealType) pixel.green;
291
+ ci->color.blue = (MagickRealType) pixel.blue;
302
292
  ci->color.opacity = (MagickRealType) OpaqueOpacity;
303
293
  ci->color.index = (MagickRealType) 0;
304
294
  }
@@ -309,27 +299,26 @@ Export_ColorInfo(ColorInfo *ci, VALUE st)
309
299
 
310
300
 
311
301
  /**
312
- * Convert either a String color name or a Magick::Pixel to a MagickPixelPacket.
302
+ * Convert either a String color name or a Magick::Pixel to a MagickPixel.
313
303
  *
314
304
  * No Ruby usage (internal function)
315
305
  *
316
306
  * Notes:
317
- * - The channel values in a MagickPixelPacket are doubles.
307
+ * - The channel values in a MagickPixel are doubles.
318
308
  *
319
309
  * @param image the Image
320
- * @param mpp The MagickPixelPacket to modify
310
+ * @param mpp The MagickPixel to modify
321
311
  * @param color the name of the color
322
312
  */
323
313
  void
324
- Color_to_MagickPixelPacket(Image *image, MagickPixelPacket *mpp, VALUE color)
314
+ Color_to_MagickPixel(Image *image, MagickPixel *mpp, VALUE color)
325
315
  {
326
- PixelPacket pp;
316
+ PixelColor pp;
327
317
 
328
318
  // image can be NULL
329
- GetMagickPixelPacket(image, mpp);
319
+ rm_init_magickpixel(image, mpp);
330
320
 
331
- memset(&pp, '\0', sizeof(pp));
332
- Color_to_PixelPacket(&pp, color);
321
+ Color_to_PixelColor(&pp, color);
333
322
  mpp->red = (MagickRealType) pp.red;
334
323
  mpp->green = (MagickRealType) pp.green;
335
324
  mpp->blue = (MagickRealType) pp.blue;
@@ -384,76 +373,6 @@ Color_to_s(VALUE self)
384
373
  return rb_str_new2(buff);
385
374
  }
386
375
 
387
-
388
- /**
389
- * Return the string representation of a ComplianceType value.
390
- *
391
- * No Ruby usage (internal function)
392
- *
393
- * Notes:
394
- * - xMagick will OR multiple compliance types so we have to arbitrarily pick
395
- * one name.
396
- * - Set the compliance argument to the selected value.
397
- *
398
- * @param c the ComplianceType value
399
- * @return the string
400
- */
401
- static const char *
402
- ComplianceType_name(ComplianceType *c)
403
- {
404
- if ((*c & (SVGCompliance|X11Compliance|XPMCompliance))
405
- == (SVGCompliance|X11Compliance|XPMCompliance))
406
- {
407
- return "AllCompliance";
408
- }
409
- else if (*c & SVGCompliance)
410
- {
411
- *c = SVGCompliance;
412
- return "SVGCompliance";
413
- }
414
- else if (*c & X11Compliance)
415
- {
416
- *c = X11Compliance;
417
- return "X11Compliance";
418
- }
419
- else if (*c & XPMCompliance)
420
- {
421
- *c = XPMCompliance;
422
- return "XPMCompliance";
423
- }
424
- else if (*c == NoCompliance)
425
- {
426
- *c = NoCompliance;
427
- return "NoCompliance";
428
- }
429
- else
430
- {
431
- *c = UndefinedCompliance;
432
- return "UndefinedCompliance";
433
- }
434
- }
435
-
436
-
437
- /**
438
- * Construct a ComplianceType enum object for the specified value.
439
- *
440
- * No Ruby usage (internal function)
441
- *
442
- * @param compliance the C ComplianceType value
443
- * @return the Ruby ComplianceType enum object
444
- */
445
- static VALUE
446
- ComplianceType_new(ComplianceType compliance)
447
- {
448
- const char *name;
449
-
450
- // Turn off undefined bits
451
- compliance &= (SVGCompliance|X11Compliance|XPMCompliance);
452
- name = ComplianceType_name(&compliance);
453
- return rm_enum_new(Class_ComplianceType, ID2SYM(rb_intern(name)), INT2FIX(compliance));
454
- }
455
-
456
-
457
376
  /**
458
377
  * Convert a TypeInfo structure to a Magick::Font.
459
378
  *
@@ -907,92 +826,6 @@ SegmentInfo_to_s(VALUE self)
907
826
  }
908
827
 
909
828
 
910
- /**
911
- * Return the string representation of a StretchType value.
912
- *
913
- * No Ruby usage (internal function)
914
- *
915
- * @param stretch the StretchType value
916
- * @return the string
917
- */
918
- static const char *
919
- StretchType_name(StretchType stretch)
920
- {
921
- switch (stretch)
922
- {
923
- ENUM_TO_NAME(UndefinedStretch)
924
- ENUM_TO_NAME(NormalStretch)
925
- ENUM_TO_NAME(UltraCondensedStretch)
926
- ENUM_TO_NAME(ExtraCondensedStretch)
927
- ENUM_TO_NAME(CondensedStretch)
928
- ENUM_TO_NAME(SemiCondensedStretch)
929
- ENUM_TO_NAME(SemiExpandedStretch)
930
- ENUM_TO_NAME(ExpandedStretch)
931
- ENUM_TO_NAME(ExtraExpandedStretch)
932
- ENUM_TO_NAME(UltraExpandedStretch)
933
- ENUM_TO_NAME(AnyStretch)
934
- }
935
-
936
- return "UndefinedStretch";
937
- }
938
-
939
-
940
- /**
941
- * Construct a StretchType enum for a specified StretchType value.
942
- *
943
- * No Ruby usage (internal function)
944
- *
945
- * @param stretch the C StretchType value
946
- * @return a Ruby StretchType enum
947
- */
948
- static VALUE
949
- StretchType_new(StretchType stretch)
950
- {
951
- const char *name = StretchType_name(stretch);
952
- return rm_enum_new(Class_StretchType, ID2SYM(rb_intern(name)), INT2FIX(stretch));
953
- }
954
-
955
-
956
- /**
957
- * Return the string representation of a StyleType value.
958
- *
959
- * No Ruby usage (internal function)
960
- *
961
- * @param style the StyleType value
962
- * @return the string
963
- */
964
- static const char *
965
- StyleType_name(StyleType style)
966
- {
967
- switch (style)
968
- {
969
- ENUM_TO_NAME(UndefinedStyle)
970
- ENUM_TO_NAME(NormalStyle)
971
- ENUM_TO_NAME(ItalicStyle)
972
- ENUM_TO_NAME(ObliqueStyle)
973
- ENUM_TO_NAME(AnyStyle)
974
- }
975
-
976
- return "UndefinedStyle";
977
- }
978
-
979
-
980
- /**
981
- * Construct a StyleType enum for a specified StyleType value.
982
- *
983
- * No Ruby usage (internal function)
984
- *
985
- * @param style the C StyleType value
986
- * @return a Ruby StyleType enum
987
- */
988
- static VALUE
989
- StyleType_new(StyleType style)
990
- {
991
- const char *name = StyleType_name(style);
992
- return rm_enum_new(Class_StyleType, ID2SYM(rb_intern(name)), INT2FIX(style));
993
- }
994
-
995
-
996
829
  /**
997
830
  * Convert a TypeMetric structure to a Magick::TypeMetric.
998
831
  *