rmagick 2.16.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Files changed (238) hide show
  1. checksums.yaml +5 -5
  2. data/.appveyor.yml +19 -0
  3. data/.circleci/config.yml +56 -0
  4. data/.rubocop.yml +8 -335
  5. data/.rubocop_todo.yml +255 -0
  6. data/.ruby-version +1 -0
  7. data/.travis.yml +6 -49
  8. data/CHANGELOG.md +23 -0
  9. data/CONTRIBUTING.md +34 -0
  10. data/Gemfile +0 -6
  11. data/README.textile +11 -3
  12. data/Rakefile +23 -15
  13. data/before_install_linux.sh +12 -15
  14. data/doc/ex/InitialCoords.rb +4 -4
  15. data/doc/ex/NewCoordSys.rb +4 -4
  16. data/doc/ex/OrigCoordSys.rb +2 -2
  17. data/doc/ex/PreserveAspectRatio.rb +34 -34
  18. data/doc/ex/RotateScale.rb +7 -7
  19. data/doc/ex/Skew.rb +7 -7
  20. data/doc/ex/Use01.rb +1 -1
  21. data/doc/ex/Use02.rb +4 -4
  22. data/doc/ex/Use03.rb +2 -2
  23. data/doc/ex/ViewBox.rb +4 -4
  24. data/doc/ex/affine.rb +5 -5
  25. data/doc/ex/affine_transform.rb +3 -3
  26. data/doc/ex/arc.rb +9 -9
  27. data/doc/ex/arcpath.rb +2 -2
  28. data/doc/ex/arcs01.rb +6 -6
  29. data/doc/ex/arcs02.rb +8 -8
  30. data/doc/ex/axes.rb +11 -11
  31. data/doc/ex/baseline_shift01.rb +5 -5
  32. data/doc/ex/bilevel_channel.rb +1 -1
  33. data/doc/ex/blur_image.rb +1 -1
  34. data/doc/ex/border.rb +1 -1
  35. data/doc/ex/bounding_box.rb +11 -11
  36. data/doc/ex/cbezier1.rb +12 -12
  37. data/doc/ex/cbezier2.rb +13 -13
  38. data/doc/ex/cbezier3.rb +13 -13
  39. data/doc/ex/cbezier4.rb +13 -13
  40. data/doc/ex/cbezier5.rb +13 -13
  41. data/doc/ex/cbezier6.rb +19 -19
  42. data/doc/ex/channel.rb +2 -2
  43. data/doc/ex/chop.rb +2 -2
  44. data/doc/ex/circle.rb +7 -7
  45. data/doc/ex/circle01.rb +2 -2
  46. data/doc/ex/clip_path.rb +6 -6
  47. data/doc/ex/coalesce.rb +6 -6
  48. data/doc/ex/color_fill_to_border.rb +8 -8
  49. data/doc/ex/color_floodfill.rb +8 -8
  50. data/doc/ex/color_histogram.rb +2 -2
  51. data/doc/ex/color_reset.rb +2 -2
  52. data/doc/ex/colors.rb +4 -4
  53. data/doc/ex/compose_mask.rb +2 -2
  54. data/doc/ex/composite.rb +39 -39
  55. data/doc/ex/composite_layers.rb +1 -2
  56. data/doc/ex/contrast.rb +3 -3
  57. data/doc/ex/crop.rb +2 -2
  58. data/doc/ex/crop_with_gravity.rb +5 -5
  59. data/doc/ex/cubic01.rb +12 -12
  60. data/doc/ex/cubic02.rb +22 -22
  61. data/doc/ex/cycle_colormap.rb +3 -3
  62. data/doc/ex/dissolve.rb +0 -0
  63. data/doc/ex/drawcomp.rb +8 -9
  64. data/doc/ex/drop_shadow.rb +4 -4
  65. data/doc/ex/ellipse.rb +9 -9
  66. data/doc/ex/ellipse01.rb +3 -3
  67. data/doc/ex/enhance.rb +2 -2
  68. data/doc/ex/evenodd.rb +19 -19
  69. data/doc/ex/fill_pattern.rb +3 -3
  70. data/doc/ex/flatten_images.rb +1 -1
  71. data/doc/ex/font_styles.rb +13 -13
  72. data/doc/ex/fonts.rb +2 -6
  73. data/doc/ex/frame.rb +1 -1
  74. data/doc/ex/get_multiline_type_metrics.rb +3 -3
  75. data/doc/ex/get_pixels.rb +4 -6
  76. data/doc/ex/get_type_metrics.rb +26 -25
  77. data/doc/ex/gradientfill.rb +2 -2
  78. data/doc/ex/grav.rb +12 -12
  79. data/doc/ex/gravity.rb +14 -16
  80. data/doc/ex/group.rb +11 -11
  81. data/doc/ex/hatchfill.rb +2 -2
  82. data/doc/ex/image.rb +9 -9
  83. data/doc/ex/implode.rb +2 -2
  84. data/doc/ex/line.rb +10 -10
  85. data/doc/ex/line01.rb +7 -7
  86. data/doc/ex/mask.rb +0 -0
  87. data/doc/ex/matte_fill_to_border.rb +3 -3
  88. data/doc/ex/matte_floodfill.rb +2 -2
  89. data/doc/ex/matte_replace.rb +3 -3
  90. data/doc/ex/median_filter.rb +2 -2
  91. data/doc/ex/mono.rb +2 -2
  92. data/doc/ex/morph.rb +1 -1
  93. data/doc/ex/mosaic.rb +7 -5
  94. data/doc/ex/motion_blur.rb +1 -1
  95. data/doc/ex/negate_channel.rb +0 -0
  96. data/doc/ex/nested_rvg.rb +2 -2
  97. data/doc/ex/nonzero.rb +19 -19
  98. data/doc/ex/opacity.rb +9 -9
  99. data/doc/ex/path.rb +17 -17
  100. data/doc/ex/pattern1.rb +4 -4
  101. data/doc/ex/pattern2.rb +2 -2
  102. data/doc/ex/polaroid.rb +0 -1
  103. data/doc/ex/polygon.rb +7 -7
  104. data/doc/ex/polygon01.rb +7 -7
  105. data/doc/ex/polyline.rb +7 -7
  106. data/doc/ex/polyline01.rb +8 -8
  107. data/doc/ex/posterize.rb +0 -0
  108. data/doc/ex/qbezierpath.rb +16 -16
  109. data/doc/ex/quad01.rb +6 -6
  110. data/doc/ex/quantize-m.rb +2 -2
  111. data/doc/ex/random_threshold_channel.rb +1 -1
  112. data/doc/ex/rect01.rb +2 -2
  113. data/doc/ex/rect02.rb +3 -3
  114. data/doc/ex/rectangle.rb +6 -6
  115. data/doc/ex/reduce_noise.rb +2 -2
  116. data/doc/ex/remap.rb +0 -0
  117. data/doc/ex/resize_to_fill.rb +0 -0
  118. data/doc/ex/resize_to_fit.rb +0 -0
  119. data/doc/ex/roll.rb +1 -1
  120. data/doc/ex/rotate.rb +8 -8
  121. data/doc/ex/rotate_f.rb +1 -1
  122. data/doc/ex/roundrect.rb +6 -6
  123. data/doc/ex/rubyname.rb +4 -4
  124. data/doc/ex/rvg_clippath.rb +3 -3
  125. data/doc/ex/rvg_linecap.rb +7 -7
  126. data/doc/ex/rvg_linejoin.rb +7 -7
  127. data/doc/ex/rvg_opacity.rb +5 -5
  128. data/doc/ex/rvg_pattern.rb +8 -8
  129. data/doc/ex/rvg_stroke_dasharray.rb +2 -2
  130. data/doc/ex/sepiatone.rb +0 -0
  131. data/doc/ex/shadow.rb +6 -6
  132. data/doc/ex/shear.rb +2 -2
  133. data/doc/ex/skewx.rb +8 -8
  134. data/doc/ex/skewy.rb +9 -9
  135. data/doc/ex/smile.rb +5 -4
  136. data/doc/ex/sparse_color.rb +0 -4
  137. data/doc/ex/splice.rb +1 -1
  138. data/doc/ex/stegano.rb +4 -5
  139. data/doc/ex/stroke_dasharray.rb +10 -10
  140. data/doc/ex/stroke_fill.rb +2 -2
  141. data/doc/ex/stroke_linecap.rb +12 -12
  142. data/doc/ex/stroke_linejoin.rb +12 -12
  143. data/doc/ex/stroke_width.rb +11 -11
  144. data/doc/ex/swirl.rb +2 -2
  145. data/doc/ex/text.rb +6 -6
  146. data/doc/ex/text01.rb +4 -4
  147. data/doc/ex/text_align.rb +5 -5
  148. data/doc/ex/text_antialias.rb +2 -2
  149. data/doc/ex/text_styles.rb +8 -8
  150. data/doc/ex/text_undercolor.rb +4 -4
  151. data/doc/ex/texture_fill_to_border.rb +8 -8
  152. data/doc/ex/texture_floodfill.rb +8 -8
  153. data/doc/ex/texturefill.rb +2 -2
  154. data/doc/ex/threshold.rb +2 -2
  155. data/doc/ex/to_blob.rb +1 -1
  156. data/doc/ex/translate.rb +8 -8
  157. data/doc/ex/transparent.rb +6 -6
  158. data/doc/ex/transpose.rb +0 -0
  159. data/doc/ex/transverse.rb +0 -0
  160. data/doc/ex/tref01.rb +6 -6
  161. data/doc/ex/triangle01.rb +2 -2
  162. data/doc/ex/trim.rb +2 -2
  163. data/doc/ex/tspan01.rb +5 -5
  164. data/doc/ex/tspan02.rb +5 -5
  165. data/doc/ex/tspan03.rb +5 -5
  166. data/doc/ex/unsharp_mask.rb +3 -3
  167. data/doc/ex/viewex.rb +5 -5
  168. data/doc/ex/vignette.rb +0 -0
  169. data/doc/ex/watermark.rb +6 -6
  170. data/doc/ex/wet_floor.rb +2 -2
  171. data/doc/ex/writing_mode01.rb +12 -12
  172. data/doc/ex/writing_mode02.rb +12 -12
  173. data/examples/constitute.rb +1 -1
  174. data/examples/crop_with_gravity.rb +5 -5
  175. data/examples/demo.rb +6 -7
  176. data/examples/describe.rb +8 -10
  177. data/examples/find_similar_region.rb +3 -3
  178. data/examples/histogram.rb +192 -201
  179. data/examples/identify.rb +62 -73
  180. data/examples/image_opacity.rb +0 -1
  181. data/examples/import_export.rb +1 -1
  182. data/examples/pattern_fill.rb +3 -4
  183. data/examples/rotating_text.rb +5 -4
  184. data/examples/spinner.rb +5 -5
  185. data/examples/thumbnail.rb +3 -3
  186. data/examples/vignette.rb +5 -5
  187. data/ext/RMagick/extconf.rb +213 -230
  188. data/ext/RMagick/rmagick.c +1 -0
  189. data/ext/RMagick/rmagick.h +26 -29
  190. data/ext/RMagick/rmdraw.c +3 -38
  191. data/ext/RMagick/rmenum.c +36 -0
  192. data/ext/RMagick/rmimage.c +166 -10
  193. data/ext/RMagick/rminfo.c +7 -2
  194. data/ext/RMagick/rmkinfo.c +247 -0
  195. data/ext/RMagick/rmmain.c +96 -0
  196. data/ext/RMagick/rmutil.c +4 -0
  197. data/lib/rmagick/version.rb +3 -3
  198. data/lib/rmagick_internal.rb +226 -308
  199. data/lib/rvg/clippath.rb +2 -4
  200. data/lib/rvg/container.rb +25 -22
  201. data/lib/rvg/deep_equal.rb +11 -11
  202. data/lib/rvg/describable.rb +2 -2
  203. data/lib/rvg/embellishable.rb +60 -66
  204. data/lib/rvg/misc.rb +122 -128
  205. data/lib/rvg/pathdata.rb +15 -17
  206. data/lib/rvg/rvg.rb +41 -44
  207. data/lib/rvg/stretchable.rb +22 -28
  208. data/lib/rvg/stylable.rb +10 -10
  209. data/lib/rvg/text.rb +164 -165
  210. data/lib/rvg/transformable.rb +15 -15
  211. data/lib/rvg/units.rb +2 -2
  212. data/rmagick.gemspec +9 -33
  213. data/spec/rmagick/draw_spec.rb +5 -6
  214. data/spec/rmagick/image/blue_shift_spec.rb +1 -3
  215. data/spec/rmagick/image/channel_entropy_spec.rb +9 -0
  216. data/spec/rmagick/image/composite_spec.rb +2 -4
  217. data/spec/rmagick/image/constitute_spec.rb +2 -4
  218. data/spec/rmagick/image/dispatch_spec.rb +1 -3
  219. data/spec/rmagick/image/from_blob_spec.rb +1 -3
  220. data/spec/rmagick/image/ping_spec.rb +1 -3
  221. data/spec/rmagick/image/properties_spec.rb +0 -2
  222. data/spec/rmagick/image/read_spec.rb +28 -0
  223. data/spec/spec_helper.rb +7 -1
  224. data/spec/support/issue_200/app.rb +8 -0
  225. data/test/Image1.rb +70 -70
  226. data/test/Image2.rb +369 -361
  227. data/test/Image3.rb +64 -63
  228. data/test/ImageList1.rb +796 -792
  229. data/test/ImageList2.rb +43 -44
  230. data/test/Image_attributes.rb +26 -48
  231. data/test/Import_Export.rb +71 -77
  232. data/test/Info.rb +30 -31
  233. data/test/Magick.rb +47 -46
  234. data/test/Pixel.rb +24 -24
  235. data/test/Preview.rb +7 -6
  236. data/test/test_all_basic.rb +15 -7
  237. data/test/tmpnam_test.rb +3 -3
  238. metadata +57 -18
@@ -31,68 +31,66 @@ module Magick
31
31
  puts "\t\tGray: #{channel_depth(Magick::GrayChannel)}-bits\n"
32
32
  puts "\t\tOpacity: #{channel_depth(Magick::OpacityChannel)}-bits\n" if matte
33
33
  end
34
- scale = Magick::QuantumRange / (Magick::QuantumRange >> (Magick::MAGICKCORE_QUANTUM_DEPTH-channel_depth))
34
+ scale = Magick::QuantumRange / (Magick::QuantumRange >> (Magick::MAGICKCORE_QUANTUM_DEPTH - channel_depth))
35
35
  puts "\tChannel statistics:\n"
36
36
  case color_space
37
37
  when Magick::RGBColorspace
38
38
  puts "\t\tRed:\n"
39
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::RedChannel)[0]/scale, channel_extrema(Magick::RedChannel)[0]/Magick::QuantumRange)
40
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::RedChannel)[1]/scale, channel_extrema(Magick::RedChannel)[1]/Magick::QuantumRange)
41
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::RedChannel)[0]/scale, channel_mean(Magick::RedChannel)[0]/Magick::QuantumRange)
42
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::RedChannel)[1]/scale, channel_mean(Magick::RedChannel)[1]/Magick::QuantumRange)
39
+ puts "\t\t\tMin: " + format("%u (%g)\n", channel_extrema(Magick::RedChannel)[0] / scale, channel_extrema(Magick::RedChannel)[0] / Magick::QuantumRange)
40
+ puts "\t\t\tMax: " + format("%u (%g)\n", channel_extrema(Magick::RedChannel)[1] / scale, channel_extrema(Magick::RedChannel)[1] / Magick::QuantumRange)
41
+ puts "\t\t\tMean: " + format("%g (%g)\n", channel_mean(Magick::RedChannel)[0] / scale, channel_mean(Magick::RedChannel)[0] / Magick::QuantumRange)
42
+ puts "\t\t\tStandard deviation: " + format("%g (%g)\n", channel_mean(Magick::RedChannel)[1] / scale, channel_mean(Magick::RedChannel)[1] / Magick::QuantumRange)
43
43
  puts "\t\tGreen:\n"
44
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::GreenChannel)[0]/scale, channel_extrema(Magick::GreenChannel)[0]/Magick::QuantumRange)
45
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::GreenChannel)[1]/scale, channel_extrema(Magick::GreenChannel)[1]/Magick::QuantumRange)
46
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::GreenChannel)[0]/scale, channel_mean(Magick::GreenChannel)[0]/Magick::QuantumRange)
47
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::GreenChannel)[1]/scale, channel_mean(Magick::GreenChannel)[1]/Magick::QuantumRange)
44
+ puts "\t\t\tMin: " + format("%u (%g)\n", channel_extrema(Magick::GreenChannel)[0] / scale, channel_extrema(Magick::GreenChannel)[0] / Magick::QuantumRange)
45
+ puts "\t\t\tMax: " + format("%u (%g)\n", channel_extrema(Magick::GreenChannel)[1] / scale, channel_extrema(Magick::GreenChannel)[1] / Magick::QuantumRange)
46
+ puts "\t\t\tMean: " + format("%g (%g)\n", channel_mean(Magick::GreenChannel)[0] / scale, channel_mean(Magick::GreenChannel)[0] / Magick::QuantumRange)
47
+ puts "\t\t\tStandard deviation: " + format("%g (%g)\n", channel_mean(Magick::GreenChannel)[1] / scale, channel_mean(Magick::GreenChannel)[1] / Magick::QuantumRange)
48
48
  puts "\t\tBlue:\n"
49
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlueChannel)[0]/scale, channel_extrema(Magick::BlueChannel)[0]/Magick::QuantumRange)
50
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlueChannel)[1]/scale, channel_extrema(Magick::BlueChannel)[1]/Magick::QuantumRange)
51
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::BlueChannel)[0]/scale, channel_mean(Magick::BlueChannel)[0]/Magick::QuantumRange)
52
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::BlueChannel)[1]/scale, channel_mean(Magick::BlueChannel)[1]/Magick::QuantumRange)
49
+ puts "\t\t\tMin: " + format("%u (%g)\n", channel_extrema(Magick::BlueChannel)[0] / scale, channel_extrema(Magick::BlueChannel)[0] / Magick::QuantumRange)
50
+ puts "\t\t\tMax: " + format("%u (%g)\n", channel_extrema(Magick::BlueChannel)[1] / scale, channel_extrema(Magick::BlueChannel)[1] / Magick::QuantumRange)
51
+ puts "\t\t\tMean: " + format("%g (%g)\n", channel_mean(Magick::BlueChannel)[0] / scale, channel_mean(Magick::BlueChannel)[0] / Magick::QuantumRange)
52
+ puts "\t\t\tStandard deviation: " + format("%g (%g)\n", channel_mean(Magick::BlueChannel)[1] / scale, channel_mean(Magick::BlueChannel)[1] / Magick::QuantumRange)
53
53
  when Magick::CMYKColorspace
54
54
  puts "\t\tCyan:\n"
55
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::CyanChannel)[0]/scale, channel_extrema(Magick::CyanChannel)[0]/Magick::QuantumRange)
56
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::CyanChannel)[1]/scale, channel_extrema(Magick::CyanChannel)[1]/Magick::QuantumRange)
57
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::CyanChannel)[0]/scale, channel_mean(Magick::CyanChannel)[0]/Magick::QuantumRange)
58
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::CyanChannel)[1]/scale, channel_mean(Magick::CyanChannel)[1]/Magick::QuantumRange)
55
+ puts "\t\t\tMin: " + format("%u (%g)\n", channel_extrema(Magick::CyanChannel)[0] / scale, channel_extrema(Magick::CyanChannel)[0] / Magick::QuantumRange)
56
+ puts "\t\t\tMax: " + format("%u (%g)\n", channel_extrema(Magick::CyanChannel)[1] / scale, channel_extrema(Magick::CyanChannel)[1] / Magick::QuantumRange)
57
+ puts "\t\t\tMean: " + format("%g (%g)\n", channel_mean(Magick::CyanChannel)[0] / scale, channel_mean(Magick::CyanChannel)[0] / Magick::QuantumRange)
58
+ puts "\t\t\tStandard deviation: " + format("%g (%g)\n", channel_mean(Magick::CyanChannel)[1] / scale, channel_mean(Magick::CyanChannel)[1] / Magick::QuantumRange)
59
59
  puts "\t\tMagenta:\n"
60
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::MagentaChannel)[0]/scale, channel_extrema(Magick::MagentaChannel)[0]/Magick::QuantumRange)
61
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::MagentaChannel)[1]/scale, channel_extrema(Magick::MagentaChannel)[1]/Magick::QuantumRange)
62
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::MagentaChannel)[0]/scale, channel_mean(Magick::MagentaChannel)[0]/Magick::QuantumRange)
63
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::MagentaChannel)[1]/scale, channel_mean(Magick::MagentaChannel)[1]/Magick::QuantumRange)
60
+ puts "\t\t\tMin: " + format("%u (%g)\n", channel_extrema(Magick::MagentaChannel)[0] / scale, channel_extrema(Magick::MagentaChannel)[0] / Magick::QuantumRange)
61
+ puts "\t\t\tMax: " + format("%u (%g)\n", channel_extrema(Magick::MagentaChannel)[1] / scale, channel_extrema(Magick::MagentaChannel)[1] / Magick::QuantumRange)
62
+ puts "\t\t\tMean: " + format("%g (%g)\n", channel_mean(Magick::MagentaChannel)[0] / scale, channel_mean(Magick::MagentaChannel)[0] / Magick::QuantumRange)
63
+ puts "\t\t\tStandard deviation: " + format("%g (%g)\n", channel_mean(Magick::MagentaChannel)[1] / scale, channel_mean(Magick::MagentaChannel)[1] / Magick::QuantumRange)
64
64
  puts "\t\tYellow:\n"
65
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::YellowChannel)[0]/scale, channel_extrema(Magick::YellowChannel)[0]/Magick::QuantumRange)
66
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::YellowChannel)[1]/scale, channel_extrema(Magick::YellowChannel)[1]/Magick::QuantumRange)
67
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::YellowChannel)[0]/scale, channel_mean(Magick::YellowChannel)[0]/Magick::QuantumRange)
68
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::YellowChannel)[1]/scale, channel_mean(Magick::YellowChannel)[1]/Magick::QuantumRange)
65
+ puts "\t\t\tMin: " + format("%u (%g)\n", channel_extrema(Magick::YellowChannel)[0] / scale, channel_extrema(Magick::YellowChannel)[0] / Magick::QuantumRange)
66
+ puts "\t\t\tMax: " + format("%u (%g)\n", channel_extrema(Magick::YellowChannel)[1] / scale, channel_extrema(Magick::YellowChannel)[1] / Magick::QuantumRange)
67
+ puts "\t\t\tMean: " + format("%g (%g)\n", channel_mean(Magick::YellowChannel)[0] / scale, channel_mean(Magick::YellowChannel)[0] / Magick::QuantumRange)
68
+ puts "\t\t\tStandard deviation: " + format("%g (%g)\n", channel_mean(Magick::YellowChannel)[1] / scale, channel_mean(Magick::YellowChannel)[1] / Magick::QuantumRange)
69
69
  puts "\t\tBlack:\n"
70
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlackChannel)[0]/scale, channel_extrema(Magick::BlackChannel)[0]/Magick::QuantumRange)
71
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::BlackChannel)[1]/scale, channel_extrema(Magick::BlackChannel)[1]/Magick::QuantumRange)
72
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::BlackChannel)[0]/scale, channel_mean(Magick::BlackChannel)[0]/Magick::QuantumRange)
73
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::BlackChannel)[1]/scale, channel_mean(Magick::BlackChannel)[1]/Magick::QuantumRange)
70
+ puts "\t\t\tMin: " + format("%u (%g)\n", channel_extrema(Magick::BlackChannel)[0] / scale, channel_extrema(Magick::BlackChannel)[0] / Magick::QuantumRange)
71
+ puts "\t\t\tMax: " + format("%u (%g)\n", channel_extrema(Magick::BlackChannel)[1] / scale, channel_extrema(Magick::BlackChannel)[1] / Magick::QuantumRange)
72
+ puts "\t\t\tMean: " + format("%g (%g)\n", channel_mean(Magick::BlackChannel)[0] / scale, channel_mean(Magick::BlackChannel)[0] / Magick::QuantumRange)
73
+ puts "\t\t\tStandard deviation: " + format("%g (%g)\n", channel_mean(Magick::BlackChannel)[1] / scale, channel_mean(Magick::BlackChannel)[1] / Magick::QuantumRange)
74
74
  when Magick::GrayColorspace
75
75
  puts "\t\tGray:\n"
76
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::GrayChannel)[0]/scale, channel_extrema(Magick::GrayChannel)[0]/Magick::QuantumRange)
77
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::GrayChannel)[1]/scale, channel_extrema(Magick::GrayChannel)[1]/Magick::QuantumRange)
78
- puts "\t\t\tMean: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[0]/scale, channel_mean(Magick::GrayChannel)[0]/Magick::QuantumRange)
79
- puts "\t\t\tStandard deviation: " + sprintf("%g (%g)\n", channel_mean(Magick::GrayChannel)[1]/scale, channel_mean(Magick::GrayChannel)[1]/Magick::QuantumRange)
76
+ puts "\t\t\tMin: " + format("%u (%g)\n", channel_extrema(Magick::GrayChannel)[0] / scale, channel_extrema(Magick::GrayChannel)[0] / Magick::QuantumRange)
77
+ puts "\t\t\tMax: " + format("%u (%g)\n", channel_extrema(Magick::GrayChannel)[1] / scale, channel_extrema(Magick::GrayChannel)[1] / Magick::QuantumRange)
78
+ puts "\t\t\tMean: " + format("%g (%g)\n", channel_mean(Magick::GrayChannel)[0] / scale, channel_mean(Magick::GrayChannel)[0] / Magick::QuantumRange)
79
+ puts "\t\t\tStandard deviation: " + format("%g (%g)\n", channel_mean(Magick::GrayChannel)[1] / scale, channel_mean(Magick::GrayChannel)[1] / Magick::QuantumRange)
80
80
  end
81
81
  if matte
82
82
  puts "\t\tOpacity:\n"
83
- puts "\t\t\tMin: " + sprintf("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[0]/scale, channel_extrema(Magick::OpacityChannel)[0]/Magick::QuantumRange)
84
- puts "\t\t\tMax: " + sprintf("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[1]/scale, channel_extrema(Magick::OpacityChannel)[1]/Magick::QuantumRange)
85
- puts "\t\t\tMean:" + sprintf("%u (%g)\n", channel_mean(Magick::OpacityChannel)[0]/scale, channel_mean(Magick::OpacityChannel)[0]/Magick::QuantumRange)
86
- puts "\t\t\tStandard deviation:" + sprintf("%u (%g)\n", channel_mean(Magick::OpacityChannel)[1]/scale, channel_mean(Magick::OpacityChannel)[1]/Magick::QuantumRange)
83
+ puts "\t\t\tMin: " + format("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[0] / scale, channel_extrema(Magick::OpacityChannel)[0] / Magick::QuantumRange)
84
+ puts "\t\t\tMax: " + format("%u (%g)\n", channel_extrema(Magick::OpacityChannel)[1] / scale, channel_extrema(Magick::OpacityChannel)[1] / Magick::QuantumRange)
85
+ puts "\t\t\tMean:" + format("%u (%g)\n", channel_mean(Magick::OpacityChannel)[0] / scale, channel_mean(Magick::OpacityChannel)[0] / Magick::QuantumRange)
86
+ puts "\t\t\tStandard deviation:" + format("%u (%g)\n", channel_mean(Magick::OpacityChannel)[1] / scale, channel_mean(Magick::OpacityChannel)[1] / Magick::QuantumRange)
87
87
  end
88
88
  if class_type == Magick::DirectClass
89
89
  puts "\tColors: #{total_colors}\n"
90
+ elsif total_colors <= colors
91
+ puts "\tColors: #{colors}\n"
90
92
  else
91
- if total_colors <= colors
92
- puts "\tColors: #{colors}\n"
93
- else
94
- puts "\tColors: #{total_colors}=>#{colors}\n"
95
- end
93
+ puts "\tColors: #{total_colors}=>#{colors}\n"
96
94
  end
97
95
  # Histogram goes here
98
96
  puts "\tMean error per pixel: #{mean_error_per_pixel}\n" if mean_error_per_pixel != 0.0
@@ -103,24 +101,20 @@ module Magick
103
101
  chrom = chromaticity
104
102
  if chrom.red_primary.x != 0.0 || chrom.green_primary.x != 0.0 || chrom.blue_primary.x != 0.0 || chrom.white_point.x != 0.0
105
103
  puts "\tChromaticity:\n"
106
- puts "\t\tred primary: (#{sprintf('%g,%g', chrom.red_primary.x, chrom.red_primary.y)})\n"
107
- puts "\t\tgreen primary: (#{sprintf('%g,%g', chrom.green_primary.x, chrom.green_primary.y)})\n"
108
- puts "\t\tblue primary: (#{sprintf('%g,%g', chrom.blue_primary.x, chrom.blue_primary.y)})\n"
109
- puts "\t\twhite point: (#{sprintf('%g,%g', chrom.white_point.x, chrom.white_point.y)})\n"
104
+ puts "\t\tred primary: (#{format('%g,%g', chrom.red_primary.x, chrom.red_primary.y)})\n"
105
+ puts "\t\tgreen primary: (#{format('%g,%g', chrom.green_primary.x, chrom.green_primary.y)})\n"
106
+ puts "\t\tblue primary: (#{format('%g,%g', chrom.blue_primary.x, chrom.blue_primary.y)})\n"
107
+ puts "\t\twhite point: (#{format('%g,%g', chrom.white_point.x, chrom.white_point.y)})\n"
110
108
  end
111
109
  ex_info = extract_info
112
- if ex_info.width * ex_info.height != 0.0
113
- puts "\tTile geometry: #{ex_info.width}x#{ex_info.height}+#{ex_info.x}+#{ex_info.y}\n"
114
- end
115
- if x_resolution != 0.0 && y_resolution != 0.0
116
- puts "\tResolution: #{sprintf('%gx%g', x_resolution, y_resolution)}\n"
117
- end
110
+ puts "\tTile geometry: #{ex_info.width}x#{ex_info.height}+#{ex_info.x}+#{ex_info.y}\n" if ex_info.width * ex_info.height != 0.0
111
+ puts "\tResolution: #{format('%gx%g', x_resolution, y_resolution)}\n" if x_resolution != 0.0 && y_resolution != 0.0
118
112
  puts "\tUnits: #{units}\n"
119
113
  size = filesize
120
- if size >= 1048576
121
- puts "\tFilesize: #{'%.1f' % (size/1048576.0)}mb\n"
114
+ if size >= 1_048_576
115
+ puts "\tFilesize: #{format('%.1f', (size / 1_048_576.0))}mb\n"
122
116
  elsif size >= 1024
123
- puts "\tFilesize: #{'%.0f' % (size/1024.0)}kb\n"
117
+ puts "\tFilesize: #{format('%.0f', (size / 1024.0))}kb\n"
124
118
  else
125
119
  puts "\tFilesize: #{size}b\n"
126
120
  end
@@ -129,33 +123,30 @@ module Magick
129
123
  puts "\tBorder Color: #{border_color}\n"
130
124
  puts "\tMatte Color: #{matte_color}\n"
131
125
  pg = page
132
- if pg.width != 0 || pg.height != 0 || pg.x != 0 || pg.y != 0
133
- puts "\tPage geometry: #{pg.width}x#{pg.height}+#{pg.x}+#{pg.y}\n"
134
- end
126
+ puts "\tPage geometry: #{pg.width}x#{pg.height}+#{pg.x}+#{pg.y}\n" if pg.width != 0 || pg.height != 0 || pg.x != 0 || pg.y != 0
135
127
  puts "\tDispose: #{dispose}\n"
136
128
  puts "\tDelay: #{delay}\n" if delay != 0
137
129
  puts "\tIterations: #{iterations}\n" unless iterations == 1
138
130
  puts "\tScene: #{scene}\n" if scene != 0
139
131
  puts "\tCompression: #{compression}\n"
140
- puts "\tQuality: #{quality}\n" unless quality == 0
132
+ puts "\tQuality: #{quality}\n" unless quality.zero?
141
133
  puts "\tOrientation: #{orientation}\n"
142
134
  puts "\tMontage: #{montage}\n" if montage
143
135
  signature # compute but ignore - will be displayed along with the other properties
144
136
  properties.each do |prop, value|
145
- next if prop[0,1] == '['
137
+ next if prop[0, 1] == '['
138
+
146
139
  puts "\t#{prop}: #{value}\n"
147
140
  end
148
141
  clip_path = self['8BIM:1999,2998:#1']
149
- if clip_path
150
- puts "\tClipping path: #{clip_path}\n"
151
- end
142
+ puts "\tClipping path: #{clip_path}\n" if clip_path
152
143
  each_profile do |name, value|
153
144
  puts "\tProfile-#{name}: #{value.length}\n"
154
- if name == 'exif'
155
- exif_attrs = get_exif_by_entry
156
- exif_attrs.each do |attr|
157
- puts "\t\t#{attr[0]}: #{attr[1]}\n"
158
- end
145
+ next unless name == 'exif'
146
+
147
+ exif_attrs = get_exif_by_entry
148
+ exif_attrs.each do |attr|
149
+ puts "\t\t#{attr[0]}: #{attr[1]}\n"
159
150
  end
160
151
  end
161
152
  puts "\tTainted: True\n" if changed?
@@ -166,20 +157,18 @@ module Magick
166
157
  end
167
158
  end
168
159
 
169
- if ARGV.length == 0
160
+ if ARGV.length.zero?
170
161
  puts <<-'END_USAGE'
171
162
  This example displays information about the specified image file(s)
172
163
  that is similar to ImageMagick/GraphicsMagick's identify command.
173
164
 
174
165
  Usage:
175
166
  ruby identify.rb filename [filename...]
176
- END_USAGE
167
+ END_USAGE
177
168
  exit
178
169
  end
179
170
 
180
171
  ilist = Magick::ImageList.new(*ARGV)
181
- ilist.each do |img|
182
- img.identify
183
- end
172
+ ilist.each(&:identify)
184
173
 
185
174
  exit
@@ -1,4 +1,3 @@
1
-
2
1
  # Ccreate a semi-transparent title for an image.
3
2
 
4
3
  require 'rmagick'
@@ -22,7 +22,7 @@ begin
22
22
  copy.import_pixels(0, r, img.columns, 1, 'RGB', scanline)
23
23
  end
24
24
  rescue NotImplementedError
25
- $stderr.puts 'The export_pixels and import_pixels methods are not supported' \
25
+ warn 'The export_pixels and import_pixels methods are not supported' \
26
26
  ' by this version of ImageMagick/GraphicsMagick'
27
27
  exit
28
28
  end
@@ -1,4 +1,3 @@
1
-
2
1
  # Demonstrate ImageMagick's new (5.5.7-3 and later) built-in patterns.
3
2
  # Create a Fill class that can be reused to fill in new Image backgrounds.
4
3
 
@@ -17,7 +16,7 @@ supported patterns as an argument. For example, try "checkerboard".
17
16
  END_INFO
18
17
 
19
18
  class PatternFill < Magick::TextureFill
20
- def initialize(name='bricks')
19
+ def initialize(name = 'bricks')
21
20
  @pat_img = Magick::Image.read("pattern:#{name}").first
22
21
  super(@pat_img)
23
22
  end
@@ -26,13 +25,13 @@ end
26
25
  if ARGV[0]
27
26
  pattern = ARGV[0]
28
27
  else
29
- $stderr.puts 'Defaulting to checkerboard pattern.'
28
+ warn 'Defaulting to checkerboard pattern.'
30
29
  pattern = 'checkerboard'
31
30
  end
32
31
 
33
32
  # Create a sample image that is 100x bigger than the pattern.
34
33
  attrs = Image.ping("pattern:#{pattern}").first
35
34
 
36
- tryit = Image.new(10*attrs.columns, 10*attrs.rows, PatternFill.new(pattern))
35
+ tryit = Image.new(10 * attrs.columns, 10 * attrs.rows, PatternFill.new(pattern))
37
36
  tryit.write('pattern_fill.gif')
38
37
  exit
@@ -15,10 +15,11 @@ text.pointsize = 28
15
15
  text.font_weight = BoldWeight
16
16
  text.font_style = ItalicStyle
17
17
  text.gravity = CenterGravity
18
+ text.fill = 'white'
18
19
 
19
20
  # Let's make it interesting. Composite the
20
21
  # rotated text over a gradient fill background.
21
- fill = GradientFill.new(100,100,100,100,'yellow','red')
22
+ fill = GradientFill.new(100, 100, 100, 100, 'yellow', 'red')
22
23
  bg = Image.new(200, 200, fill)
23
24
 
24
25
  # The "none" color is transparent.
@@ -27,9 +28,9 @@ fg = Image.new(bg.columns, bg.rows) { self.background_color = 'none' }
27
28
  # Here's where we'll collect the individual frames.
28
29
  animation = ImageList.new
29
30
 
30
- 0.step(345,15) do |degrees|
31
+ 0.step(345, 15) do |degrees|
31
32
  frame = fg.copy
32
- text.annotate(frame, 0,0,0,0, 'Rotating Text') do
33
+ text.annotate(frame, 0, 0, 0, 0, 'Rotating Text') do
33
34
  self.rotation = degrees
34
35
  end
35
36
  # Composite the text over the gradient filled background frame.
@@ -38,7 +39,7 @@ end
38
39
 
39
40
  animation.delay = 8
40
41
 
41
- #animation.animate
42
+ # animation.animate
42
43
  puts '...Writing rotating_text.gif'
43
44
  animation.write('rotating_text.gif')
44
45
  exit
@@ -12,10 +12,10 @@ END_INFO
12
12
 
13
13
  NFRAMES = 12 # number of frames in the animation
14
14
  DIM = 32 # width & height of image in pixels
15
- DELAY = 100.0 / (NFRAMES/2) # 2 rotations per second
15
+ DELAY = 100.0 / (NFRAMES / 2) # 2 rotations per second
16
16
 
17
17
  # 'frame' is a single frame in the animation.
18
- frame = Magick::Image.new(DIM, DIM) {self.background_color = 'transparent'}
18
+ frame = Magick::Image.new(DIM, DIM) { self.background_color = 'transparent' }
19
19
 
20
20
  # 'spinner' will contain the frames that make up the animated GIF
21
21
  spinner = Magick::ImageList.new
@@ -25,19 +25,19 @@ level = Magick::QuantumRange / 2 / NFRAMES
25
25
 
26
26
  NFRAMES.times do |x|
27
27
  gc = Magick::Draw.new
28
- gc.translate(DIM/2, DIM/2)
28
+ gc.translate(DIM / 2, DIM / 2)
29
29
  gc.stroke('none')
30
30
  intensity = 0.58 * Magick::QuantumRange
31
31
  fill_color = Magick::Pixel.new(intensity, intensity, intensity).to_color
32
32
  gc.fill(fill_color)
33
- angle = x * (360/NFRAMES)
33
+ angle = x * (360 / NFRAMES)
34
34
  NFRAMES.times do
35
35
  gc.rotate(angle)
36
36
  intensity = [intensity, Magick::QuantumRange].min
37
37
  fill_color = Magick::Pixel.new(intensity, intensity, intensity).to_color
38
38
  gc.fill(fill_color)
39
39
  gc.roundrectangle(7, -1, 15, 0, 1, 1)
40
- angle = -(360/NFRAMES)
40
+ angle = -(360 / NFRAMES)
41
41
  intensity += level
42
42
  end
43
43
  spinner << frame.copy
@@ -48,13 +48,13 @@ img.change_geometry!(geom) { |cols, rows| img.thumbnail! cols, rows }
48
48
  # for the raised border. A 3-pixel raised edge means that the
49
49
  # background needs to be 6 pixels larger in each dimension.
50
50
 
51
- bg = Image.new(size+6, size+6) { self.background_color = 'gray75' }
52
- bg = bg.raise(3,3)
51
+ bg = Image.new(size + 6, size + 6) { self.background_color = 'gray75' }
52
+ bg = bg.raise(3, 3)
53
53
 
54
54
  # Just for the purposes of this example, display the thumbnail background on
55
55
  # a larger white background.
56
56
 
57
- white_bg = Image.new(size+50, size+50) {self.background_color = 'white'}
57
+ white_bg = Image.new(size + 50, size + 50) { self.background_color = 'white' }
58
58
  white_bg = white_bg.composite(bg, CenterGravity, OverCompositeOp)
59
59
 
60
60
  # Finally, center the thumbnail on the gray background.
@@ -28,13 +28,13 @@ ballerina = Image.read('../doc/ex/images/Ballerina3.jpg')[0]
28
28
  # The size of the oval is arbitrary - in this case it's 90% of the
29
29
  # size of the image.
30
30
 
31
- oval = Image.new(ballerina.columns, ballerina.rows) {self.background_color = 'black'}
31
+ oval = Image.new(ballerina.columns, ballerina.rows) { self.background_color = 'black' }
32
32
  gc = Draw.new
33
33
  gc.stroke('white')
34
34
  gc.fill('white')
35
- gc.ellipse(ballerina.columns/2, ballerina.rows/2,
36
- ballerina.columns/2-(ballerina.columns*0.10),
37
- ballerina.rows/2-(ballerina.rows*0.10), 0, 360)
35
+ gc.ellipse(ballerina.columns / 2, ballerina.rows / 2,
36
+ ballerina.columns / 2 - (ballerina.columns * 0.10),
37
+ ballerina.rows / 2 - (ballerina.rows * 0.10), 0, 360)
38
38
  gc.draw(oval)
39
39
 
40
40
  # Add a lot of blurring to the oval. I use blur_image because it's much faster
@@ -72,7 +72,7 @@ end
72
72
  # supports 1`level of transparency. Therefore, composite the vignette over a
73
73
  # standard "checkerboard" background. The resulting image will be 100% opaque.
74
74
 
75
- checkerboard = Image.read('pattern:checkerboard') {self.size = "#{ballerina.columns}x#{ballerina.rows}"}
75
+ checkerboard = Image.read('pattern:checkerboard') { self.size = "#{ballerina.columns}x#{ballerina.rows}" }
76
76
  vignette = checkerboard[0].composite(ballerina, CenterGravity, OverCompositeOp)
77
77
  vignette.display
78
78
  exit
@@ -9,9 +9,10 @@ module RMagick
9
9
  require 'rmagick/version'
10
10
  RMAGICK_VERS = ::Magick::VERSION
11
11
  MIN_RUBY_VERS = ::Magick::MIN_RUBY_VERSION
12
- MIN_RUBY_VERS_NO = MIN_RUBY_VERS.tr('.','').to_i
12
+ MIN_RUBY_VERS_NO = MIN_RUBY_VERS.tr('.', '').to_i
13
13
 
14
14
  attr_reader :headers
15
+
15
16
  def initialize
16
17
  configure_compile_options
17
18
  assert_can_compile!
@@ -20,23 +21,23 @@ module RMagick
20
21
 
21
22
  def configured_compile_options
22
23
  {
23
- :magick_config => $magick_config,
24
- :with_magick_wand => $with_magick_wand,
25
- :pkg_config => $pkg_config,
26
- :magick_version => $magick_version,
27
- :local_libs => $LOCAL_LIBS,
28
- :cflags => $CFLAGS,
29
- :cppflags => $CPPFLAGS,
30
- :ldflags => $LDFLAGS,
31
- :defs => $defs,
32
- :config_h => $config_h,
24
+ magick_config: $magick_config,
25
+ with_magick_wand: $with_magick_wand,
26
+ pkg_config: $pkg_config,
27
+ magick_version: $magick_version,
28
+ local_libs: $LOCAL_LIBS,
29
+ cflags: $CFLAGS,
30
+ cppflags: $CPPFLAGS,
31
+ ldflags: $LDFLAGS,
32
+ defs: $defs,
33
+ config_h: $config_h
33
34
  }
34
35
  end
35
36
 
36
37
  def configure_headers
37
- #headers = %w{assert.h ctype.h errno.h float.h limits.h math.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h time.h}
38
- @headers = %w{assert.h ctype.h stdio.h stdlib.h math.h time.h}
39
- headers << 'stdint.h' if have_header('stdint.h') # defines uint64_t
38
+ # headers = %w{assert.h ctype.h errno.h float.h limits.h math.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h time.h}
39
+ @headers = %w[assert.h ctype.h stdio.h stdlib.h math.h time.h]
40
+ headers << 'stdint.h' if have_header('stdint.h') # defines uint64_t
40
41
  headers << 'sys/types.h' if have_header('sys/types.h')
41
42
 
42
43
  if have_header('wand/MagickWand.h')
@@ -53,9 +54,7 @@ module RMagick
53
54
  # Check for compiler. Extract first word so ENV['CC'] can be a program name with arguments.
54
55
  config = defined?(RbConfig) ? ::RbConfig : ::Config
55
56
  cc = (ENV['CC'] || config::CONFIG['CC'] || 'gcc').split(' ').first
56
- unless find_executable(cc)
57
- exit_failure "No C compiler found in ${ENV['PATH']}. See mkmf.log for details."
58
- end
57
+ exit_failure "No C compiler found in ${ENV['PATH']}. See mkmf.log for details." unless find_executable(cc)
59
58
 
60
59
  # ugly way to handle which config tool we're going to use...
61
60
  $with_magick_wand = false
@@ -81,9 +80,7 @@ module RMagick
81
80
  checking_for("outdated ImageMagick version (<= #{Magick::MIN_IM_VERSION})") do
82
81
  Logging.message("Detected ImageMagick version: #{$magick_version}\n")
83
82
 
84
- if Gem::Version.new($magick_version) < Gem::Version.new(Magick::MIN_IM_VERSION)
85
- exit_failure "Can't install RMagick #{RMAGICK_VERS}. You must have ImageMagick #{Magick::MIN_IM_VERSION} or later.\n"
86
- end
83
+ exit_failure "Can't install RMagick #{RMAGICK_VERS}. You must have ImageMagick #{Magick::MIN_IM_VERSION} or later.\n" if Gem::Version.new($magick_version) < Gem::Version.new(Magick::MIN_IM_VERSION)
87
84
  end
88
85
 
89
86
  # From ImageMagick 6.9 binaries are split to two and we have to use
@@ -101,60 +98,56 @@ module RMagick
101
98
  if $with_magick_wand
102
99
  if $magick_config
103
100
  # Save flags
104
- $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `MagickWand-config --cflags`.chomp
105
- $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `MagickWand-config --cppflags`.chomp
106
- $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `MagickWand-config --ldflags`.chomp
107
- $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `MagickWand-config --libs`.chomp
101
+ $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `MagickWand-config --cflags`.chomp
102
+ $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `MagickWand-config --cppflags`.chomp
103
+ $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `MagickWand-config --ldflags`.chomp
104
+ $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `MagickWand-config --libs`.chomp
108
105
  end
109
106
 
110
107
  if $pkg_config
111
108
  # Save flags
112
- $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `pkg-config --cflags MagickWand`.chomp
113
- $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `pkg-config --cflags MagickWand`.chomp
114
- $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `pkg-config --libs MagickWand`.chomp
115
- $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `pkg-config --libs MagickWand`.chomp
109
+ $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `pkg-config --cflags MagickWand`.chomp
110
+ $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `pkg-config --cflags MagickWand`.chomp
111
+ $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `pkg-config --libs MagickWand`.chomp
112
+ $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `pkg-config --libs MagickWand`.chomp
116
113
  end
117
114
  else
118
115
  if $magick_config
119
116
  # Save flags
120
- $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `Magick-config --cflags`.chomp
121
- $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `Magick-config --cppflags`.chomp
122
- $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `Magick-config --ldflags`.chomp
123
- $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `Magick-config --libs`.chomp
117
+ $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `Magick-config --cflags`.chomp
118
+ $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `Magick-config --cppflags`.chomp
119
+ $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `Magick-config --ldflags`.chomp
120
+ $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `Magick-config --libs`.chomp
124
121
  end
125
122
 
126
123
  if $pkg_config
127
124
  # Save flags
128
- $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `pkg-config --cflags MagickCore`.chomp
129
- $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `pkg-config --cflags MagickCore`.chomp
130
- $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `pkg-config --libs MagickCore`.chomp
131
- $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `pkg-config --libs MagickCore`.chomp
125
+ $CFLAGS = ENV['CFLAGS'].to_s + ' ' + `pkg-config --cflags MagickCore`.chomp
126
+ $CPPFLAGS = ENV['CPPFLAGS'].to_s + ' ' + `pkg-config --cflags MagickCore`.chomp
127
+ $LDFLAGS = ENV['LDFLAGS'].to_s + ' ' + `pkg-config --libs MagickCore`.chomp
128
+ $LOCAL_LIBS = ENV['LIBS'].to_s + ' ' + `pkg-config --libs MagickCore`.chomp
132
129
  end
133
130
  end
134
131
 
135
- if RUBY_PLATFORM =~ /darwin/ # osx
136
- set_archflags_for_osx
137
- end
132
+ set_archflags_for_osx if RUBY_PLATFORM =~ /darwin/ # osx
138
133
 
139
- elsif RUBY_PLATFORM =~ /mingw/ # mingw
134
+ elsif RUBY_PLATFORM =~ /mingw/ # mingw
140
135
 
141
136
  `identify -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
142
- abort 'Unable to get ImageMagick version' unless $1
143
- $magick_version = $1
144
- unless have_library('CORE_RL_magick_')
145
- search_paths_for_library_for_mingw
146
- end
137
+ abort 'Unable to get ImageMagick version' unless Regexp.last_match(1)
138
+ $magick_version = Regexp.last_match(1)
139
+ search_paths_for_library_for_mingw unless have_library('CORE_RL_magick_')
147
140
  have_library('X11')
148
141
 
149
- else # mswin
142
+ else # mswin
150
143
 
151
144
  `identify -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-+\d+ /
152
- abort 'Unable to get ImageMagick version' unless $1
153
- $magick_version = $1
145
+ abort 'Unable to get ImageMagick version' unless Regexp.last_match(1)
146
+ $magick_version = Regexp.last_match(1)
154
147
  $CFLAGS = '-W3'
155
- $CPPFLAGS = %Q{-I"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Include" -I"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\include"}
148
+ $CPPFLAGS = %(-I"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Include" -I"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\include")
156
149
  # The /link option is required by the Makefile but causes warnings in the mkmf.log file.
157
- $LDFLAGS = %Q{/link /LIBPATH:"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Lib" /LIBPATH:"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\lib" /LIBPATH:"C:\\ruby\\lib"}
150
+ $LDFLAGS = %(/link /LIBPATH:"C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Lib" /LIBPATH:"C:\\Program Files\\ImageMagick-#{$magick_version}-Q8\\lib" /LIBPATH:"C:\\ruby\\lib")
158
151
  $LOCAL_LIBS = 'CORE_RL_magick_.lib'
159
152
  have_library('X11')
160
153
 
@@ -162,11 +155,11 @@ module RMagick
162
155
  end
163
156
 
164
157
  # Test for a specific value in an enum type
165
- def have_enum_value(enum, value, headers=nil, &b)
158
+ def have_enum_value(enum, value, headers = nil, &b)
166
159
  checking_for "#{enum}.#{value}" do
167
160
  if try_compile(<<"SRC", &b)
168
161
  #{COMMON_HEADERS}
169
- #{cpp_include(headers)}
162
+ #{cpp_include(headers)}
170
163
  /*top*/
171
164
  int main() { #{enum} t = #{value}; t = t; return 0; }
172
165
  SRC
@@ -179,7 +172,7 @@ SRC
179
172
  end
180
173
 
181
174
  # Test for multiple values of the same enum type
182
- def have_enum_values(enum, values, headers=nil, &b)
175
+ def have_enum_values(enum, values, headers = nil, &b)
183
176
  values.each do |value|
184
177
  have_enum_value(enum, value, headers, &b)
185
178
  end
@@ -192,7 +185,7 @@ SRC
192
185
  File.readlink(config_path) =~ /GraphicsMagick/
193
186
  msg = 'Found a graphicsmagick-libmagick-dev-compat installation.'
194
187
  Logging.message msg
195
- message msg+"\n"
188
+ message msg + "\n"
196
189
  true
197
190
  else
198
191
  false
@@ -201,7 +194,7 @@ SRC
201
194
 
202
195
  def exit_failure(msg)
203
196
  Logging.message msg
204
- message msg+"\n"
197
+ message msg + "\n"
205
198
  exit(1)
206
199
  end
207
200
 
@@ -211,22 +204,22 @@ SRC
211
204
  path = ENV['PATH'].split(File::PATH_SEPARATOR)
212
205
  path.each do |dir|
213
206
  file = File.join(dir, 'Magick-config')
214
- if File.executable? file
215
- vers = `#{file} --version`.chomp.strip
216
- prefix = `#{file} --prefix`.chomp.strip
217
- versions << [vers, prefix, dir]
218
- end
207
+ next unless File.executable? file
208
+
209
+ vers = `#{file} --version`.chomp.strip
210
+ prefix = `#{file} --prefix`.chomp.strip
211
+ versions << [vers, prefix, dir]
219
212
  end
220
213
  versions.uniq!
221
- if versions.size > 1
222
- msg = "\nWarning: Found more than one ImageMagick installation. This could cause problems at runtime.\n"
223
- versions.each do |vers, prefix, dir|
224
- msg << " #{dir}/Magick-config reports version #{vers} is installed in #{prefix}\n"
225
- end
226
- msg << "Using #{versions[0][0]} from #{versions[0][1]}.\n\n"
227
- Logging.message msg
228
- message msg
214
+ return unless versions.size > 1
215
+
216
+ msg = "\nWarning: Found more than one ImageMagick installation. This could cause problems at runtime.\n"
217
+ versions.each do |vers, prefix, dir|
218
+ msg << " #{dir}/Magick-config reports version #{vers} is installed in #{prefix}\n"
229
219
  end
220
+ msg << "Using #{versions[0][0]} from #{versions[0][1]}.\n\n"
221
+ Logging.message msg
222
+ message msg
230
223
  end
231
224
 
232
225
  # Ubuntu (maybe other systems) comes with a partial installation of
@@ -236,18 +229,18 @@ SRC
236
229
  def check_partial_imagemagick_versions
237
230
  prefix = config_string('prefix') || ''
238
231
  matches = [
239
- prefix+'/lib/lib?agick*',
240
- prefix+'/include/ImageMagick',
241
- prefix+'/bin/Magick-config',
232
+ prefix + '/lib/lib?agick*',
233
+ prefix + '/include/ImageMagick',
234
+ prefix + '/bin/Magick-config'
242
235
  ].map do |file_glob|
243
236
  Dir.glob(file_glob)
244
237
  end
245
- matches.delete_if { |arr| arr.empty? }
246
- if 0 < matches.length && matches.length < 3
247
- msg = "\nWarning: Found a partial ImageMagick installation. Your operating system likely has some built-in ImageMagick libraries but not all of ImageMagick. This will most likely cause problems at both compile and runtime.\nFound partial installation at: "+prefix+"\n"
248
- Logging.message msg
249
- message msg
250
- end
238
+ matches.delete_if(&:empty?)
239
+ return unless !matches.empty? && matches.length < 3
240
+
241
+ msg = "\nWarning: Found a partial ImageMagick installation. Your operating system likely has some built-in ImageMagick libraries but not all of ImageMagick. This will most likely cause problems at both compile and runtime.\nFound partial installation at: " + prefix + "\n"
242
+ Logging.message msg
243
+ message msg
251
244
  end
252
245
 
253
246
  # issue #169
@@ -261,20 +254,16 @@ SRC
261
254
  archs = $ARCH_FLAG.scan(/-arch\s+(\S+)/).flatten
262
255
 
263
256
  archs.each do |arch|
264
- if fileinfo.include?(arch)
265
- archflags << "-arch #{arch}"
266
- end
257
+ archflags << "-arch #{arch}" if fileinfo.include?(arch)
267
258
  end
268
259
 
269
- if archflags.length != 0
270
- $ARCH_FLAG = archflags.join(' ')
271
- end
260
+ $ARCH_FLAG = archflags.join(' ') unless archflags.empty?
272
261
  end
273
262
 
274
263
  def search_paths_for_library_for_mingw
275
264
  msg = 'searching PATH for the ImageMagick library...'
276
265
  Logging.message msg
277
- message msg+"\n"
266
+ message msg + "\n"
278
267
 
279
268
  found_lib = false
280
269
 
@@ -282,16 +271,17 @@ SRC
282
271
  paths.each do |dir|
283
272
  lib = File.join(dir, 'lib')
284
273
  lib_file = File.join(lib, 'CORE_RL_magick_.lib')
285
- if File.exist?(lib_file)
286
- $CPPFLAGS = %Q{-I"#{File.join(dir, 'include')}"}
287
- $LDFLAGS = %Q{-L"#{lib}"}
288
- found_lib = have_library('CORE_RL_magick_')
289
- break if found_lib
290
- end
274
+ next unless File.exist?(lib_file)
275
+
276
+ $CPPFLAGS = %(-I"#{File.join(dir, 'include')}")
277
+ $LDFLAGS = %(-L"#{lib}")
278
+ found_lib = have_library('CORE_RL_magick_')
279
+ break if found_lib
291
280
  end
292
281
 
293
- unless found_lib
294
- exit_failure <<END_MINGW
282
+ return if found_lib
283
+
284
+ exit_failure <<END_MINGW
295
285
  Can't install RMagick #{RMAGICK_VERS}.
296
286
  Can't find the ImageMagick library.
297
287
  Retry with '--with-opt-dir' option.
@@ -299,7 +289,6 @@ Usage: gem install rmagick -- '--with-opt-dir=\"[path to ImageMagick]\"'
299
289
  e.g.
300
290
  gem install rmagick -- '--with-opt-dir=\"C:\Program Files\ImageMagick-6.9.1-Q16\"'
301
291
  END_MINGW
302
- end
303
292
  end
304
293
 
305
294
  def assert_can_compile!
@@ -309,8 +298,9 @@ END_MINGW
309
298
  end
310
299
 
311
300
  def assert_not_windows!
312
- if RUBY_PLATFORM =~ /mswin/
313
- abort <<END_MSWIN
301
+ return unless RUBY_PLATFORM =~ /mswin/
302
+
303
+ abort <<END_MSWIN
314
304
  +----------------------------------------------------------------------------+
315
305
  | This rmagick gem is for use only on Linux, BSD, OS X, and similar systems |
316
306
  | that have a gnu or similar toolchain installed. The rmagick-win32 gem is a |
@@ -319,12 +309,11 @@ END_MINGW
319
309
  | See http://rmagick.rubyforge.org/install-faq.html for more information. |
320
310
  +----------------------------------------------------------------------------+
321
311
  END_MSWIN
322
- end
323
312
  end
324
313
 
325
314
  def assert_minimum_ruby_version!
326
315
  unless checking_for("Ruby version >= #{MIN_RUBY_VERS}") do
327
- version = RUBY_VERSION.tr('.','').to_i
316
+ version = RUBY_VERSION.tr('.', '').to_i
328
317
  version >= MIN_RUBY_VERS_NO
329
318
  end
330
319
  exit_failure "Can't install RMagick #{RMAGICK_VERS}. Ruby #{MIN_RUBY_VERS} or later required.\n"
@@ -332,71 +321,71 @@ END_MSWIN
332
321
  end
333
322
 
334
323
  def assert_has_dev_libs!
335
- if RUBY_PLATFORM !~ /mswin|mingw/
324
+ return unless RUBY_PLATFORM !~ /mswin|mingw/
336
325
 
337
- # check for pkg-config if Magick-config doesn't exist
338
- if $magick_config && `Magick-config --libs`[/\bl\s*(MagickCore|Magick)6?\b/]
339
- elsif $pkg_config && `pkg-config --libs MagickCore`[/\bl\s*(MagickCore|Magick)6?\b/]
340
- else
341
- exit_failure "Can't install RMagick #{RMAGICK_VERS}. " \
326
+ # check for pkg-config if Magick-config doesn't exist
327
+ if $magick_config && `Magick-config --libs`[/\bl\s*(MagickCore|Magick)6?\b/]
328
+ elsif $pkg_config && `pkg-config --libs MagickCore`[/\bl\s*(MagickCore|Magick)6?\b/]
329
+ else
330
+ exit_failure "Can't install RMagick #{RMAGICK_VERS}. " \
342
331
  "Can't find the ImageMagick library or one of the dependent libraries. " \
343
332
  "Check the mkmf.log file for more detailed information.\n"
344
- end
345
333
  end
346
334
  end
347
335
 
348
336
  def create_header_file
349
337
  have_func('snprintf', headers)
350
- ['AcquireImage', # 6.4.1
351
- 'AffinityImage', # 6.4.3-6
352
- 'AffinityImages', # 6.4.3-6
353
- 'AutoGammaImageChannel', # 6.5.5-1
354
- 'AutoLevelImageChannel', # 6.5.5-1
355
- 'BlueShiftImage', # 6.5.4-3
356
- 'ColorMatrixImage', # 6.6.1-0
357
- 'ConstituteComponentTerminus', # 6.5.7-9
358
- 'DeskewImage', # 6.4.2-5
359
- 'DestroyConstitute', # 6.5.7-9(deprecated)
360
- 'EncipherImage', # 6.3.8-6
361
- 'EqualizeImageChannel', # 6.3.6-9
362
- 'EvaluateImages', # 6.8.6-4
363
- 'FloodfillPaintImage', # 6.3.7
364
- 'FunctionImageChannel', # 6.4.8-8
365
- 'GetAuthenticIndexQueue', # 6.4.5-6
366
- 'GetAuthenticPixels', # 6.4.5-6
367
- 'GetImageAlphaChannel', # 6.3.9-2
368
- 'GetMagickFeatures', # 6.5.7-1
369
- 'GetVirtualPixels', # 6.4.5-6
370
- 'LevelImageColors', # 6.4.2
371
- 'LevelColorsImageChannel', # 6.5.6-4
372
- 'LevelizeImageChannel', # 6.4.2
373
- 'LiquidRescaleImage', # 6.3.8-2
374
- 'MagickLibAddendum', # 6.5.9-1
375
- 'OpaquePaintImageChannel', # 6.3.7-10
376
- 'QueueAuthenticPixels', # 6.4.5-6
377
- 'RemapImage', # 6.4.4-0
378
- 'RemapImages', # 6.4.4-0
379
- 'RemoveImageArtifact', # 6.3.6
380
- 'RotationalBlurImage', # 6.8.8-9
381
- 'RotationalBlurImageChannel', # 6.8.8-9
382
- 'SelectiveBlurImageChannel', # 6.5.0-3
383
- 'SetImageAlphaChannel', # 6.3.6-9
384
- 'SetImageArtifact', # 6.3.6
385
- 'SetMagickMemoryMethods', # 6.4.1
386
- 'SparseColorImage', # 6.3.6-?
387
- 'StatisticImage', # 6.6.8-6
388
- 'SyncAuthenticPixels', # 6.4.5-6
389
- 'TransformImageColorspace', # 6.5.1
390
- 'TransparentPaintImage', # 6.3.7-10
391
- 'TransparentPaintImageChroma' # 6.4.5-6
338
+ ['AcquireImage', # 6.4.1
339
+ 'AffinityImage', # 6.4.3-6
340
+ 'AffinityImages', # 6.4.3-6
341
+ 'AutoGammaImageChannel', # 6.5.5-1
342
+ 'AutoLevelImageChannel', # 6.5.5-1
343
+ 'BlueShiftImage', # 6.5.4-3
344
+ 'ColorMatrixImage', # 6.6.1-0
345
+ 'ConstituteComponentTerminus', # 6.5.7-9
346
+ 'DeskewImage', # 6.4.2-5
347
+ 'DestroyConstitute', # 6.5.7-9(deprecated)
348
+ 'EncipherImage', # 6.3.8-6
349
+ 'EqualizeImageChannel', # 6.3.6-9
350
+ 'EvaluateImages', # 6.8.6-4
351
+ 'FloodfillPaintImage', # 6.3.7
352
+ 'FunctionImageChannel', # 6.4.8-8
353
+ 'GetAuthenticIndexQueue', # 6.4.5-6
354
+ 'GetAuthenticPixels', # 6.4.5-6
355
+ 'GetImageAlphaChannel', # 6.3.9-2
356
+ 'GetImageChannelEntropy', # 6.9.0-0
357
+ 'GetMagickFeatures', # 6.5.7-1
358
+ 'GetVirtualPixels', # 6.4.5-6
359
+ 'LevelImageColors', # 6.4.2
360
+ 'LevelColorsImageChannel', # 6.5.6-4
361
+ 'LevelizeImageChannel', # 6.4.2
362
+ 'LiquidRescaleImage', # 6.3.8-2
363
+ 'MagickLibAddendum', # 6.5.9-1
364
+ 'OpaquePaintImageChannel', # 6.3.7-10
365
+ 'QueueAuthenticPixels', # 6.4.5-6
366
+ 'RemapImage', # 6.4.4-0
367
+ 'RemapImages', # 6.4.4-0
368
+ 'RemoveImageArtifact', # 6.3.6
369
+ 'RotationalBlurImage', # 6.8.8-9
370
+ 'RotationalBlurImageChannel', # 6.8.8-9
371
+ 'SelectiveBlurImageChannel', # 6.5.0-3
372
+ 'SetImageAlphaChannel', # 6.3.6-9
373
+ 'SetImageArtifact', # 6.3.6
374
+ 'SetMagickMemoryMethods', # 6.4.1
375
+ 'SparseColorImage', # 6.3.6-?
376
+ 'StatisticImage', # 6.6.8-6
377
+ 'SyncAuthenticPixels', # 6.4.5-6
378
+ 'TransformImageColorspace', # 6.5.1
379
+ 'TransparentPaintImage', # 6.3.7-10
380
+ 'TransparentPaintImageChroma' # 6.4.5-6
392
381
  ].each do |func|
393
382
  have_func(func, headers)
394
383
  end
395
384
 
396
- checking_for('QueryMagickColorname() new signature') do
385
+ checking_for('QueryMagickColorname() new signature') do
397
386
  if try_compile(<<"SRC")
398
387
  #{COMMON_HEADERS}
399
- #{cpp_include(headers)}
388
+ #{cpp_include(headers)}
400
389
  /*top*/
401
390
  int main() {
402
391
  MagickBooleanType okay;
@@ -415,94 +404,88 @@ SRC
415
404
  end
416
405
  end
417
406
 
418
- have_struct_member('Image', 'type', headers) # ???
419
- have_struct_member('DrawInfo', 'kerning', headers) # 6.4.7-8
420
- have_struct_member('DrawInfo', 'interline_spacing', headers) # 6.5.5-8
421
- have_struct_member('DrawInfo', 'interword_spacing', headers) # 6.4.8-0
422
- have_type('DitherMethod', headers) # 6.4.2
423
- have_type('MagickFunction', headers) # 6.4.8-8
424
- have_type('ImageLayerMethod', headers) # 6.3.6 replaces MagickLayerMethod
407
+ have_struct_member('Image', 'type', headers) # ???
408
+ have_struct_member('DrawInfo', 'kerning', headers) # 6.4.7-8
409
+ have_struct_member('DrawInfo', 'interline_spacing', headers) # 6.5.5-8
410
+ have_struct_member('DrawInfo', 'interword_spacing', headers) # 6.4.8-0
411
+ have_type('DitherMethod', headers) # 6.4.2
412
+ have_type('MagickFunction', headers) # 6.4.8-8
413
+ have_type('ImageLayerMethod', headers) # 6.3.6 replaces MagickLayerMethod
425
414
  have_type('long double', headers)
426
- #have_type("unsigned long long", headers)
427
- #have_type("uint64_t", headers)
428
- #have_type("__int64", headers)
429
- #have_type("uintmax_t", headers)
430
- #check_sizeof("unsigned long", headers)
431
- #check_sizeof("Image *", headers)
432
-
433
- have_enum_values('AlphaChannelType', ['CopyAlphaChannel', # 6.4.3-7
434
- 'BackgroundAlphaChannel', # 6.5.2-5
435
- 'RemoveAlphaChannel'], headers) # 6.7.5-1
436
- have_enum_values('CompositeOperator', ['BlurCompositeOp', # 6.5.3-7
437
- 'DistortCompositeOp', # 6.5.3-10
438
- 'LinearBurnCompositeOp', # 6.5.4-3
439
- 'LinearDodgeCompositeOp', # 6.5.4-3
440
- 'MathematicsCompositeOp', # 6.5.4-3
441
- 'PegtopLightCompositeOp', # 6.5.4-3
442
- 'PinLightCompositeOp', # 6.5.4-3
443
- 'VividLightCompositeOp'], headers) # 6.5.4-3
444
- have_enum_values('CompressionType', ['DXT1Compression', # 6.3.9-3
445
- 'DXT3Compression', # 6.3.9-3
446
- 'DXT5Compression', # 6.3.9-3
447
- 'ZipSCompression', # 6.5.5-4
448
- 'PizCompression', # 6.5.5-4
449
- 'Pxr24Compression', # 6.5.5-4
450
- 'B44Compression', # 6.5.5-4
451
- 'B44ACompression'], headers) # 6.5.5-4
452
-
453
- have_enum_values('DistortImageMethod', ['BarrelDistortion', # 6.4.2-5
454
- 'BarrelInverseDistortion', # 6.4.3-8
455
- 'BilinearForwardDistortion', # 6.5.1-2
456
- 'BilinearReverseDistortion', # 6.5.1-2
457
- 'DePolarDistortion', # 6.4.2-6
458
- 'PolarDistortion', # 6.4.2-6
459
- 'PolynomialDistortion', # 6.4.2-4
460
- 'ShepardsDistortion'], headers) # 6.4.2-4
461
- have_enum_value('DitherMethod', 'NoDitherMethod', headers) # 6.4.3
462
- have_enum_values('FilterTypes', ['KaiserFilter', # 6.3.6
463
- 'WelshFilter', # 6.3.6-4
464
- 'ParzenFilter', # 6.3.6-4
465
- 'LagrangeFilter', # 6.3.7-2
466
- 'BohmanFilter', # 6.3.7-2
467
- 'BartlettFilter', # 6.3.7-2
468
- 'SentinelFilter'], headers) # 6.3.7-2
469
- have_enum_values('MagickEvaluateOperator', ['PowEvaluateOperator', # 6.4.1-9
470
- 'LogEvaluateOperator', # 6.4.2
471
- 'ThresholdEvaluateOperator', # 6.4.3
415
+ # have_type("unsigned long long", headers)
416
+ # have_type("uint64_t", headers)
417
+ # have_type("__int64", headers)
418
+ # have_type("uintmax_t", headers)
419
+ # check_sizeof("unsigned long", headers)
420
+ # check_sizeof("Image *", headers)
421
+
422
+ have_enum_values('AlphaChannelType', ['CopyAlphaChannel', # 6.4.3-7
423
+ 'BackgroundAlphaChannel', # 6.5.2-5
424
+ 'RemoveAlphaChannel'], headers) # 6.7.5-1
425
+ have_enum_values('CompositeOperator', ['BlurCompositeOp', # 6.5.3-7
426
+ 'DistortCompositeOp', # 6.5.3-10
427
+ 'LinearBurnCompositeOp', # 6.5.4-3
428
+ 'LinearDodgeCompositeOp', # 6.5.4-3
429
+ 'MathematicsCompositeOp', # 6.5.4-3
430
+ 'PegtopLightCompositeOp', # 6.5.4-3
431
+ 'PinLightCompositeOp', # 6.5.4-3
432
+ 'VividLightCompositeOp'], headers) # 6.5.4-3
433
+ have_enum_values('CompressionType', ['DXT1Compression', # 6.3.9-3
434
+ 'DXT3Compression', # 6.3.9-3
435
+ 'DXT5Compression', # 6.3.9-3
436
+ 'ZipSCompression', # 6.5.5-4
437
+ 'PizCompression', # 6.5.5-4
438
+ 'Pxr24Compression', # 6.5.5-4
439
+ 'B44Compression', # 6.5.5-4
440
+ 'B44ACompression'], headers) # 6.5.5-4
441
+
442
+ have_enum_values('DistortImageMethod', ['BarrelDistortion', # 6.4.2-5
443
+ 'BarrelInverseDistortion', # 6.4.3-8
444
+ 'BilinearForwardDistortion', # 6.5.1-2
445
+ 'BilinearReverseDistortion', # 6.5.1-2
446
+ 'DePolarDistortion', # 6.4.2-6
447
+ 'PolarDistortion', # 6.4.2-6
448
+ 'PolynomialDistortion', # 6.4.2-4
449
+ 'ShepardsDistortion'], headers) # 6.4.2-4
450
+ have_enum_value('DitherMethod', 'NoDitherMethod', headers) # 6.4.3
451
+ have_enum_values('FilterTypes', ['KaiserFilter', # 6.3.6
452
+ 'WelshFilter', # 6.3.6-4
453
+ 'ParzenFilter', # 6.3.6-4
454
+ 'LagrangeFilter', # 6.3.7-2
455
+ 'BohmanFilter', # 6.3.7-2
456
+ 'BartlettFilter', # 6.3.7-2
457
+ 'SentinelFilter'], headers) # 6.3.7-2
458
+ have_enum_values('MagickEvaluateOperator', ['PowEvaluateOperator', # 6.4.1-9
459
+ 'LogEvaluateOperator', # 6.4.2
460
+ 'ThresholdEvaluateOperator', # 6.4.3
472
461
  'ThresholdBlackEvaluateOperator', # 6.4.3
473
462
  'ThresholdWhiteEvaluateOperator', # 6.4.3
474
- 'GaussianNoiseEvaluateOperator', # 6.4.3
475
- 'ImpulseNoiseEvaluateOperator', # 6.4.3
463
+ 'GaussianNoiseEvaluateOperator', # 6.4.3
464
+ 'ImpulseNoiseEvaluateOperator', # 6.4.3
476
465
  'LaplacianNoiseEvaluateOperator', # 6.4.3
477
466
  'MultiplicativeNoiseEvaluateOperator', # 6.4.3
478
- 'PoissonNoiseEvaluateOperator', # 6.4.3
479
- 'UniformNoiseEvaluateOperator', # 6.4.3
480
- 'CosineEvaluateOperator', # 6.4.8-5
481
- 'SineEvaluateOperator', # 6.4.8-5
482
- 'AddModulusEvaluateOperator'], # 6.4.8-5
467
+ 'PoissonNoiseEvaluateOperator', # 6.4.3
468
+ 'UniformNoiseEvaluateOperator', # 6.4.3
469
+ 'CosineEvaluateOperator', # 6.4.8-5
470
+ 'SineEvaluateOperator', # 6.4.8-5
471
+ 'AddModulusEvaluateOperator'], # 6.4.8-5
483
472
  headers)
484
- have_enum_values('MagickFunction', ['ArcsinFunction', # 6.5.2-8
485
- 'ArctanFunction', # 6.5.2-8
486
- 'PolynomialFunction', # 6.4.8-8
487
- 'SinusoidFunction'], headers) # 6.4.8-8
488
- have_enum_values('ImageLayerMethod', ['FlattenLayer', # 6.3.6-2
489
- 'MergeLayer', # 6.3.6
490
- 'MosaicLayer', # 6.3.6-2
491
- 'TrimBoundsLayer' ], headers) # 6.4.3-8
492
- have_enum_values('VirtualPixelMethod', ['HorizontalTileVirtualPixelMethod', # 6.4.2-6
493
- 'VerticalTileVirtualPixelMethod', # 6.4.2-6
473
+ have_enum_values('MagickFunction', ['ArcsinFunction', # 6.5.2-8
474
+ 'ArctanFunction', # 6.5.2-8
475
+ 'PolynomialFunction', # 6.4.8-8
476
+ 'SinusoidFunction'], headers) # 6.4.8-8
477
+ have_enum_values('ImageLayerMethod', ['FlattenLayer', # 6.3.6-2
478
+ 'MergeLayer', # 6.3.6
479
+ 'MosaicLayer', # 6.3.6-2
480
+ 'TrimBoundsLayer'], headers) # 6.4.3-8
481
+ have_enum_values('VirtualPixelMethod', ['HorizontalTileVirtualPixelMethod', # 6.4.2-6
482
+ 'VerticalTileVirtualPixelMethod', # 6.4.2-6
494
483
  'HorizontalTileEdgeVirtualPixelMethod', # 6.5.0-1
495
- 'VerticalTileEdgeVirtualPixelMethod', # 6.5.0-1
496
- 'CheckerTileVirtualPixelMethod'], # 6.5.0-1
484
+ 'VerticalTileEdgeVirtualPixelMethod', # 6.5.0-1
485
+ 'CheckerTileVirtualPixelMethod'], # 6.5.0-1
497
486
  headers)
498
487
 
499
- # Now test Ruby 1.9.0 features.
500
- headers = ['ruby.h']
501
- if have_header('ruby/io.h')
502
- headers << 'ruby/io.h'
503
- else
504
- headers << 'rubyio.h'
505
- end
488
+ headers = ['ruby.h', 'ruby/io.h']
506
489
 
507
490
  have_func('rb_frame_this_func', headers)
508
491
 
@@ -531,10 +514,10 @@ SRC
531
514
 
532
515
 
533
516
  #{'=' * 70}
534
- #{DateTime.now.strftime('%a %d%b%y %T')}
517
+ #{DateTime.now.strftime('%a %d%b%y %T')}
535
518
  This installation of RMagick #{RMAGICK_VERS} is configured for
536
519
  Ruby #{RUBY_VERSION} (#{RUBY_PLATFORM}) and ImageMagick #{$magick_version}
537
- #{'=' * 70}
520
+ #{'=' * 70}
538
521
 
539
522
 
540
523
  END_SUMMARY
@@ -549,6 +532,6 @@ extconf = RMagick::Extconf.new
549
532
  at_exit do
550
533
  msg = "Configured compile options: #{extconf.configured_compile_options}"
551
534
  Logging.message msg
552
- message msg+"\n"
535
+ message msg + "\n"
553
536
  end
554
537
  extconf.create_makefile_file