rmagick 1.13.0 → 1.14.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.

Files changed (48) hide show
  1. data/ChangeLog +34 -0
  2. data/README.html +12 -29
  3. data/README.txt +10 -26
  4. data/configure +768 -73
  5. data/configure.ac +29 -26
  6. data/doc/comtasks.html +3 -4
  7. data/doc/constants.html +85 -67
  8. data/doc/draw.html +22 -0
  9. data/doc/ex/dissolve.rb +13 -0
  10. data/doc/ex/edge.rb +1 -1
  11. data/doc/ex/mask.rb +37 -0
  12. data/doc/ex/sketch.rb +25 -0
  13. data/doc/ex/watermark.rb +23 -0
  14. data/doc/ilist.html +11 -13
  15. data/doc/image1.html +601 -52
  16. data/doc/image2.html +637 -28
  17. data/doc/image3.html +339 -54
  18. data/doc/imageattrs.html +211 -41
  19. data/doc/imusage.html +41 -2
  20. data/doc/index.html +8 -6
  21. data/doc/info.html +57 -42
  22. data/doc/optequiv.html +1919 -0
  23. data/doc/rvg.html +45 -42
  24. data/doc/scripts/doc.js +14 -1
  25. data/doc/scripts/stripeTables.js +23 -0
  26. data/doc/usage.html +66 -15
  27. data/{doc/ex → examples}/demo.rb +0 -0
  28. data/examples/find_similar_region.rb +34 -0
  29. data/examples/import_export.rb +1 -1
  30. data/examples/pattern_fill.rb +2 -2
  31. data/examples/rotating_text.rb +2 -4
  32. data/examples/thumbnail.rb +1 -1
  33. data/ext/RMagick/MANIFEST +9 -4
  34. data/ext/RMagick/extconf.rb.in +1 -1
  35. data/ext/RMagick/rmagick.h +47 -10
  36. data/ext/RMagick/rmagick_config.h.in +24 -0
  37. data/ext/RMagick/rmdraw.c +32 -7
  38. data/ext/RMagick/rmilist.c +55 -37
  39. data/ext/RMagick/rmimage.c +1588 -447
  40. data/ext/RMagick/rminfo.c +94 -3
  41. data/ext/RMagick/rmmain.c +68 -7
  42. data/ext/RMagick/rmutil.c +67 -9
  43. data/lib/RMagick.rb +190 -53
  44. data/lib/rvg/stretchable.rb +17 -13
  45. data/rmagick.gemspec +1 -1
  46. metadata +11 -6
  47. data/doc/ex/level_channel.rb +0 -33
  48. data/doc/ex/opaque.rb +0 -14
@@ -1,4 +1,4 @@
1
- /* $Id: rminfo.c,v 1.38 2006/05/27 21:05:59 rmagick Exp $ */
1
+ /* $Id: rminfo.c,v 1.42 2006/09/16 19:15:03 rmagick Exp $ */
2
2
  /*============================================================================\
3
3
  | Copyright (C) 2006 by Timothy P. Hunter
4
4
  | Name: rminfo.c
@@ -261,6 +261,39 @@ Info_border_color_eq(VALUE self, VALUE bc_arg)
261
261
  return self;
262
262
  }
263
263
 
264
+
265
+
266
+ /*
267
+ Method: Info#channel(channel [, channel...])
268
+ Purpose: Set the channels
269
+ Thanks: Douglas Sellers
270
+ */
271
+ VALUE
272
+ Info_channel(int argc, VALUE *argv, VALUE self)
273
+ {
274
+ #if defined(HAVE_IMAGEINFO_CHANNEL)
275
+ Info *info;
276
+ ChannelType channels;
277
+
278
+ channels = extract_channels(&argc, argv);
279
+
280
+ // Ensure all arguments consumed.
281
+ if (argc > 0)
282
+ {
283
+ raise_ChannelType_error(argv[argc-1]);
284
+ }
285
+
286
+ Data_Get_Struct(self, Info, info);
287
+
288
+ info->channel = channels;
289
+ return self;
290
+ #else
291
+ rm_not_implemented();
292
+ return (VALUE)0;
293
+ #endif
294
+ }
295
+
296
+
264
297
  /*
265
298
  Method: Info#colorspace
266
299
  Purpose: Get the colorspace type
@@ -1512,6 +1545,43 @@ Info_size_eq(VALUE self, VALUE size_arg)
1512
1545
  }
1513
1546
 
1514
1547
 
1548
+ /*
1549
+ Method: Image::Info#texture=texture_image
1550
+ Purpose: Set name of texture to tile onto the image background
1551
+ */
1552
+ VALUE
1553
+ Info_texture_eq(VALUE self, VALUE texture)
1554
+ {
1555
+ Info *info;
1556
+ Image *image;
1557
+ char name[MaxTextExtent];
1558
+
1559
+ Data_Get_Struct(self, Info, info);
1560
+
1561
+ // Delete any existing texture file
1562
+ if (info->texture)
1563
+ {
1564
+ rm_delete_temp_image(info->texture);
1565
+ magick_free(info->texture);
1566
+ info->texture = NULL;
1567
+ }
1568
+
1569
+ // If argument is nil we're done
1570
+ if (texture == Qnil)
1571
+ {
1572
+ return self;
1573
+ }
1574
+
1575
+ // Create a temp copy of the texture and store its name in the texture field
1576
+ Data_Get_Struct(texture, Image, image);
1577
+ rm_write_temp_image(image, name);
1578
+
1579
+ magick_clone_string(&info->texture, name);
1580
+
1581
+ return self;
1582
+ }
1583
+
1584
+
1515
1585
  /*
1516
1586
  Method: Info#undefine
1517
1587
  Purpose: Undefine image option
@@ -1628,6 +1698,27 @@ Info_view_eq(VALUE self, VALUE view_arg)
1628
1698
  return self;
1629
1699
  }
1630
1700
 
1701
+
1702
+ /*
1703
+ Static: destroy_Info
1704
+ Purpose: if there is a texture image, delete it before destroying
1705
+ the ImageInfo structure
1706
+ */
1707
+ static void
1708
+ destroy_Info(void *infoptr)
1709
+ {
1710
+ Info *info = (Info *)infoptr;
1711
+
1712
+ if (info->texture)
1713
+ {
1714
+ rm_delete_temp_image(info->texture);
1715
+ magick_free(info->texture);
1716
+ info->texture = NULL;
1717
+ }
1718
+
1719
+ DestroyImageInfo(info);
1720
+ }
1721
+
1631
1722
  /*
1632
1723
  Method: Info.new
1633
1724
  Purpose: Create an Info object by calling CloneInfo
@@ -1644,7 +1735,7 @@ Info_new(VALUE class)
1644
1735
  {
1645
1736
  rb_raise(rb_eNoMemError, "not enough memory to initialize Info object");
1646
1737
  }
1647
- new_obj = Data_Wrap_Struct(class, NULL, DestroyImageInfo, info);
1738
+ new_obj = Data_Wrap_Struct(class, NULL, destroy_Info, info);
1648
1739
  rb_obj_call_init(new_obj, 0, NULL);
1649
1740
  return new_obj;
1650
1741
  }
@@ -1676,7 +1767,7 @@ Info_alloc(VALUE class)
1676
1767
  {
1677
1768
  rb_raise(rb_eNoMemError, "not enough memory to initialize Info object");
1678
1769
  }
1679
- info_obj = Data_Wrap_Struct(class, NULL, DestroyImageInfo, info);
1770
+ info_obj = Data_Wrap_Struct(class, NULL, destroy_Info, info);
1680
1771
  return info_obj;
1681
1772
  }
1682
1773
  /*
@@ -1,4 +1,4 @@
1
- /* $Id: rmmain.c,v 1.124 2006/06/26 23:32:37 rmagick Exp $ */
1
+ /* $Id: rmmain.c,v 1.146 2006/09/27 21:26:35 rmagick Exp $ */
2
2
  /*============================================================================\
3
3
  | Copyright (C) 2006 by Timothy P. Hunter
4
4
  | Name: rmmain.c
@@ -670,11 +670,12 @@ Init_RMagick(void)
670
670
  DCL_ATTR_READER(Image, base_columns)
671
671
  DCL_ATTR_READER(Image, base_filename)
672
672
  DCL_ATTR_READER(Image, base_rows)
673
+ DCL_ATTR_ACCESSOR(Image, bias)
674
+ DCL_ATTR_ACCESSOR(Image, black_point_compensation)
673
675
  DCL_ATTR_ACCESSOR(Image, blur)
674
676
  DCL_ATTR_ACCESSOR(Image, border_color)
675
677
  DCL_ATTR_READER(Image, bounding_box)
676
678
  DCL_ATTR_ACCESSOR(Image, chromaticity)
677
- DCL_ATTR_WRITER(Image, clip_mask)
678
679
  DCL_ATTR_ACCESSOR(Image, color_profile)
679
680
  DCL_ATTR_READER(Image, colors)
680
681
  DCL_ATTR_ACCESSOR(Image, colorspace)
@@ -699,6 +700,7 @@ Init_RMagick(void)
699
700
  DCL_ATTR_ACCESSOR(Image, interlace)
700
701
  DCL_ATTR_ACCESSOR(Image, iptc_profile)
701
702
  DCL_ATTR_ACCESSOR(Image, iterations) // do not document! Only used by Image#iterations=
703
+ DCL_ATTR_ACCESSOR(Image, mask)
702
704
  DCL_ATTR_ACCESSOR(Image, matte)
703
705
  DCL_ATTR_ACCESSOR(Image, matte_color)
704
706
  DCL_ATTR_READER(Image, mean_error_per_pixel)
@@ -712,6 +714,7 @@ Init_RMagick(void)
712
714
  DCL_ATTR_WRITER(Image, opacity)
713
715
  DCL_ATTR_ACCESSOR(Image, orientation)
714
716
  DCL_ATTR_ACCESSOR(Image, page)
717
+ DCL_ATTR_ACCESSOR(Image, pixel_interpolation_method)
715
718
  #if defined(HAVE_IMAGE_QUALITY)
716
719
  DCL_ATTR_READER(Image, quality)
717
720
  #endif
@@ -724,16 +727,21 @@ Init_RMagick(void)
724
727
  DCL_ATTR_ACCESSOR(Image, ticks_per_second)
725
728
  DCL_ATTR_ACCESSOR(Image, tile_info)
726
729
  DCL_ATTR_READER(Image, total_colors)
730
+ DCL_ATTR_ACCESSOR(Image, transparent_color)
727
731
  DCL_ATTR_ACCESSOR(Image, units)
728
732
  DCL_ATTR_ACCESSOR(Image, virtual_pixel_method)
729
733
  DCL_ATTR_ACCESSOR(Image, x_resolution)
730
734
  DCL_ATTR_ACCESSOR(Image, y_resolution)
731
735
 
736
+ rb_define_method(Class_Image, "adaptive_blur", Image_adaptive_blur, -1);
737
+ rb_define_method(Class_Image, "adaptive_blur_channel", Image_adaptive_blur_channel, -1);
738
+ rb_define_method(Class_Image, "adaptive_resize", Image_adaptive_resize, -1);
732
739
  rb_define_method(Class_Image, "adaptive_sharpen", Image_adaptive_sharpen, -1);
733
740
  rb_define_method(Class_Image, "adaptive_sharpen_channel", Image_adaptive_sharpen_channel, -1);
734
741
  rb_define_method(Class_Image, "adaptive_threshold", Image_adaptive_threshold, -1);
735
742
  rb_define_method(Class_Image, "add_noise", Image_add_noise, 1);
736
743
  rb_define_method(Class_Image, "add_noise_channel", Image_add_noise_channel, -1);
744
+ rb_define_method(Class_Image, "add_profile", Image_add_profile, 1);
737
745
  rb_define_method(Class_Image, "affine_transform", Image_affine_transform, 1);
738
746
  rb_define_method(Class_Image, "[]", Image_aref, 1);
739
747
  rb_define_method(Class_Image, "[]=", Image_aset, 2);
@@ -742,6 +750,7 @@ Init_RMagick(void)
742
750
  rb_define_method(Class_Image, "properties", Image_properties, 0);
743
751
  rb_define_method(Class_Image, "bilevel_channel", Image_bilevel_channel, -1);
744
752
  rb_define_method(Class_Image, "black_threshold", Image_black_threshold, -1);
753
+ rb_define_method(Class_Image, "blend", Image_blend, -1);
745
754
  rb_define_method(Class_Image, "blur_image", Image_blur_image, -1);
746
755
  rb_define_method(Class_Image, "blur_channel", Image_blur_channel, -1);
747
756
  rb_define_method(Class_Image, "border", Image_border, 3);
@@ -778,10 +787,13 @@ Init_RMagick(void)
778
787
  rb_define_method(Class_Image, "crop", Image_crop, -1);
779
788
  rb_define_method(Class_Image, "crop!", Image_crop_bang, -1);
780
789
  rb_define_method(Class_Image, "cycle_colormap", Image_cycle_colormap, 1);
790
+ rb_define_method(Class_Image, "delete_profile", Image_delete_profile, 1);
781
791
  rb_define_method(Class_Image, "despeckle", Image_despeckle, 0);
782
792
  rb_define_method(Class_Image, "difference", Image_difference, 1);
783
793
  rb_define_method(Class_Image, "dispatch", Image_dispatch, -1);
794
+ rb_define_method(Class_Image, "displace", Image_displace, -1);
784
795
  rb_define_method(Class_Image, "display", Image_display, 0);
796
+ rb_define_method(Class_Image, "dissolve", Image_dissolve, -1);
785
797
  rb_define_method(Class_Image, "distortion_channel", Image_distortion_channel, -1);
786
798
  rb_define_method(Class_Image, "_dump", Image__dump, 1);
787
799
  rb_define_method(Class_Image, "dup", Image_dup, 0);
@@ -793,6 +805,7 @@ Init_RMagick(void)
793
805
  rb_define_method(Class_Image, "erase!", Image_erase_bang, 0);
794
806
  rb_define_method(Class_Image, "export_pixels", Image_export_pixels, -1);
795
807
  rb_define_method(Class_Image, "export_pixels_to_str", Image_export_pixels_to_str, -1);
808
+ rb_define_method(Class_Image, "find_similar_region", Image_find_similar_region, -1);
796
809
  rb_define_method(Class_Image, "flip", Image_flip, 0);
797
810
  rb_define_method(Class_Image, "flip!", Image_flip_bang, 0);
798
811
  rb_define_method(Class_Image, "flop", Image_flop, 0);
@@ -821,7 +834,7 @@ Init_RMagick(void)
821
834
  rb_define_method(Class_Image, "minify!", Image_minify_bang, 0);
822
835
  rb_define_method(Class_Image, "modulate", Image_modulate, -1);
823
836
  rb_define_method(Class_Image, "monochrome?", Image_monochrome_q, 0);
824
- rb_define_method(Class_Image, "motion_blur", Image_motion_blur, 3);
837
+ rb_define_method(Class_Image, "motion_blur", Image_motion_blur, -1);
825
838
  rb_define_method(Class_Image, "negate", Image_negate, -1);
826
839
  rb_define_method(Class_Image, "negate_channel", Image_negate_channel, -1);
827
840
  rb_define_method(Class_Image, "normalize", Image_normalize, 0);
@@ -847,8 +860,8 @@ Init_RMagick(void)
847
860
  rb_define_method(Class_Image, "resize", Image_resize, -1);
848
861
  rb_define_method(Class_Image, "resize!", Image_resize_bang, -1);
849
862
  rb_define_method(Class_Image, "roll", Image_roll, 2);
850
- rb_define_method(Class_Image, "rotate", Image_rotate, 1);
851
- rb_define_method(Class_Image, "rotate!", Image_rotate_bang, 1);
863
+ rb_define_method(Class_Image, "rotate", Image_rotate, -1);
864
+ rb_define_method(Class_Image, "rotate!", Image_rotate_bang, -1);
852
865
  rb_define_method(Class_Image, "sample", Image_sample, -1);
853
866
  rb_define_method(Class_Image, "sample!", Image_sample_bang, -1);
854
867
  rb_define_method(Class_Image, "scale", Image_scale, -1);
@@ -865,6 +878,7 @@ Init_RMagick(void)
865
878
  rb_define_method(Class_Image, "shear", Image_shear, 2);
866
879
  rb_define_method(Class_Image, "sigmoidal_contrast_channel", Image_sigmoidal_contrast_channel, -1);
867
880
  rb_define_method(Class_Image, "signature", Image_signature, 0);
881
+ rb_define_method(Class_Image, "sketch", Image_sketch, -1);
868
882
  rb_define_method(Class_Image, "solarize", Image_solarize, -1);
869
883
  rb_define_method(Class_Image, "<=>", Image_spaceship, 1);
870
884
  rb_define_method(Class_Image, "splice", Image_splice, -1);
@@ -889,9 +903,11 @@ Init_RMagick(void)
889
903
  rb_define_method(Class_Image, "transverse!", Image_transverse_bang, 0);
890
904
  rb_define_method(Class_Image, "trim", Image_trim, 0);
891
905
  rb_define_method(Class_Image, "trim!", Image_trim_bang, 0);
906
+ rb_define_method(Class_Image, "unique_colors", Image_unique_colors, 0);
892
907
  rb_define_method(Class_Image, "unsharp_mask", Image_unsharp_mask, -1);
893
908
  rb_define_method(Class_Image, "unsharp_mask_channel", Image_unsharp_mask_channel, -1);
894
909
  rb_define_method(Class_Image, "vignette", Image_vignette, -1);
910
+ rb_define_method(Class_Image, "watermark", Image_watermark, -1);
895
911
  rb_define_method(Class_Image, "wave", Image_wave, -1);
896
912
  rb_define_method(Class_Image, "white_threshold", Image_white_threshold, -1);
897
913
  rb_define_method(Class_Image, "write", Image_write, 1);
@@ -915,7 +931,7 @@ Init_RMagick(void)
915
931
  rb_define_method(Class_ImageList, "deconstruct", ImageList_deconstruct, 0);
916
932
  rb_define_method(Class_ImageList, "display", ImageList_display, 0);
917
933
  rb_define_method(Class_ImageList, "flatten_images", ImageList_flatten_images, 0);
918
- rb_define_method(Class_ImageList, "map", ImageList_map, 2);
934
+ rb_define_method(Class_ImageList, "map", ImageList_map, -1);
919
935
  rb_define_method(Class_ImageList, "montage", ImageList_montage, 0);
920
936
  rb_define_method(Class_ImageList, "morph", ImageList_morph, 1);
921
937
  rb_define_method(Class_ImageList, "mosaic", ImageList_mosaic, 0);
@@ -953,6 +969,7 @@ Init_RMagick(void)
953
969
  DCL_ATTR_WRITER(Draw, stroke)
954
970
  DCL_ATTR_WRITER(Draw, stroke_width)
955
971
  DCL_ATTR_WRITER(Draw, text_antialias)
972
+ DCL_ATTR_WRITER(Draw, tile)
956
973
  DCL_ATTR_WRITER(Draw, undercolor)
957
974
 
958
975
  rb_define_method(Class_Draw, "annotate", Draw_annotate, 6);
@@ -1065,6 +1082,7 @@ Init_RMagick(void)
1065
1082
  #endif
1066
1083
 
1067
1084
  rb_define_method(Class_Info, "initialize", Info_initialize, 0);
1085
+ rb_define_method(Class_Info, "channel", Info_channel, -1);
1068
1086
  rb_define_method(Class_Info, "freeze", rm_no_freeze, 0);
1069
1087
  rb_define_method(Class_Info, "define", Info_define, -1);
1070
1088
  rb_define_method(Class_Info, "[]=", Info_aset, 3);
@@ -1107,6 +1125,7 @@ Init_RMagick(void)
1107
1125
  DCL_ATTR_ACCESSOR(Info, size)
1108
1126
  DCL_ATTR_ACCESSOR(Info, subimage) // deprecated >=5.5.6, replaced by scene
1109
1127
  DCL_ATTR_ACCESSOR(Info, subrange) // deprecated >=5.5.6, replaced by number_scenes
1128
+ DCL_ATTR_WRITER(Info, texture)
1110
1129
  DCL_ATTR_ACCESSOR(Info, tile) // deprecated >=5.5.6, replaced by extract and scenes
1111
1130
  DCL_ATTR_ACCESSOR(Info, image_type)
1112
1131
  DCL_ATTR_ACCESSOR(Info, units)
@@ -1205,6 +1224,8 @@ Init_RMagick(void)
1205
1224
  ENUMERATOR(BlueChannel)
1206
1225
  ENUMERATOR(YellowChannel)
1207
1226
  ENUMERATOR(OpacityChannel)
1227
+
1228
+
1208
1229
  ENUMERATOR(BlackChannel)
1209
1230
  ENUMERATOR(MatteChannel)
1210
1231
  #if defined(HAVE_INDEXCHANNEL)
@@ -1216,6 +1237,29 @@ Init_RMagick(void)
1216
1237
  #if defined(HAVE_ALLCHANNELS)
1217
1238
  ENUMERATOR(AllChannels)
1218
1239
  #endif
1240
+
1241
+ // Define alternate names for ChannelType enums for Image::Info#channel=
1242
+ // AlphaChannel == OpacityChannel
1243
+ _enum = rm_enum_new(Class_ChannelType, ID2SYM(rb_intern("AlphaChannel")), INT2FIX(OpacityChannel));
1244
+ rb_define_const(Module_Magick, "AlphaChannel", _enum);
1245
+
1246
+ // DefaultChannels
1247
+ _enum = rm_enum_new(Class_ChannelType, ID2SYM(rb_intern("DefaultChannels")), INT2FIX(0xff & ~OpacityChannel));
1248
+ rb_define_const(Module_Magick, "DefaultChannels", _enum);
1249
+
1250
+ // HueChannel == RedChannel
1251
+ _enum = rm_enum_new(Class_ChannelType, ID2SYM(rb_intern("HueChannel")), INT2FIX(RedChannel));
1252
+ rb_define_const(Module_Magick, "HueChannel", _enum);
1253
+
1254
+ // LuminosityChannel = BlueChannel
1255
+ _enum = rm_enum_new(Class_ChannelType, ID2SYM(rb_intern("LuminosityChannel")), INT2FIX(BlueChannel));
1256
+ rb_define_const(Module_Magick, "LuminosityChannel", _enum);
1257
+
1258
+ // SaturationChannel = GreenChannel
1259
+ _enum = rm_enum_new(Class_ChannelType, ID2SYM(rb_intern("SaturationChannel")), INT2FIX(GreenChannel));
1260
+ rb_define_const(Module_Magick, "SaturationChannel", _enum);
1261
+
1262
+
1219
1263
  END_ENUM
1220
1264
 
1221
1265
  // ClassType constants
@@ -1461,6 +1505,19 @@ Init_RMagick(void)
1461
1505
  ENUMERATOR(PartitionInterlace)
1462
1506
  END_ENUM
1463
1507
 
1508
+ #if defined(HAVE_INTERPOLATEPIXELCOLOR)
1509
+ DEF_ENUM(InterpolatePixelMethod)
1510
+ ENUMERATOR(UndefinedInterpolatePixel)
1511
+ ENUMERATOR(AverageInterpolatePixel)
1512
+ ENUMERATOR(BicubicInterpolatePixel)
1513
+ ENUMERATOR(BilinearInterpolatePixel)
1514
+ ENUMERATOR(FilterInterpolatePixel)
1515
+ ENUMERATOR(IntegerInterpolatePixel)
1516
+ ENUMERATOR(MeshInterpolatePixel)
1517
+ ENUMERATOR(NearestNeighborInterpolatePixel)
1518
+ END_ENUM
1519
+ #endif
1520
+
1464
1521
  #if defined(HAVE_COMPAREIMAGELAYERS)
1465
1522
  DEF_ENUM(MagickLayerMethod)
1466
1523
  ENUMERATOR(UndefinedLayer)
@@ -1563,6 +1620,10 @@ Init_RMagick(void)
1563
1620
  ENUMERATOR(AndQuantumOperator)
1564
1621
  ENUMERATOR(DivideQuantumOperator)
1565
1622
  ENUMERATOR(LShiftQuantumOperator)
1623
+ #if defined(HAVE_MAXEVALUATEOPERATOR)
1624
+ ENUMERATOR(MaxQuantumOperator)
1625
+ ENUMERATOR(MinQuantumOperator)
1626
+ #endif
1566
1627
  ENUMERATOR(MultiplyQuantumOperator)
1567
1628
  ENUMERATOR(OrQuantumOperator)
1568
1629
  ENUMERATOR(RShiftQuantumOperator)
@@ -1799,7 +1860,7 @@ static void version_constants(void)
1799
1860
  rb_define_const(Module_Magick, "Version", str);
1800
1861
 
1801
1862
  sprintf(long_version,
1802
- "This is %s ($Date: 2006/06/26 23:32:37 $) Copyright (C) 2006 by Timothy P. Hunter\n"
1863
+ "This is %s ($Date: 2006/09/27 21:26:35 $) Copyright (C) 2006 by Timothy P. Hunter\n"
1803
1864
  "Built with %s\n"
1804
1865
  "Built for %s\n"
1805
1866
  "Web page: http://rmagick.rubyforge.org\n"
@@ -1,4 +1,4 @@
1
- /* $Id: rmutil.c,v 1.78 2006/06/28 23:07:55 rmagick Exp $ */
1
+ /* $Id: rmutil.c,v 1.83 2006/09/27 21:26:36 rmagick Exp $ */
2
2
  /*============================================================================\
3
3
  | Copyright (C) 2006 by Timothy P. Hunter
4
4
  | Name: rmutil.c
@@ -574,8 +574,7 @@ Pixel_to_HSL(VALUE self)
574
574
  volatile VALUE hsl;
575
575
 
576
576
  Data_Get_Struct(self, Pixel, pixel);
577
- TransformHSL(pixel->red, pixel->green, pixel->blue,
578
- &hue, &saturation, &luminosity);
577
+ TransformHSL(pixel->red, pixel->green, pixel->blue, &hue, &saturation, &luminosity);
579
578
 
580
579
  hsl = rb_ary_new3(3, rb_float_new(hue), rb_float_new(saturation),
581
580
  rb_float_new(luminosity));
@@ -1076,6 +1075,27 @@ Color_Name_to_PixelPacket(PixelPacket *color, VALUE name_arg)
1076
1075
  }
1077
1076
  }
1078
1077
 
1078
+
1079
+ /*
1080
+ Extern: Pixel_from_MagickPixelPacket
1081
+ Purpose: Create a Magick::Pixel from a MagickPixelPacket structure
1082
+ */
1083
+ #if defined(HAVE_MAGICKPIXELPACKET)
1084
+ VALUE
1085
+ Pixel_from_MagickPixelPacket(MagickPixelPacket *mpp)
1086
+ {
1087
+ PixelPacket pixel;
1088
+
1089
+ pixel.red = RoundToQuantum(mpp->red);
1090
+ pixel.green = RoundToQuantum(mpp->green);
1091
+ pixel.blue = RoundToQuantum(mpp->blue);
1092
+ pixel.opacity = RoundToQuantum(mpp->opacity);
1093
+
1094
+ return Pixel_from_PixelPacket(&pixel);
1095
+ }
1096
+ #endif
1097
+
1098
+
1079
1099
  /*
1080
1100
  Extern: AffineMatrix_to_AffineMatrix
1081
1101
  Purpose: Convert a Magick::AffineMatrix object to a AffineMatrix structure.
@@ -1102,7 +1122,7 @@ AffineMatrix_to_AffineMatrix(AffineMatrix *am, VALUE st)
1102
1122
  am->sy = v == Qnil ? 1.0 : NUM2DBL(v);
1103
1123
  v = rb_ary_entry(values, 4);
1104
1124
  am->tx = v == Qnil ? 0.0 : NUM2DBL(v);
1105
- v = rb_ary_entry(values, 4);
1125
+ v = rb_ary_entry(values, 5);
1106
1126
  am->ty = v == Qnil ? 0.0 : NUM2DBL(v);
1107
1127
  }
1108
1128
 
@@ -1569,6 +1589,44 @@ InterlaceType_new(InterlaceType interlace)
1569
1589
  }
1570
1590
 
1571
1591
 
1592
+ /*
1593
+ Static: InterpolatePixelMethod_name
1594
+ Purpose: Return the name of a InterpolatePixelMethod enum as a string
1595
+ */
1596
+ #if defined(HAVE_INTERPOLATEPIXELCOLOR)
1597
+ static const char *
1598
+ InterpolatePixelMethod_name(InterpolatePixelMethod interpolate)
1599
+ {
1600
+ switch(interpolate)
1601
+ {
1602
+ default:
1603
+ ENUM_TO_NAME(UndefinedInterpolatePixel)
1604
+ ENUM_TO_NAME(AverageInterpolatePixel)
1605
+ ENUM_TO_NAME(BicubicInterpolatePixel)
1606
+ ENUM_TO_NAME(BilinearInterpolatePixel)
1607
+ ENUM_TO_NAME(FilterInterpolatePixel)
1608
+ ENUM_TO_NAME(IntegerInterpolatePixel)
1609
+ ENUM_TO_NAME(MeshInterpolatePixel)
1610
+ ENUM_TO_NAME(NearestNeighborInterpolatePixel)
1611
+ }
1612
+ }
1613
+
1614
+
1615
+ /*
1616
+ External: InterpolatePixelMethod_new
1617
+ Purpose: Construct an InterpolatePixelMethod enum object for the specified value.
1618
+ */
1619
+ VALUE
1620
+ InterpolatePixelMethod_new(InterpolatePixelMethod interpolate)
1621
+ {
1622
+ const char *name;
1623
+
1624
+ name = InterpolatePixelMethod_name(interpolate);
1625
+ return rm_enum_new(Class_InterpolatePixelMethod, ID2SYM(rb_intern(name)), INT2FIX(interpolate));
1626
+ }
1627
+ #endif
1628
+
1629
+
1572
1630
  /*
1573
1631
  External: MagickLayerMethod_new
1574
1632
  Purpose: Construct an MagickLayerMethod enum object for the specified value.
@@ -2860,15 +2918,15 @@ rm_not_implemented(void)
2860
2918
  }
2861
2919
 
2862
2920
  /*
2863
- Static: raise_error(msg, loc)
2921
+ Static: rm_magick_error(msg, loc)
2864
2922
  Purpose: create a new ImageMagickError object and raise an exception
2865
2923
  Notes: does not return
2866
2924
  This funky technique allows me to safely add additional
2867
2925
  information to the ImageMagickError object in both 1.6.8 and
2868
2926
  1.8.0. See www.ruby_talk.org/36408.
2869
2927
  */
2870
- static void
2871
- raise_error(const char *msg, const char *loc)
2928
+ void
2929
+ rm_magick_error(const char *msg, const char *loc)
2872
2930
  {
2873
2931
  volatile VALUE exc, mesg, extra;
2874
2932
 
@@ -3321,11 +3379,11 @@ handle_exception(ExceptionInfo *exception, Image *imglist, ErrorRetention retent
3321
3379
  extra[sizeof(extra)-1] = '\0';
3322
3380
 
3323
3381
  DestroyExceptionInfo(exception);
3324
- raise_error(msg, extra);
3382
+ rm_magick_error(msg, extra);
3325
3383
 
3326
3384
  #else
3327
3385
  DestroyExceptionInfo(exception);
3328
- raise_error(msg, NULL);
3386
+ rm_magick_error(msg, NULL);
3329
3387
  #endif
3330
3388
 
3331
3389
  }