rmagick 1.9.1 → 1.9.2

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
- MANIFEST for RMagick-1.9.1 - 18:06:01 09/07/05
1
+ MANIFEST for RMagick-1.9.2 - 17:43:02 09/15/05
2
2
 
3
3
  configure
4
4
  README.html
@@ -1,4 +1,4 @@
1
- /* $Id: rmagick.h,v 1.92 2005/09/05 20:27:27 rmagick Exp $ */
1
+ /* $Id: rmagick.h,v 1.94 2005/09/13 23:37:21 rmagick Exp $ */
2
2
  /*=============================================================================
3
3
  | Copyright (C) 2005 by Timothy P. Hunter
4
4
  | Name: rmagick.h
@@ -268,6 +268,9 @@ EXTERN VALUE Class_GravityType;
268
268
  EXTERN VALUE Class_ImageType;
269
269
  EXTERN VALUE Class_InterlaceType;
270
270
  EXTERN VALUE Class_NoiseType;
271
+ #if defined(HAVE_IMAGE_ORIENTATION)
272
+ EXTERN VALUE Class_OrientationType;
273
+ #endif
271
274
  EXTERN VALUE Class_PaintMethod;
272
275
  EXTERN VALUE Class_PreviewType;
273
276
  EXTERN VALUE Class_RenderingIntent;
@@ -276,9 +279,7 @@ EXTERN VALUE Class_StorageType;
276
279
  EXTERN VALUE Class_StretchType;
277
280
  EXTERN VALUE Class_StyleType;
278
281
  EXTERN VALUE Class_WeightType;
279
- #if defined(HAVE_IMAGE_ORIENTATION)
280
- EXTERN VALUE Class_OrientationType;
281
- #endif
282
+ EXTERN VALUE Class_VirtualPixelMethod;
282
283
 
283
284
  /*
284
285
  * Commonly-used IDs
@@ -482,6 +483,7 @@ Pixel_##_channel_##_eq(VALUE self, VALUE v) \
482
483
  e = (type)(magick_enum->val);\
483
484
  } while(0)
484
485
 
486
+ #define ENUM_TO_NAME(_enum) case _enum: return #_enum;
485
487
 
486
488
 
487
489
  // Method, external function declarations. These declarations are
@@ -649,6 +651,7 @@ ATTR_ACCESSOR(Image, blur)
649
651
  ATTR_ACCESSOR(Image, border_color)
650
652
  ATTR_READER(Image, bounding_box)
651
653
  ATTR_ACCESSOR(Image, chromaticity)
654
+ ATTR_ACCESSOR(Image, class_type)
652
655
  ATTR_WRITER(Image, clip_mask)
653
656
  ATTR_ACCESSOR(Image, color_profile)
654
657
  ATTR_READER(Image, colors)
@@ -693,10 +696,11 @@ ATTR_ACCESSOR(Image, rendering_intent)
693
696
  ATTR_READER(Image, rows)
694
697
  ATTR_READER(Image, scene)
695
698
  ATTR_ACCESSOR(Image, start_loop)
696
- ATTR_ACCESSOR(Image, class_type)
699
+ ATTR_ACCESSOR(Image, ticks_per_second)
697
700
  ATTR_ACCESSOR(Image, tile_info)
698
701
  ATTR_READER(Image, total_colors)
699
702
  ATTR_ACCESSOR(Image, units)
703
+ ATTR_ACCESSOR(Image, virtual_pixel_method)
700
704
  ATTR_ACCESSOR(Image, x_resolution)
701
705
  ATTR_ACCESSOR(Image, y_resolution)
702
706
 
@@ -959,6 +963,7 @@ extern VALUE Statistics_new(ImageStatistics *);
959
963
  extern VALUE OrientationType_new(OrientationType);
960
964
  #endif
961
965
  extern const char *StorageType_name(StorageType);
966
+ extern VALUE VirtualPixelMethod_new(VirtualPixelMethod);
962
967
 
963
968
  #if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
964
969
  extern VALUE Enum_alloc(VALUE);
@@ -106,7 +106,8 @@
106
106
  #undef HAVE_IMAGE_QUALITY
107
107
  /* Introduced in IM 6.0.0 */
108
108
  #undef HAVE_IMAGE_ORIENTATION
109
- #undef HAVE_IMAGE_STORAGE_CLASS
109
+ /* Introduced in IM 6.2.4 */
110
+ #undef HAVE_IMAGE_TICKS_PER_SECOND
110
111
  /* Introduced in IM 5.5.6 */
111
112
  #undef HAVE_IMAGEINFO_NUMBER_SCENES
112
113
  /* Introduced in IM 5.5.7, GM 1.1 */
@@ -176,6 +177,8 @@
176
177
  #undef HAVE_THRESHOLDIMAGECHANNEL
177
178
  #undef HAVE_THUMBNAILIMAGE
178
179
  #undef HAVE_TINTIMAGE
180
+ /* Introduced in IM 6.2.4 */
181
+ #undef HAVE_TRANSPARENTVIRTUALPIXELMETHOD
179
182
  /* Introduced in IM 6.0.0 */
180
183
  #undef HAVE_UNDEFINEDGRAVITY
181
184
  #undef HAVE_UNISTD_H
@@ -1,4 +1,4 @@
1
- /* $Id: rmimage.c,v 1.118 2005/09/07 21:51:45 rmagick Exp $ */
1
+ /* $Id: rmimage.c,v 1.121 2005/09/13 23:37:21 rmagick Exp $ */
2
2
  /*============================================================================\
3
3
  | Copyright (C) 2005 by Timothy P. Hunter
4
4
  | Name: rmimage.c
@@ -5335,11 +5335,7 @@ Image_pixel_color(
5335
5335
  HANDLE_ERROR
5336
5336
 
5337
5337
  // PseudoClass
5338
- #if defined(HAVE_IMAGE_STORAGE_CLASS)
5339
5338
  if (image->storage_class == PseudoClass)
5340
- #else
5341
- if (image->class == PseudoClass)
5342
- #endif
5343
5339
  {
5344
5340
  IndexPacket *indexes = GetIndexes(image);
5345
5341
  old_color = image->colormap[*indexes];
@@ -5360,20 +5356,12 @@ Image_pixel_color(
5360
5356
 
5361
5357
  // Set the color of a pixel. Return previous color.
5362
5358
  // Convert to DirectClass
5363
- #if defined(HAVE_IMAGE_STORAGE_CLASS)
5364
5359
  if (image->storage_class == PseudoClass)
5365
- #else
5366
- if (image->class == PseudoClass)
5367
- #endif
5368
5360
  {
5369
5361
  SyncImage(image);
5370
5362
  magick_free(image->colormap);
5371
5363
  image->colormap = NULL;
5372
- #if defined(HAVE_IMAGE_STORAGE_CLASS)
5373
5364
  image->storage_class = DirectClass;
5374
- #else
5375
- image->class = DirectClass;
5376
- #endif
5377
5365
  }
5378
5366
 
5379
5367
  pixel = GetImagePixels(image, x, y, 1, 1);
@@ -7187,11 +7175,7 @@ Image_class_type(VALUE self)
7187
7175
  Image *image;
7188
7176
  Data_Get_Struct(self, Image, image);
7189
7177
 
7190
- #if defined(HAVE_IMAGE_STORAGE_CLASS)
7191
7178
  return ClassType_new(image->storage_class);
7192
- #else
7193
- return ClassType_new(image->class);
7194
- #endif
7195
7179
  }
7196
7180
 
7197
7181
  /*
@@ -7210,32 +7194,20 @@ Image_class_type_eq(VALUE self, VALUE new_class_type)
7210
7194
  Data_Get_Struct(self, Image, image);
7211
7195
  VALUE_TO_ENUM(new_class_type, class_type, ClassType);
7212
7196
 
7213
- #if defined(HAVE_IMAGE_STORAGE_CLASS)
7214
7197
  if (image->storage_class == PseudoClass && class_type == DirectClass)
7215
- #else
7216
- if (image->class == PseudoClass && class_type == DirectClass)
7217
- #endif
7218
7198
  {
7219
7199
  SyncImage(image);
7220
7200
  magick_free(image->colormap);
7221
7201
  image->colormap = NULL;
7222
7202
  }
7223
- #if defined(HAVE_IMAGE_STORAGE_CLASS)
7224
7203
  else if (image->storage_class == DirectClass && class_type == PseudoClass)
7225
- #else
7226
- else if (image->class == DirectClass && class_type == PseudoClass)
7227
- #endif
7228
7204
  {
7229
7205
  GetQuantizeInfo(&qinfo);
7230
7206
  qinfo.number_colors = MaxRGB+1;
7231
7207
  QuantizeImage(&qinfo, image);
7232
7208
  }
7233
7209
 
7234
- #if defined(HAVE_IMAGE_STORAGE_CLASS)
7235
7210
  image->storage_class = class_type;
7236
- #else
7237
- image->class = class_type;
7238
- #endif
7239
7211
  return self;
7240
7212
  }
7241
7213
 
@@ -7568,6 +7540,43 @@ Image_thumbnail_bang(int argc, VALUE *argv, VALUE self)
7568
7540
  return thumbnail(True, argc, argv, self);
7569
7541
  }
7570
7542
 
7543
+
7544
+ /*
7545
+ Method: Image#ticks_per_second, ticks_per_second=
7546
+ Purpose: the ticks_per_second attribute accessors
7547
+ */
7548
+ VALUE
7549
+ Image_ticks_per_second(VALUE self)
7550
+ {
7551
+ #if defined(HAVE_IMAGE_TICKS_PER_SECOND)
7552
+ Image *image;
7553
+
7554
+ Data_Get_Struct(self, Image, image);
7555
+ return INT2FIX(image->ticks_per_second);
7556
+ #else
7557
+ rm_not_implemented();
7558
+ return (VALUE)0;
7559
+ #endif
7560
+ }
7561
+
7562
+
7563
+ VALUE
7564
+ Image_ticks_per_second_eq(VALUE self, VALUE tps)
7565
+ {
7566
+ #if defined(HAVE_IMAGE_TICKS_PER_SECOND)
7567
+ Image *image;
7568
+
7569
+ rm_check_frozen(self);
7570
+ Data_Get_Struct(self, Image, image);
7571
+ image->ticks_per_second = NUM2INT(tps);
7572
+ return self;
7573
+ #else
7574
+ rm_not_implemented();
7575
+ return (VALUE)0;
7576
+ #endif
7577
+ }
7578
+
7579
+
7571
7580
  /*
7572
7581
  Method: Image#tile_info, tile_info=
7573
7582
  Purpose: the tile_info attribute accessors
@@ -8056,6 +8065,41 @@ Image_unsharp_mask_channel(int argc, VALUE *argv, VALUE self)
8056
8065
  #endif
8057
8066
  }
8058
8067
 
8068
+
8069
+ /*
8070
+ Method: Image#virtual_pixel_method
8071
+ Purpose: get the VirtualPixelMethod for the image
8072
+ */
8073
+ VALUE
8074
+ Image_virtual_pixel_method(VALUE self)
8075
+ {
8076
+ Image *image;
8077
+ VirtualPixelMethod vpm;
8078
+
8079
+ Data_Get_Struct(self, Image, image);
8080
+ vpm = GetImageVirtualPixelMethod(image);
8081
+
8082
+ return VirtualPixelMethod_new(vpm);
8083
+ }
8084
+
8085
+
8086
+ /*
8087
+ Method: Image#virtual_pixel_method=
8088
+ Purpose: set the virtual pixel method for the image
8089
+ */
8090
+ VALUE
8091
+ Image_virtual_pixel_method_eq(VALUE self, VALUE method)
8092
+ {
8093
+ Image *image;
8094
+ VirtualPixelMethod vpm;
8095
+
8096
+ rm_check_frozen(self);
8097
+ Data_Get_Struct(self, Image, image);
8098
+ VALUE_TO_ENUM(method, vpm, VirtualPixelMethod);
8099
+ (void) SetImageVirtualPixelMethod(image, vpm);
8100
+ return self;
8101
+ }
8102
+
8059
8103
  /*
8060
8104
  Method: Image#wave(amplitude=25.0, wavelength=150.0)
8061
8105
  Purpose: creates a "ripple" effect in the image by shifting the pixels
@@ -1,4 +1,4 @@
1
- /* $Id: rmmain.c,v 1.95 2005/09/07 21:51:45 rmagick Exp $ */
1
+ /* $Id: rmmain.c,v 1.97 2005/09/13 23:37:21 rmagick Exp $ */
2
2
  /*============================================================================\
3
3
  | Copyright (C) 2005 by Timothy P. Hunter
4
4
  | Name: rmmain.c
@@ -617,9 +617,11 @@ Init_RMagick(void)
617
617
  DCL_ATTR_READER(Image, scene)
618
618
  DCL_ATTR_ACCESSOR(Image, start_loop)
619
619
  DCL_ATTR_ACCESSOR(Image, class_type)
620
+ DCL_ATTR_ACCESSOR(Image, ticks_per_second)
620
621
  DCL_ATTR_ACCESSOR(Image, tile_info)
621
622
  DCL_ATTR_READER(Image, total_colors)
622
623
  DCL_ATTR_ACCESSOR(Image, units)
624
+ DCL_ATTR_ACCESSOR(Image, virtual_pixel_method)
623
625
  DCL_ATTR_ACCESSOR(Image, x_resolution)
624
626
  DCL_ATTR_ACCESSOR(Image, y_resolution)
625
627
 
@@ -1461,6 +1463,18 @@ Init_RMagick(void)
1461
1463
  ENUMERATOR(AnyStyle)
1462
1464
  END_ENUM
1463
1465
 
1466
+ // VirtualPixelMethod
1467
+ DEF_ENUM(VirtualPixelMethod)
1468
+ ENUMERATOR(UndefinedVirtualPixelMethod)
1469
+ ENUMERATOR(EdgeVirtualPixelMethod)
1470
+ ENUMERATOR(MirrorVirtualPixelMethod)
1471
+ ENUMERATOR(TileVirtualPixelMethod)
1472
+ #if defined(HAVE_TRANSPARENTVIRTUALPIXELMETHOD)
1473
+ ENUMERATOR(BackgroundVirtualPixelMethod)
1474
+ ENUMERATOR(TransparentVirtualPixelMethod)
1475
+ #endif
1476
+ END_ENUM
1477
+
1464
1478
  // WeightType constants
1465
1479
  DEF_ENUM(WeightType)
1466
1480
  ENUMERATOR(AnyWeight)
@@ -1558,7 +1572,7 @@ static void version_constants(void)
1558
1572
 
1559
1573
  rb_define_const(Module_Magick, "Version", rb_str_new2(PACKAGE_STRING));
1560
1574
  sprintf(long_version,
1561
- "This is %s ($Date: 2005/09/07 21:51:45 $) Copyright (C) 2005 by Timothy P. Hunter\n"
1575
+ "This is %s ($Date: 2005/09/13 23:37:21 $) Copyright (C) 2005 by Timothy P. Hunter\n"
1562
1576
  "Built with %s\n"
1563
1577
  "Built for %s\n"
1564
1578
  "Web page: http://rmagick.rubyforge.org\n"
@@ -1,4 +1,4 @@
1
- /* $Id: rmutil.c,v 1.57 2005/09/07 21:51:45 rmagick Exp $ */
1
+ /* $Id: rmutil.c,v 1.59 2005/09/11 16:41:40 rmagick Exp $ */
2
2
  /*============================================================================\
3
3
  | Copyright (C) 2005 by Timothy P. Hunter
4
4
  | Name: rmutil.c
@@ -9,8 +9,8 @@
9
9
  #include "rmagick.h"
10
10
  #include <errno.h>
11
11
 
12
- static const char *Compliance_Const_Name(ComplianceType *);
13
- static const char *StyleType_Const_Name(StyleType);
12
+ static const char *Compliance_name(ComplianceType *);
13
+ static const char *StyleType_name(StyleType);
14
14
  static const char *StretchType_name(StretchType);
15
15
  static void Color_Name_to_PixelPacket(PixelPacket *, VALUE);
16
16
  static VALUE Enum_type_values(VALUE);
@@ -1070,244 +1070,157 @@ ComplianceType_new(ComplianceType compliance)
1070
1070
 
1071
1071
  // Turn off undefined bits
1072
1072
  compliance &= (SVGCompliance|X11Compliance|XPMCompliance);
1073
- name = Compliance_Const_Name(&compliance);
1073
+ name = Compliance_name(&compliance);
1074
1074
  return rm_enum_new(Class_ComplianceType, ID2SYM(rb_intern(name)), INT2FIX(compliance));
1075
1075
  }
1076
1076
 
1077
1077
 
1078
1078
  /*
1079
- External: CompositeOperator_new
1080
- Purpose: Construct a CompositeOperator enum object for the specified value
1079
+ Static: CompositeOperator_new
1080
+ Purpose: return the name of a CompositeOperator enum as a string
1081
1081
  */
1082
- VALUE
1083
- CompositeOperator_new(CompositeOperator op)
1082
+ static const char *
1083
+ CompositeOperator_name(CompositeOperator op)
1084
1084
  {
1085
- const char *name;
1086
-
1087
1085
  switch (op)
1088
1086
  {
1089
1087
  default:
1090
- case UndefinedCompositeOp:
1091
- name = "UndefinedCompositeOp";
1092
- break;
1093
- case NoCompositeOp:
1094
- name = "NoCompositeOp";
1095
- break;
1096
- case AddCompositeOp:
1097
- name = "AddCompositeOp";
1098
- break;
1099
- case AtopCompositeOp:
1100
- name = "AtopCompositeOp";
1101
- break;
1102
- case BumpmapCompositeOp:
1103
- name = "BumpmapCompositeOp";
1104
- break;
1105
- case ClearCompositeOp:
1106
- name = "ClearCompositeOp";
1107
- break;
1088
+ ENUM_TO_NAME(UndefinedCompositeOp)
1089
+ ENUM_TO_NAME(NoCompositeOp)
1090
+ ENUM_TO_NAME(AddCompositeOp)
1091
+ ENUM_TO_NAME(AtopCompositeOp)
1092
+ ENUM_TO_NAME(BumpmapCompositeOp)
1093
+ ENUM_TO_NAME(ClearCompositeOp)
1108
1094
  #if defined(HAVE_COLORDODGECOMPOSITEOP)
1109
- case ColorBurnCompositeOp:
1110
- name = "ColorBurnCompositeOp";
1111
- break;
1112
- case BlendCompositeOp:
1113
- name = "BlendCompositeOp";
1114
- break;
1115
- case ColorDodgeCompositeOp:
1116
- name = "ColorDodgeCompositeOp";
1117
- break;
1118
- case ExclusionCompositeOp:
1119
- name = "ExclusionCompositeOp";
1120
- break;
1121
- case HardLightCompositeOp:
1122
- name = "HardLightCompositeOp";
1123
- break;
1124
- case SoftLightCompositeOp:
1125
- name = "SoftLightCompositeOp";
1126
- break;
1095
+ ENUM_TO_NAME(ColorBurnCompositeOp)
1096
+ ENUM_TO_NAME(BlendCompositeOp)
1097
+ ENUM_TO_NAME(ColorDodgeCompositeOp)
1098
+ ENUM_TO_NAME(ExclusionCompositeOp)
1099
+ ENUM_TO_NAME(HardLightCompositeOp)
1100
+ ENUM_TO_NAME(SoftLightCompositeOp)
1127
1101
  #endif
1128
- case ColorizeCompositeOp:
1129
- name = "ColorizeCompositeOp";
1130
- break;
1131
- case CopyBlueCompositeOp:
1132
- name = "CopyBlueCompositeOp";
1133
- break;
1134
- case CopyCompositeOp:
1135
- name = "CopyCompositeOp";
1136
- break;
1102
+ ENUM_TO_NAME(ColorizeCompositeOp)
1103
+ ENUM_TO_NAME(CopyBlueCompositeOp)
1104
+ ENUM_TO_NAME(CopyCompositeOp)
1137
1105
  #if defined(HAVE_COPYCYANCOMPOSITEOP) // CYMK added 5.5.7
1138
- case CopyCyanCompositeOp:
1139
- name = "CopyCyanCompositeOp";
1140
- break;
1141
- case CopyMagentaCompositeOp:
1142
- name = "CopyMagentaCompositeOp";
1143
- break;
1144
- case CopyYellowCompositeOp:
1145
- name = "CopyYellowCompositeOp";
1146
- break;
1147
- case CopyBlackCompositeOp:
1148
- name = "CopyBlackCompositeOp";
1149
- break;
1106
+ ENUM_TO_NAME(CopyCyanCompositeOp)
1107
+ ENUM_TO_NAME(CopyMagentaCompositeOp)
1108
+ ENUM_TO_NAME(CopyYellowCompositeOp)
1109
+ ENUM_TO_NAME(CopyBlackCompositeOp)
1150
1110
  #endif
1151
- case CopyGreenCompositeOp:
1152
- name = "CopyGreenCompositeOp";
1153
- break;
1154
- case CopyOpacityCompositeOp:
1155
- name = "CopyOpacityCompositeOp";
1156
- break;
1157
- case CopyRedCompositeOp:
1158
- name = "CopyRedCompositeOp";
1159
- break;
1160
- case DarkenCompositeOp:
1161
- name = "DarkenCompositeOp";
1162
- break;
1111
+ ENUM_TO_NAME(CopyGreenCompositeOp)
1112
+ ENUM_TO_NAME(CopyOpacityCompositeOp)
1113
+ ENUM_TO_NAME(CopyRedCompositeOp)
1114
+ ENUM_TO_NAME(DarkenCompositeOp)
1163
1115
  #if defined(HAVE_DSTCOMPOSITEOP)
1164
- case DstAtopCompositeOp:
1165
- name = "DstAtopCompositeOp";
1166
- break;
1167
- case DstCompositeOp:
1168
- name = "DstCompositeOp";
1169
- break;
1170
- case DstInCompositeOp:
1171
- name = "DstInCompositeOp";
1172
- break;
1173
- case DstOutCompositeOp:
1174
- name = "DstOutCompositeOp";
1175
- break;
1176
- case DstOverCompositeOp:
1177
- name = "DstOverCompositeOp";
1178
- break;
1116
+ ENUM_TO_NAME(DstAtopCompositeOp)
1117
+ ENUM_TO_NAME(DstCompositeOp)
1118
+ ENUM_TO_NAME(DstInCompositeOp)
1119
+ ENUM_TO_NAME(DstOutCompositeOp)
1120
+ ENUM_TO_NAME(DstOverCompositeOp)
1179
1121
  #endif
1180
- case DifferenceCompositeOp:
1181
- name = "DifferenceCompositeOp";
1182
- break;
1183
- case DisplaceCompositeOp:
1184
- name = "DisplaceCompositeOp";
1185
- break;
1186
- case DissolveCompositeOp:
1187
- name = "DissolveCompositeOp";
1188
- break;
1189
- case HueCompositeOp:
1190
- name = "HueCompositeOp";
1191
- break;
1192
- case InCompositeOp:
1193
- name = "InCompositeOp";
1194
- break;
1195
- case LightenCompositeOp:
1196
- name = "LightenCompositeOp";
1197
- break;
1198
- case LuminizeCompositeOp:
1199
- name = "LuminizeCompositeOp";
1200
- break;
1201
- case MinusCompositeOp:
1202
- name = "MinusCompositeOp";
1203
- break;
1204
- case ModulateCompositeOp:
1205
- name = "ModulateCompositeOp";
1206
- break;
1207
- case MultiplyCompositeOp:
1208
- name = "MultiplyCompositeOp";
1209
- break;
1210
- case OutCompositeOp:
1211
- name = "OutCompositeOp";
1212
- break;
1213
- case OverCompositeOp:
1214
- name = "OverCompositeOp";
1215
- break;
1216
- case OverlayCompositeOp:
1217
- name = "OverlayCompositeOp";
1218
- break;
1219
- case PlusCompositeOp:
1220
- name = "PlusCompositeOp";
1221
- break;
1122
+ ENUM_TO_NAME(DifferenceCompositeOp)
1123
+ ENUM_TO_NAME(DisplaceCompositeOp)
1124
+ ENUM_TO_NAME(DissolveCompositeOp)
1125
+ ENUM_TO_NAME(HueCompositeOp)
1126
+ ENUM_TO_NAME(InCompositeOp)
1127
+ ENUM_TO_NAME(LightenCompositeOp)
1128
+ ENUM_TO_NAME(LuminizeCompositeOp)
1129
+ ENUM_TO_NAME(MinusCompositeOp)
1130
+ ENUM_TO_NAME(ModulateCompositeOp)
1131
+ ENUM_TO_NAME(MultiplyCompositeOp)
1132
+ ENUM_TO_NAME(OutCompositeOp)
1133
+ ENUM_TO_NAME(OverCompositeOp)
1134
+ ENUM_TO_NAME(OverlayCompositeOp)
1135
+ ENUM_TO_NAME(PlusCompositeOp)
1222
1136
  #if defined(HAVE_REPLACECOMPOSITEOP) // Added 5.5.8
1223
- case ReplaceCompositeOp:
1224
- name = "ReplaceCompositeOp";
1225
- break;
1137
+ ENUM_TO_NAME(ReplaceCompositeOp)
1226
1138
  #endif
1227
- case SaturateCompositeOp:
1228
- name = "SaturateCompositeOp";
1229
- break;
1230
- case ScreenCompositeOp:
1231
- name = "ScreenCompositeOp";
1232
- break;
1139
+ ENUM_TO_NAME(SaturateCompositeOp)
1140
+ ENUM_TO_NAME(ScreenCompositeOp)
1233
1141
  #if defined(HAVE_DSTCOMPOSITEOP)
1234
- case SrcAtopCompositeOp:
1235
- name = "SrcAtopCompositeOp";
1236
- break;
1237
- case SrcCompositeOp:
1238
- name = "SrcCompositeOp";
1239
- break;
1240
- case SrcInCompositeOp:
1241
- name = "SrcInCompositeOp";
1242
- break;
1243
- case SrcOutCompositeOp:
1244
- name = "SrcOutCompositeOp";
1245
- break;
1246
- case SrcOverCompositeOp:
1247
- name = "SrcOverCompositeOp";
1248
- break;
1142
+ ENUM_TO_NAME(SrcAtopCompositeOp)
1143
+ ENUM_TO_NAME(SrcCompositeOp)
1144
+ ENUM_TO_NAME(SrcInCompositeOp)
1145
+ ENUM_TO_NAME(SrcOutCompositeOp)
1146
+ ENUM_TO_NAME(SrcOverCompositeOp)
1249
1147
  #endif
1250
- case SubtractCompositeOp:
1251
- name = "SubtractCompositeOp";
1252
- break;
1253
- case ThresholdCompositeOp:
1254
- name = "ThresholdCompositeOp";
1255
- break;
1256
- case XorCompositeOp:
1257
- name = "XorCompositeOp";
1258
- break;
1148
+ ENUM_TO_NAME(SubtractCompositeOp)
1149
+ ENUM_TO_NAME(ThresholdCompositeOp)
1150
+ ENUM_TO_NAME(XorCompositeOp)
1259
1151
  }
1152
+ }
1260
1153
 
1154
+ /*
1155
+ External: CompositeOperator_new
1156
+ Purpose: Construct a CompositeOperator enum object for the specified value
1157
+ */
1158
+ VALUE
1159
+ CompositeOperator_new(CompositeOperator op)
1160
+ {
1161
+ const char *name;
1162
+
1163
+ name = CompositeOperator_name(op);
1261
1164
  return rm_enum_new(Class_CompositeOperator, ID2SYM(rb_intern(name)), INT2FIX(op));
1262
1165
  }
1263
1166
 
1167
+
1168
+ /*
1169
+ Static: CompressionType_name
1170
+ Purpose: Return the name of a CompressionType enum as a string
1171
+ */
1172
+ static const char *
1173
+ CompressionType_name(CompressionType ct)
1174
+ {
1175
+ switch (ct)
1176
+ {
1177
+ default:
1178
+ ENUM_TO_NAME(UndefinedCompression)
1179
+ ENUM_TO_NAME(NoCompression)
1180
+ ENUM_TO_NAME(BZipCompression)
1181
+ ENUM_TO_NAME(FaxCompression)
1182
+ ENUM_TO_NAME(Group4Compression)
1183
+ ENUM_TO_NAME(JPEGCompression)
1184
+ ENUM_TO_NAME(LosslessJPEGCompression)
1185
+ ENUM_TO_NAME(LZWCompression)
1186
+ ENUM_TO_NAME(RLECompression)
1187
+ ENUM_TO_NAME(ZipCompression)
1188
+ }
1189
+ }
1190
+
1191
+
1264
1192
  /*
1265
1193
  * External: CompressionType_new
1266
- Purpose: Construct a CompressionTYpe enum object for the specified value
1194
+ Purpose: Construct a CompressionType enum object for the specified value
1267
1195
  */
1268
1196
  VALUE
1269
1197
  CompressionType_new(CompressionType ct)
1270
1198
  {
1271
1199
  const char *name;
1272
1200
 
1273
- switch (ct)
1201
+ name = CompressionType_name(ct);
1202
+ return rm_enum_new(Class_CompressionType, ID2SYM(rb_intern(name)), INT2FIX(ct));
1203
+ }
1204
+
1205
+
1206
+ /*
1207
+ Static: DisposeType_name
1208
+ Purpose: Return the name of a DisposeType enum as a string
1209
+ */
1210
+ static const char *
1211
+ DisposeType_name(type)
1212
+ {
1213
+ switch(type)
1274
1214
  {
1275
1215
  default:
1276
- case UndefinedCompression:
1277
- name = "UndefinedCompression";
1278
- break;
1279
- case NoCompression:
1280
- name = "NoCompression";
1281
- break;
1282
- case BZipCompression:
1283
- name = "BZipCompression";
1284
- break;
1285
- case FaxCompression:
1286
- name = "FaxCompression";
1287
- break;
1288
- case Group4Compression:
1289
- name = "Group4Compression";
1290
- break;
1291
- case JPEGCompression:
1292
- name = "JPEGCompression";
1293
- break;
1294
- case LosslessJPEGCompression:
1295
- name = "LosslessJPEGCompression";
1296
- break;
1297
- case LZWCompression:
1298
- name = "LZWCompression";
1299
- break;
1300
- case RLECompression:
1301
- name = "RLECompression";
1302
- break;
1303
- case ZipCompression:
1304
- name = "ZipCompression";
1305
- break;
1216
+ ENUM_TO_NAME(UndefinedDispose)
1217
+ ENUM_TO_NAME(BackgroundDispose)
1218
+ ENUM_TO_NAME(NoneDispose)
1219
+ ENUM_TO_NAME(PreviousDispose)
1306
1220
  }
1307
-
1308
- return rm_enum_new(Class_CompressionType, ID2SYM(rb_intern(name)), INT2FIX(ct));
1309
1221
  }
1310
1222
 
1223
+
1311
1224
  /*
1312
1225
  External: DisposeType.new
1313
1226
  Purpose: Construct a DisposeType enum object for the specified value..new
@@ -1317,26 +1230,41 @@ DisposeType_new(DisposeType type)
1317
1230
  {
1318
1231
  const char *name;
1319
1232
 
1233
+ name = DisposeType_name(type);
1234
+ return rm_enum_new(Class_DisposeType, ID2SYM(rb_intern(name)), INT2FIX(type));
1235
+ }
1236
+
1237
+
1238
+ /*
1239
+ Static: FilterTypes_name
1240
+ Purpose: Return the name of a FilterTypes enum as a string
1241
+ */
1242
+ static const char *
1243
+ FilterTypes_name(FilterTypes type)
1244
+ {
1320
1245
  switch(type)
1321
1246
  {
1322
1247
  default:
1323
- case UndefinedDispose:
1324
- name = "UndefinedDispose";
1325
- break;
1326
- case BackgroundDispose:
1327
- name = "BackgroundDispose";
1328
- break;
1329
- case NoneDispose:
1330
- name = "NoneDispose";
1331
- break;
1332
- case PreviousDispose:
1333
- name = "PreviousDispose";
1334
- break;
1248
+ ENUM_TO_NAME(UndefinedFilter)
1249
+ ENUM_TO_NAME(PointFilter)
1250
+ ENUM_TO_NAME(BoxFilter)
1251
+ ENUM_TO_NAME(TriangleFilter)
1252
+ ENUM_TO_NAME(HermiteFilter)
1253
+ ENUM_TO_NAME(HanningFilter)
1254
+ ENUM_TO_NAME(HammingFilter)
1255
+ ENUM_TO_NAME(BlackmanFilter)
1256
+ ENUM_TO_NAME(GaussianFilter)
1257
+ ENUM_TO_NAME(QuadraticFilter)
1258
+ ENUM_TO_NAME(CubicFilter)
1259
+ ENUM_TO_NAME(CatromFilter)
1260
+ ENUM_TO_NAME(MitchellFilter)
1261
+ ENUM_TO_NAME(LanczosFilter)
1262
+ ENUM_TO_NAME(BesselFilter)
1263
+ ENUM_TO_NAME(SincFilter)
1335
1264
  }
1336
-
1337
- return rm_enum_new(Class_DisposeType, ID2SYM(rb_intern(name)), INT2FIX(type));
1338
1265
  }
1339
1266
 
1267
+
1340
1268
  /*
1341
1269
  External: FilterTypes.new
1342
1270
  Purpose: Construct an FilterTypes enum object for the specified value
@@ -1346,64 +1274,28 @@ FilterTypes_new(FilterTypes type)
1346
1274
  {
1347
1275
  const char *name;
1348
1276
 
1277
+ name = FilterTypes_name(type);
1278
+ return rm_enum_new(Class_FilterTypes, ID2SYM(rb_intern(name)), INT2FIX(type));
1279
+ }
1280
+
1281
+
1282
+
1283
+ /*
1284
+ Static: EndianType_name
1285
+ Purpose: Return the name of a EndianType enum as a string
1286
+ */
1287
+ static const char *
1288
+ EndianType_name(type)
1289
+ {
1349
1290
  switch(type)
1350
1291
  {
1351
1292
  default:
1352
- case UndefinedFilter:
1353
- name = "UndefinedFilter";
1354
- break;
1355
- case PointFilter:
1356
- name = "PointFilter";
1357
- break;
1358
- case BoxFilter:
1359
- name = "BoxFilter";
1360
- break;
1361
- case TriangleFilter:
1362
- name = "TriangleFilter";
1363
- break;
1364
- case HermiteFilter:
1365
- name = "HermiteFilter";
1366
- break;
1367
- case HanningFilter:
1368
- name = "HanningFilter";
1369
- break;
1370
- case HammingFilter:
1371
- name = "HammingFilter";
1372
- break;
1373
- case BlackmanFilter:
1374
- name = "BlackmanFilter";
1375
- break;
1376
- case GaussianFilter:
1377
- name = "GaussianFilter";
1378
- break;
1379
- case QuadraticFilter:
1380
- name = "QuadraticFilter";
1381
- break;
1382
- case CubicFilter:
1383
- name = "CubicFilter";
1384
- break;
1385
- case CatromFilter:
1386
- name = "CatromFilter";
1387
- break;
1388
- case MitchellFilter:
1389
- name = "MitchellFilter";
1390
- break;
1391
- case LanczosFilter:
1392
- name = "LanczosFilter";
1393
- break;
1394
- case BesselFilter:
1395
- name = "BesselFilter";
1396
- break;
1397
- case SincFilter:
1398
- name = "SincFilter";
1399
- break;
1400
-
1293
+ ENUM_TO_NAME(UndefinedEndian)
1294
+ ENUM_TO_NAME(LSBEndian)
1295
+ ENUM_TO_NAME(MSBEndian)
1401
1296
  }
1402
- return rm_enum_new(Class_FilterTypes, ID2SYM(rb_intern(name)), INT2FIX(type));
1403
1297
  }
1404
1298
 
1405
-
1406
-
1407
1299
  /*
1408
1300
  External: EndianType.new
1409
1301
  Purpose: Construct an EndianType enum object
@@ -1413,21 +1305,34 @@ EndianType_new(EndianType type)
1413
1305
  {
1414
1306
  const char *name;
1415
1307
 
1416
- switch(type)
1308
+ name = EndianType_name(type);
1309
+ return rm_enum_new(Class_EndianType, ID2SYM(rb_intern(name)), INT2FIX(type));
1310
+ }
1311
+
1312
+
1313
+
1314
+ /*
1315
+ Static: ImageType_name
1316
+ Purpose: Return the name of a ImageType enum as a string
1317
+ */
1318
+ static char *
1319
+ ImageType_name(type)
1320
+ { switch(type)
1417
1321
  {
1418
1322
  default:
1419
- case UndefinedEndian:
1420
- name = "UndefinedEndian";
1421
- break;
1422
- case LSBEndian:
1423
- name = "LSBEndian";
1424
- break;
1425
- case MSBEndian:
1426
- name = "MSBEndian";
1427
- break;
1323
+ ENUM_TO_NAME(UndefinedType)
1324
+ ENUM_TO_NAME(BilevelType)
1325
+ ENUM_TO_NAME(GrayscaleType)
1326
+ ENUM_TO_NAME(GrayscaleMatteType)
1327
+ ENUM_TO_NAME(PaletteType)
1328
+ ENUM_TO_NAME(PaletteMatteType)
1329
+ ENUM_TO_NAME(TrueColorType)
1330
+ ENUM_TO_NAME(TrueColorMatteType)
1331
+ ENUM_TO_NAME(ColorSeparationType)
1332
+ ENUM_TO_NAME(ColorSeparationMatteType)
1333
+ ENUM_TO_NAME(OptimizeType)
1428
1334
  }
1429
1335
 
1430
- return rm_enum_new(Class_EndianType, ID2SYM(rb_intern(name)), INT2FIX(type));
1431
1336
  }
1432
1337
 
1433
1338
 
@@ -1440,47 +1345,30 @@ ImageType_new(ImageType type)
1440
1345
  {
1441
1346
  const char *name;
1442
1347
 
1443
- switch(type)
1348
+ name = ImageType_name(type);
1349
+ return rm_enum_new(Class_ImageType, ID2SYM(rb_intern(name)), INT2FIX(type));
1350
+ }
1351
+
1352
+
1353
+ /*
1354
+ Static: InterlaceType_name
1355
+ Purpose: Return the name of a InterlaceType enum as a string
1356
+ */
1357
+ static const char *
1358
+ InterlaceType_name(interlace)
1359
+ {
1360
+ switch(interlace)
1444
1361
  {
1445
1362
  default:
1446
- case UndefinedType:
1447
- name = "UndefinedType";
1448
- break;
1449
- case BilevelType:
1450
- name = "BilevelType";
1451
- break;
1452
- case GrayscaleType:
1453
- name = "GrayscaleType";
1454
- break;
1455
- case GrayscaleMatteType:
1456
- name = "GrayscaleMatteType";
1457
- break;
1458
- case PaletteType:
1459
- name = "PaletteType";
1460
- break;
1461
- case PaletteMatteType:
1462
- name = "PaletteMatteType";
1463
- break;
1464
- case TrueColorType:
1465
- name = "TrueColorType";
1466
- break;
1467
- case TrueColorMatteType:
1468
- name = "TrueColorMatteType";
1469
- break;
1470
- case ColorSeparationType:
1471
- name = "ColorSeparationType";
1472
- break;
1473
- case ColorSeparationMatteType:
1474
- name = "ColorSeparationMatteType";
1475
- break;
1476
- case OptimizeType:
1477
- name = "OptimizeType";
1478
- break;
1363
+ ENUM_TO_NAME(UndefinedInterlace)
1364
+ ENUM_TO_NAME(NoInterlace)
1365
+ ENUM_TO_NAME(LineInterlace)
1366
+ ENUM_TO_NAME(PlaneInterlace)
1367
+ ENUM_TO_NAME(PartitionInterlace)
1479
1368
  }
1480
-
1481
- return rm_enum_new(Class_ImageType, ID2SYM(rb_intern(name)), INT2FIX(type));
1482
1369
  }
1483
1370
 
1371
+
1484
1372
  /*
1485
1373
  External: InterlaceType_new
1486
1374
  Purpose: Construct an InterlaceType enum object for the specified value.
@@ -1490,29 +1378,33 @@ InterlaceType_new(InterlaceType interlace)
1490
1378
  {
1491
1379
  const char *name;
1492
1380
 
1493
- switch(interlace)
1381
+ name = InterlaceType_name(interlace);
1382
+ return rm_enum_new(Class_InterlaceType, ID2SYM(rb_intern(name)), INT2FIX(interlace));
1383
+ }
1384
+
1385
+
1386
+
1387
+ /*
1388
+ Static: RenderingIntent_name
1389
+ Purpose: Return the name of a RenderingIntent enum as a string
1390
+ */
1391
+ static const char *
1392
+ RenderingIntent_name(intent)
1393
+ {
1394
+ switch(intent)
1494
1395
  {
1495
1396
  default:
1496
- case UndefinedInterlace:
1497
- name = "UndefinedInterlace";
1498
- break;
1499
- case NoInterlace:
1500
- name = "NoInterlace";
1501
- break;
1502
- case LineInterlace:
1503
- name = "LineInterlace";
1504
- break;
1505
- case PlaneInterlace:
1506
- name = "PlaneInterlace";
1507
- break;
1508
- case PartitionInterlace:
1509
- name = "PartitionInterlace";
1510
- break;
1397
+ ENUM_TO_NAME(UndefinedIntent)
1398
+ ENUM_TO_NAME(SaturationIntent)
1399
+ ENUM_TO_NAME(PerceptualIntent)
1400
+ ENUM_TO_NAME(AbsoluteIntent)
1401
+ ENUM_TO_NAME(RelativeIntent)
1511
1402
  }
1512
1403
 
1513
- return rm_enum_new(Class_InterlaceType, ID2SYM(rb_intern(name)), INT2FIX(interlace));
1514
1404
  }
1515
1405
 
1406
+
1407
+
1516
1408
  /*
1517
1409
  External: RenderingIntent_new
1518
1410
  Purpose: Construct an RenderingIntent enum object for the specified value.
@@ -1522,29 +1414,29 @@ RenderingIntent_new(RenderingIntent intent)
1522
1414
  {
1523
1415
  const char *name;
1524
1416
 
1525
- switch(intent)
1417
+ name = RenderingIntent_name(intent);
1418
+ return rm_enum_new(Class_RenderingIntent, ID2SYM(rb_intern(name)), INT2FIX(intent));
1419
+ }
1420
+
1421
+
1422
+ /*
1423
+ Static: ResolutionType_name
1424
+ Purpose: Return the name of a ResolutionType enum as a string
1425
+ */
1426
+ static const char *
1427
+ ResolutionType_name(type)
1428
+ {
1429
+ switch(type)
1526
1430
  {
1527
1431
  default:
1528
- case UndefinedIntent:
1529
- name = "UndefinedIntent";
1530
- break;
1531
- case SaturationIntent:
1532
- name = "SaturationIntent";
1533
- break;
1534
- case PerceptualIntent:
1535
- name = "PerceptualIntent";
1536
- break;
1537
- case AbsoluteIntent:
1538
- name = "AbsoluteIntent";
1539
- break;
1540
- case RelativeIntent:
1541
- name = "RelativeIntent";
1542
- break;
1432
+ ENUM_TO_NAME(UndefinedResolution)
1433
+ ENUM_TO_NAME(PixelsPerInchResolution)
1434
+ ENUM_TO_NAME(PixelsPerCentimeterResolution)
1543
1435
  }
1544
1436
 
1545
- return rm_enum_new(Class_RenderingIntent, ID2SYM(rb_intern(name)), INT2FIX(intent));
1546
1437
  }
1547
1438
 
1439
+
1548
1440
  /*
1549
1441
  External: ResolutionType_new
1550
1442
  Purpose: Construct an ResolutionType enum object for the specified value.
@@ -1554,66 +1446,51 @@ ResolutionType_new(ResolutionType type)
1554
1446
  {
1555
1447
  const char *name;
1556
1448
 
1449
+ name = ResolutionType_name(type);
1450
+ return rm_enum_new(Class_ResolutionType, ID2SYM(rb_intern(name)), INT2FIX(type));
1451
+ }
1452
+
1453
+
1454
+
1455
+ #if defined(HAVE_IMAGE_ORIENTATION)
1456
+ /*
1457
+ Static: OrientationType_name
1458
+ Purpose: Return the name of a OrientationType enum as a string
1459
+ */
1460
+ static const char *
1461
+ OrientationType_name(type)
1462
+ {
1557
1463
  switch(type)
1558
1464
  {
1559
1465
  default:
1560
- case UndefinedResolution:
1561
- name = "UndefinedResolution";
1562
- break;
1563
- case PixelsPerInchResolution:
1564
- name = "PixelsPerInchResolution";
1565
- break;
1566
- case PixelsPerCentimeterResolution:
1567
- name = "PixelsPerCentimeterResolution";
1568
- break;
1466
+ ENUM_TO_NAME(UndefinedOrientation)
1467
+ ENUM_TO_NAME(TopLeftOrientation)
1468
+ ENUM_TO_NAME(TopRightOrientation)
1469
+ ENUM_TO_NAME(BottomRightOrientation)
1470
+ ENUM_TO_NAME(BottomLeftOrientation)
1471
+ ENUM_TO_NAME(LeftTopOrientation)
1472
+ ENUM_TO_NAME(RightTopOrientation)
1473
+ ENUM_TO_NAME(RightBottomOrientation)
1474
+ ENUM_TO_NAME(LeftBottomOrientation)
1569
1475
  }
1570
- return rm_enum_new(Class_ResolutionType, ID2SYM(rb_intern(name)), INT2FIX(type));
1571
1476
  }
1572
1477
 
1478
+
1573
1479
  /*
1574
1480
  External: OrientationType_new
1575
1481
  Purpose: Construct an OrientationType enum object for the specified value.
1576
1482
  */
1577
- #if defined(HAVE_IMAGE_ORIENTATION)
1578
1483
  VALUE
1579
1484
  OrientationType_new(OrientationType type)
1580
1485
  {
1581
1486
  const char *name;
1582
1487
 
1583
- switch(type)
1584
- {
1585
- default:
1586
- case UndefinedOrientation:
1587
- name = "UndefinedOrientation";
1588
- break;
1589
- case TopLeftOrientation:
1590
- name = "TopLeftOrientation";
1591
- break;
1592
- case TopRightOrientation:
1593
- name = "TopRightOrientation";
1594
- break;
1595
- case BottomRightOrientation:
1596
- name = "BottomRightOrientation";
1597
- break;
1598
- case BottomLeftOrientation:
1599
- name = "BottomLeftOrientation";
1600
- break;
1601
- case LeftTopOrientation:
1602
- name = "LeftTopOrientation";
1603
- break;
1604
- case RightTopOrientation:
1605
- name = "RightTopOrientation";
1606
- break;
1607
- case RightBottomOrientation:
1608
- name = "RightBottomOrientation";
1609
- break;
1610
- case LeftBottomOrientation:
1611
- name = "LeftBottomOrientation";
1612
- break;
1613
- }
1488
+ name = OrientationType_name(type);
1614
1489
  return rm_enum_new(Class_OrientationType, ID2SYM(rb_intern(name)), INT2FIX(type));
1615
1490
  }
1616
1491
  #endif
1492
+
1493
+
1617
1494
  /*
1618
1495
  External: Color_from_ColorInfo
1619
1496
  Purpose: Convert a ColorInfo structure to a Magick::Color
@@ -1700,7 +1577,7 @@ Color_to_s(VALUE self)
1700
1577
  sprintf(buff, "name=%s, compliance=%s, "
1701
1578
  "color.red=%d, color.green=%d, color.blue=%d, color.opacity=%d ",
1702
1579
  ci.name,
1703
- Compliance_Const_Name(&ci.compliance),
1580
+ Compliance_name(&ci.compliance),
1704
1581
  ci.color.red, ci.color.green, ci.color.blue, ci.color.opacity);
1705
1582
 
1706
1583
  destroy_ColorInfo(&ci);
@@ -2018,7 +1895,7 @@ StyleType_new(StyleType style)
2018
1895
  {
2019
1896
  const char *name;
2020
1897
 
2021
- name = StyleType_Const_Name(style);
1898
+ name = StyleType_name(style);
2022
1899
  return rm_enum_new(Class_StyleType, ID2SYM(rb_intern(name)), INT2FIX(style));
2023
1900
  }
2024
1901
 
@@ -2150,7 +2027,7 @@ Font_to_s(VALUE self)
2150
2027
  ti.name,
2151
2028
  ti.description,
2152
2029
  ti.family,
2153
- StyleType_Const_Name(ti.style),
2030
+ StyleType_name(ti.style),
2154
2031
  StretchType_name(ti.stretch),
2155
2032
  weight,
2156
2033
  ti.encoding ? ti.encoding : "",
@@ -2253,6 +2130,43 @@ TypeMetric_to_s(VALUE self)
2253
2130
  }
2254
2131
 
2255
2132
 
2133
+
2134
+ /*
2135
+ Static: VirtualPixelMethod_name
2136
+ Purpose: Return the string representation of a VirtualPixelMethod value
2137
+ */
2138
+ static const char *
2139
+ VirtualPixelMethod_name(VirtualPixelMethod method)
2140
+ {
2141
+ switch (method)
2142
+ {
2143
+ default:
2144
+ ENUM_TO_NAME(UndefinedVirtualPixelMethod)
2145
+ ENUM_TO_NAME(EdgeVirtualPixelMethod)
2146
+ ENUM_TO_NAME(MirrorVirtualPixelMethod)
2147
+ ENUM_TO_NAME(TileVirtualPixelMethod)
2148
+ #if defined(HAVE_TRANSPARENTVIRTUALPIXELMETHOD)
2149
+ ENUM_TO_NAME(TransparentVirtualPixelMethod)
2150
+ ENUM_TO_NAME(BackgroundVirtualPixelMethod)
2151
+ #endif
2152
+ }
2153
+ }
2154
+
2155
+
2156
+ /*
2157
+ Static: VirtualPixelMethod_new
2158
+ Purpose: Construct a VirtualPixelMethod enum for a specified VirtualPixelMethod value
2159
+ */
2160
+ VALUE
2161
+ VirtualPixelMethod_new(VirtualPixelMethod style)
2162
+ {
2163
+ const char *name;
2164
+
2165
+ name = VirtualPixelMethod_name(style);
2166
+ return rm_enum_new(Class_VirtualPixelMethod, ID2SYM(rb_intern(name)), INT2FIX(style));
2167
+ }
2168
+
2169
+
2256
2170
  /*
2257
2171
  * Extern: rm_define_enum_type
2258
2172
  * Purpose: set up a subclass of Enum
@@ -2483,14 +2397,14 @@ static VALUE Enum_type_values(VALUE class)
2483
2397
 
2484
2398
 
2485
2399
  /*
2486
- Static: Compliance_Const_Name
2400
+ Static: Compliance_name
2487
2401
  Purpose: Return the string representation of a ComplianceType value
2488
2402
  Notes: xMagick will OR multiple compliance types so we have to
2489
2403
  arbitrarily pick one name. Set the compliance argument
2490
2404
  to the selected value.
2491
2405
  */
2492
2406
  static const char *
2493
- Compliance_Const_Name(ComplianceType *c)
2407
+ Compliance_name(ComplianceType *c)
2494
2408
  {
2495
2409
  if ((*c & (SVGCompliance|X11Compliance|XPMCompliance))
2496
2410
  == (SVGCompliance|X11Compliance|XPMCompliance))
@@ -2588,40 +2502,20 @@ Statistics_new(ImageStatistics *stats)
2588
2502
  const char *
2589
2503
  StorageType_name(StorageType type)
2590
2504
  {
2591
- const char *name;
2592
-
2593
2505
  switch (type)
2594
2506
  {
2595
2507
  default:
2596
- case UndefinedPixel:
2597
- name = "UndefinedPixel";
2598
- break;
2599
- case CharPixel:
2600
- name = "CharPixel";
2601
- break;
2602
- case DoublePixel:
2603
- name = "DoublePixel";
2604
- break;
2605
- case FloatPixel:
2606
- name = "FloatPixel";
2607
- break;
2608
- case IntegerPixel:
2609
- name = "IntegerPixel";
2610
- break;
2611
- case LongPixel:
2612
- name = "LongPixel";
2613
- break;
2508
+ ENUM_TO_NAME(UndefinedPixel)
2509
+ ENUM_TO_NAME(CharPixel)
2510
+ ENUM_TO_NAME(DoublePixel)
2511
+ ENUM_TO_NAME(FloatPixel)
2512
+ ENUM_TO_NAME(IntegerPixel)
2513
+ ENUM_TO_NAME(LongPixel)
2614
2514
  #if defined(HAVE_QUANTUMPIXEL)
2615
- case QuantumPixel:
2616
- name = "QuantumPixel";
2617
- break;
2515
+ ENUM_TO_NAME(QuantumPixel)
2618
2516
  #endif
2619
- case ShortPixel:
2620
- name = "ShortPixel";
2621
- break;
2517
+ ENUM_TO_NAME(ShortPixel)
2622
2518
  }
2623
-
2624
- return name;
2625
2519
  }
2626
2520
 
2627
2521
  /*
@@ -2633,51 +2527,37 @@ StretchType_name(StretchType stretch)
2633
2527
  {
2634
2528
  switch (stretch)
2635
2529
  {
2636
- case NormalStretch:
2637
- return "NormalStretch";
2638
- case UltraCondensedStretch:
2639
- return "UltraCondensedStretch";
2640
- case ExtraCondensedStretch:
2641
- return "ExtraCondensedStretch";
2642
- case CondensedStretch:
2643
- return "CondensedStretch";
2644
- case SemiCondensedStretch:
2645
- return "SemiCondensedStretch";
2646
- case SemiExpandedStretch:
2647
- return "SemiExpandedStretch";
2648
- case ExpandedStretch:
2649
- return "ExpandedStretch";
2650
- case ExtraExpandedStretch:
2651
- return "ExtraExpandedStretch";
2652
- case UltraExpandedStretch:
2653
- return "UltraExpandedStretch";
2654
- case AnyStretch:
2655
- return "AnyStretch";
2656
2530
  default:
2657
- return "unknown";
2531
+ ENUM_TO_NAME(UndefinedStretch)
2532
+ ENUM_TO_NAME(NormalStretch)
2533
+ ENUM_TO_NAME(UltraCondensedStretch)
2534
+ ENUM_TO_NAME(ExtraCondensedStretch)
2535
+ ENUM_TO_NAME(CondensedStretch)
2536
+ ENUM_TO_NAME(SemiCondensedStretch)
2537
+ ENUM_TO_NAME(SemiExpandedStretch)
2538
+ ENUM_TO_NAME(ExpandedStretch)
2539
+ ENUM_TO_NAME(ExtraExpandedStretch)
2540
+ ENUM_TO_NAME(UltraExpandedStretch)
2541
+ ENUM_TO_NAME(AnyStretch)
2658
2542
  }
2659
2543
  }
2660
2544
 
2661
2545
 
2662
2546
  /*
2663
- Static: StyleType_Const_Name
2547
+ Static: StyleType_name
2664
2548
  Purpose: Return the string representation of a StyleType value
2665
2549
  */
2666
2550
  static const char *
2667
- StyleType_Const_Name(StyleType style)
2551
+ StyleType_name(StyleType style)
2668
2552
  {
2669
2553
  switch (style)
2670
2554
  {
2671
- case NormalStyle:
2672
- return "NormalStyle";
2673
- case ItalicStyle:
2674
- return "ItalicStyle";
2675
- case ObliqueStyle:
2676
- return "ObliqueStyle";
2677
- case AnyStyle:
2678
- return "AnyStyle";
2555
+ ENUM_TO_NAME(NormalStyle)
2556
+ ENUM_TO_NAME(ItalicStyle)
2557
+ ENUM_TO_NAME(ObliqueStyle)
2558
+ ENUM_TO_NAME(AnyStyle)
2679
2559
  default:
2680
- return "unknown";
2560
+ ENUM_TO_NAME(UndefinedStyle)
2681
2561
  }
2682
2562
  }
2683
2563
 
@@ -2940,12 +2820,12 @@ rm_handle_error(ExceptionInfo *ex)
2940
2820
  if (ex->reason)
2941
2821
  {
2942
2822
  strncpy(reason, ex->reason, RM_MAX_ERROR_CLAUSE);
2943
- reason[250] = '\0';
2823
+ reason[RM_MAX_ERROR_CLAUSE] = '\0';
2944
2824
  }
2945
2825
  if (ex->description)
2946
2826
  {
2947
2827
  strncpy(desc, ex->description, RM_MAX_ERROR_CLAUSE);
2948
- desc[250] = '\0';
2828
+ desc[RM_MAX_ERROR_CLAUSE] = '\0';
2949
2829
  }
2950
2830
 
2951
2831
  #if defined(HAVE_EXCEPTIONINFO_MODULE)
@@ -2955,12 +2835,12 @@ rm_handle_error(ExceptionInfo *ex)
2955
2835
  if (ex->module)
2956
2836
  {
2957
2837
  strncpy(module, ex->module, RM_MAX_ERROR_CLAUSE);
2958
- module[250] = '\0';
2838
+ module[RM_MAX_ERROR_CLAUSE] = '\0';
2959
2839
  }
2960
2840
  if (ex->function)
2961
2841
  {
2962
2842
  strncpy(function, ex->function, RM_MAX_ERROR_CLAUSE);
2963
- function[250] = '\0';
2843
+ function[RM_MAX_ERROR_CLAUSE] = '\0';
2964
2844
  }
2965
2845
  line = ex->line;
2966
2846
  #endif