rmagick 4.1.0.rc2 → 4.1.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 (412) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +63 -0
  3. data/.editorconfig +3 -0
  4. data/.github/workflows/ci.yml +148 -0
  5. data/.gitignore +3 -1
  6. data/.rspec +1 -0
  7. data/.rubocop.yml +24 -0
  8. data/.rubocop_todo.yml +80 -270
  9. data/.yardopts +5 -0
  10. data/CHANGELOG.md +63 -0
  11. data/CONTRIBUTING.md +14 -10
  12. data/README.md +292 -0
  13. data/Rakefile +16 -22
  14. data/before_install_linux.sh +22 -32
  15. data/before_install_osx.sh +56 -2
  16. data/ext/RMagick/extconf.rb +100 -94
  17. data/ext/RMagick/rmagick.c +77 -104
  18. data/ext/RMagick/rmagick.h +74 -70
  19. data/ext/RMagick/rmdraw.c +261 -444
  20. data/ext/RMagick/rmenum.c +96 -113
  21. data/ext/RMagick/rmfill.c +46 -77
  22. data/ext/RMagick/rmilist.c +136 -244
  23. data/ext/RMagick/rmimage.c +3395 -4166
  24. data/ext/RMagick/rminfo.c +531 -737
  25. data/ext/RMagick/rmkinfo.c +21 -87
  26. data/ext/RMagick/rmmain.c +405 -245
  27. data/ext/RMagick/rmmontage.c +60 -126
  28. data/ext/RMagick/rmpixel.c +401 -345
  29. data/ext/RMagick/rmstruct.c +62 -88
  30. data/ext/RMagick/rmutil.c +112 -218
  31. data/lib/rmagick/version.rb +1 -1
  32. data/lib/rmagick_internal.rb +128 -77
  33. data/lib/rvg/clippath.rb +2 -1
  34. data/lib/rvg/container.rb +10 -5
  35. data/lib/rvg/describable.rb +1 -1
  36. data/lib/rvg/embellishable.rb +5 -4
  37. data/lib/rvg/misc.rb +15 -12
  38. data/lib/rvg/paint.rb +2 -1
  39. data/lib/rvg/pathdata.rb +12 -11
  40. data/lib/rvg/rvg.rb +8 -4
  41. data/lib/rvg/stylable.rb +9 -7
  42. data/lib/rvg/text.rb +11 -6
  43. data/lib/rvg/transformable.rb +3 -2
  44. data/lib/rvg/units.rb +1 -1
  45. data/rmagick.gemspec +7 -6
  46. metadata +31 -421
  47. data/.appveyor.yml +0 -57
  48. data/.circleci/config.yml +0 -56
  49. data/.ruby-version +0 -1
  50. data/.simplecov +0 -27
  51. data/.travis.yml +0 -64
  52. data/Doxyfile +0 -1514
  53. data/README.textile +0 -259
  54. data/benchmarks/memory/README.md +0 -50
  55. data/benchmarks/memory/image_new.rb +0 -8
  56. data/benchmarks/memory/rmagick.gnuplot +0 -16
  57. data/doc/.cvsignore +0 -1
  58. data/doc/comtasks.html +0 -287
  59. data/doc/constants.html +0 -1581
  60. data/doc/css/doc.css +0 -299
  61. data/doc/css/popup.css +0 -34
  62. data/doc/css/ref.css +0 -67
  63. data/doc/draw.html +0 -3272
  64. data/doc/ex/InitialCoords.rb +0 -22
  65. data/doc/ex/NewCoordSys.rb +0 -30
  66. data/doc/ex/OrigCoordSys.rb +0 -16
  67. data/doc/ex/PreserveAspectRatio.rb +0 -204
  68. data/doc/ex/RotateScale.rb +0 -36
  69. data/doc/ex/Skew.rb +0 -38
  70. data/doc/ex/Use01.rb +0 -15
  71. data/doc/ex/Use02.rb +0 -20
  72. data/doc/ex/Use03.rb +0 -16
  73. data/doc/ex/ViewBox.rb +0 -31
  74. data/doc/ex/adaptive_threshold.rb +0 -9
  75. data/doc/ex/add_noise.rb +0 -16
  76. data/doc/ex/affine.rb +0 -48
  77. data/doc/ex/affine_transform.rb +0 -20
  78. data/doc/ex/arc.rb +0 -49
  79. data/doc/ex/arcpath.rb +0 -32
  80. data/doc/ex/arcs01.rb +0 -28
  81. data/doc/ex/arcs02.rb +0 -59
  82. data/doc/ex/average.rb +0 -15
  83. data/doc/ex/axes.rb +0 -64
  84. data/doc/ex/baseline_shift01.rb +0 -17
  85. data/doc/ex/bilevel_channel.rb +0 -8
  86. data/doc/ex/blur_image.rb +0 -12
  87. data/doc/ex/border.rb +0 -10
  88. data/doc/ex/bounding_box.rb +0 -42
  89. data/doc/ex/cbezier1.rb +0 -41
  90. data/doc/ex/cbezier2.rb +0 -41
  91. data/doc/ex/cbezier3.rb +0 -41
  92. data/doc/ex/cbezier4.rb +0 -42
  93. data/doc/ex/cbezier5.rb +0 -42
  94. data/doc/ex/cbezier6.rb +0 -53
  95. data/doc/ex/channel.rb +0 -25
  96. data/doc/ex/charcoal.rb +0 -12
  97. data/doc/ex/chop.rb +0 -29
  98. data/doc/ex/circle.rb +0 -33
  99. data/doc/ex/circle01.rb +0 -16
  100. data/doc/ex/clip_path.rb +0 -60
  101. data/doc/ex/coalesce.rb +0 -57
  102. data/doc/ex/color_fill_to_border.rb +0 -29
  103. data/doc/ex/color_floodfill.rb +0 -28
  104. data/doc/ex/color_histogram.rb +0 -47
  105. data/doc/ex/color_reset.rb +0 -11
  106. data/doc/ex/colorize.rb +0 -16
  107. data/doc/ex/colors.rb +0 -64
  108. data/doc/ex/compose_mask.rb +0 -22
  109. data/doc/ex/composite.rb +0 -133
  110. data/doc/ex/composite_layers.rb +0 -52
  111. data/doc/ex/composite_tiled.rb +0 -21
  112. data/doc/ex/contrast.rb +0 -36
  113. data/doc/ex/crop.rb +0 -31
  114. data/doc/ex/crop_with_gravity.rb +0 -42
  115. data/doc/ex/cubic01.rb +0 -43
  116. data/doc/ex/cubic02.rb +0 -91
  117. data/doc/ex/cycle_colormap.rb +0 -21
  118. data/doc/ex/dissolve.rb +0 -12
  119. data/doc/ex/drawcomp.rb +0 -41
  120. data/doc/ex/drop_shadow.rb +0 -60
  121. data/doc/ex/edge.rb +0 -11
  122. data/doc/ex/ellipse.rb +0 -45
  123. data/doc/ex/ellipse01.rb +0 -21
  124. data/doc/ex/emboss.rb +0 -11
  125. data/doc/ex/enhance.rb +0 -28
  126. data/doc/ex/equalize.rb +0 -11
  127. data/doc/ex/evenodd.rb +0 -42
  128. data/doc/ex/fill_pattern.rb +0 -23
  129. data/doc/ex/flatten_images.rb +0 -36
  130. data/doc/ex/flip.rb +0 -11
  131. data/doc/ex/flop.rb +0 -11
  132. data/doc/ex/font_styles.rb +0 -32
  133. data/doc/ex/fonts.rb +0 -16
  134. data/doc/ex/frame.rb +0 -12
  135. data/doc/ex/gaussian_blur.rb +0 -11
  136. data/doc/ex/get_multiline_type_metrics.rb +0 -41
  137. data/doc/ex/get_pixels.rb +0 -45
  138. data/doc/ex/get_type_metrics.rb +0 -142
  139. data/doc/ex/gradientfill.rb +0 -27
  140. data/doc/ex/grav.rb +0 -45
  141. data/doc/ex/gravity.rb +0 -78
  142. data/doc/ex/group.rb +0 -26
  143. data/doc/ex/hatchfill.rb +0 -27
  144. data/doc/ex/image.rb +0 -44
  145. data/doc/ex/images/Apple.miff +0 -0
  146. data/doc/ex/images/Ballerina.jpg +0 -0
  147. data/doc/ex/images/Ballerina3.jpg +0 -0
  148. data/doc/ex/images/Button_0.gif +0 -0
  149. data/doc/ex/images/Button_1.gif +0 -0
  150. data/doc/ex/images/Button_2.gif +0 -0
  151. data/doc/ex/images/Button_3.gif +0 -0
  152. data/doc/ex/images/Button_4.gif +0 -0
  153. data/doc/ex/images/Button_5.gif +0 -0
  154. data/doc/ex/images/Button_6.gif +0 -0
  155. data/doc/ex/images/Button_7.gif +0 -0
  156. data/doc/ex/images/Button_8.gif +0 -0
  157. data/doc/ex/images/Button_9.gif +0 -0
  158. data/doc/ex/images/Button_A.gif +0 -0
  159. data/doc/ex/images/Button_B.gif +0 -0
  160. data/doc/ex/images/Button_C.gif +0 -0
  161. data/doc/ex/images/Button_D.gif +0 -0
  162. data/doc/ex/images/Button_E.gif +0 -0
  163. data/doc/ex/images/Button_F.gif +0 -0
  164. data/doc/ex/images/Button_G.gif +0 -0
  165. data/doc/ex/images/Button_H.gif +0 -0
  166. data/doc/ex/images/Button_I.gif +0 -0
  167. data/doc/ex/images/Button_J.gif +0 -0
  168. data/doc/ex/images/Button_K.gif +0 -0
  169. data/doc/ex/images/Button_L.gif +0 -0
  170. data/doc/ex/images/Button_M.gif +0 -0
  171. data/doc/ex/images/Button_N.gif +0 -0
  172. data/doc/ex/images/Button_O.gif +0 -0
  173. data/doc/ex/images/Button_P.gif +0 -0
  174. data/doc/ex/images/Button_Q.gif +0 -0
  175. data/doc/ex/images/Button_R.gif +0 -0
  176. data/doc/ex/images/Button_S.gif +0 -0
  177. data/doc/ex/images/Button_T.gif +0 -0
  178. data/doc/ex/images/Button_U.gif +0 -0
  179. data/doc/ex/images/Button_V.gif +0 -0
  180. data/doc/ex/images/Button_W.gif +0 -0
  181. data/doc/ex/images/Button_X.gif +0 -0
  182. data/doc/ex/images/Button_Y.gif +0 -0
  183. data/doc/ex/images/Button_Z.gif +0 -0
  184. data/doc/ex/images/Cheetah.jpg +0 -0
  185. data/doc/ex/images/Coffee.png +0 -0
  186. data/doc/ex/images/Flower_Hat.jpg +0 -0
  187. data/doc/ex/images/Gold_Statue.jpg +0 -0
  188. data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
  189. data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
  190. data/doc/ex/images/Leaf.miff +0 -0
  191. data/doc/ex/images/No.png +0 -0
  192. data/doc/ex/images/Polynesia.jpg +0 -0
  193. data/doc/ex/images/Red_Rocks.jpg +0 -0
  194. data/doc/ex/images/Rocks_On_Beach.miff +0 -0
  195. data/doc/ex/images/Shorts.jpg +0 -0
  196. data/doc/ex/images/Snake.png +0 -0
  197. data/doc/ex/images/Violin.jpg +0 -0
  198. data/doc/ex/images/Yellow_Rose.miff +0 -0
  199. data/doc/ex/images/big-duck.gif +0 -0
  200. data/doc/ex/images/duck.gif +0 -0
  201. data/doc/ex/images/duck0.gif +0 -0
  202. data/doc/ex/images/duck1.gif +0 -0
  203. data/doc/ex/images/duck10.gif +0 -0
  204. data/doc/ex/images/duck11.gif +0 -0
  205. data/doc/ex/images/duck12.gif +0 -0
  206. data/doc/ex/images/duck13.gif +0 -0
  207. data/doc/ex/images/duck14.gif +0 -0
  208. data/doc/ex/images/duck15.gif +0 -0
  209. data/doc/ex/images/duck2.gif +0 -0
  210. data/doc/ex/images/duck3.gif +0 -0
  211. data/doc/ex/images/duck4.gif +0 -0
  212. data/doc/ex/images/duck5.gif +0 -0
  213. data/doc/ex/images/duck6.gif +0 -0
  214. data/doc/ex/images/duck7.gif +0 -0
  215. data/doc/ex/images/duck8.gif +0 -0
  216. data/doc/ex/images/duck9.gif +0 -0
  217. data/doc/ex/images/graydient230x6.gif +0 -0
  218. data/doc/ex/images/image_with_profile.jpg +0 -0
  219. data/doc/ex/images/logo400x83.gif +0 -0
  220. data/doc/ex/images/model.miff +0 -0
  221. data/doc/ex/images/notimplemented.gif +0 -0
  222. data/doc/ex/images/smile.miff +0 -0
  223. data/doc/ex/images/spin.gif +0 -0
  224. data/doc/ex/implode.rb +0 -34
  225. data/doc/ex/level.rb +0 -11
  226. data/doc/ex/level_colors.rb +0 -11
  227. data/doc/ex/line.rb +0 -41
  228. data/doc/ex/line01.rb +0 -21
  229. data/doc/ex/mask.rb +0 -35
  230. data/doc/ex/matte_fill_to_border.rb +0 -39
  231. data/doc/ex/matte_floodfill.rb +0 -32
  232. data/doc/ex/matte_replace.rb +0 -39
  233. data/doc/ex/median_filter.rb +0 -28
  234. data/doc/ex/modulate.rb +0 -11
  235. data/doc/ex/mono.rb +0 -23
  236. data/doc/ex/morph.rb +0 -25
  237. data/doc/ex/mosaic.rb +0 -37
  238. data/doc/ex/motion_blur.rb +0 -11
  239. data/doc/ex/negate.rb +0 -11
  240. data/doc/ex/negate_channel.rb +0 -9
  241. data/doc/ex/nested_rvg.rb +0 -21
  242. data/doc/ex/nonzero.rb +0 -42
  243. data/doc/ex/normalize.rb +0 -11
  244. data/doc/ex/oil_paint.rb +0 -11
  245. data/doc/ex/opacity.rb +0 -37
  246. data/doc/ex/ordered_dither.rb +0 -11
  247. data/doc/ex/path.rb +0 -63
  248. data/doc/ex/pattern1.rb +0 -25
  249. data/doc/ex/pattern2.rb +0 -26
  250. data/doc/ex/polaroid.rb +0 -26
  251. data/doc/ex/polygon.rb +0 -23
  252. data/doc/ex/polygon01.rb +0 -21
  253. data/doc/ex/polyline.rb +0 -22
  254. data/doc/ex/polyline01.rb +0 -21
  255. data/doc/ex/posterize.rb +0 -8
  256. data/doc/ex/preview.rb +0 -8
  257. data/doc/ex/qbezierpath.rb +0 -52
  258. data/doc/ex/quad01.rb +0 -34
  259. data/doc/ex/quantize-m.rb +0 -25
  260. data/doc/ex/radial_blur.rb +0 -9
  261. data/doc/ex/raise.rb +0 -8
  262. data/doc/ex/random_threshold_channel.rb +0 -13
  263. data/doc/ex/rect01.rb +0 -14
  264. data/doc/ex/rect02.rb +0 -20
  265. data/doc/ex/rectangle.rb +0 -34
  266. data/doc/ex/reduce_noise.rb +0 -28
  267. data/doc/ex/remap.rb +0 -11
  268. data/doc/ex/remap_images.rb +0 -19
  269. data/doc/ex/resize_to_fill.rb +0 -8
  270. data/doc/ex/resize_to_fit.rb +0 -8
  271. data/doc/ex/roll.rb +0 -9
  272. data/doc/ex/rotate.rb +0 -44
  273. data/doc/ex/rotate_f.rb +0 -14
  274. data/doc/ex/roundrect.rb +0 -33
  275. data/doc/ex/rubyname.rb +0 -30
  276. data/doc/ex/rvg_clippath.rb +0 -12
  277. data/doc/ex/rvg_linecap.rb +0 -42
  278. data/doc/ex/rvg_linejoin.rb +0 -40
  279. data/doc/ex/rvg_opacity.rb +0 -18
  280. data/doc/ex/rvg_pattern.rb +0 -26
  281. data/doc/ex/rvg_stroke_dasharray.rb +0 -11
  282. data/doc/ex/segment.rb +0 -11
  283. data/doc/ex/sepiatone.rb +0 -7
  284. data/doc/ex/shade.rb +0 -11
  285. data/doc/ex/shadow.rb +0 -30
  286. data/doc/ex/shave.rb +0 -15
  287. data/doc/ex/shear.rb +0 -10
  288. data/doc/ex/sketch.rb +0 -17
  289. data/doc/ex/skewx.rb +0 -51
  290. data/doc/ex/skewy.rb +0 -47
  291. data/doc/ex/smile.rb +0 -126
  292. data/doc/ex/solarize.rb +0 -11
  293. data/doc/ex/sparse_color.rb +0 -55
  294. data/doc/ex/splice.rb +0 -8
  295. data/doc/ex/spread.rb +0 -11
  296. data/doc/ex/stegano.rb +0 -54
  297. data/doc/ex/stroke_dasharray.rb +0 -42
  298. data/doc/ex/stroke_fill.rb +0 -10
  299. data/doc/ex/stroke_linecap.rb +0 -44
  300. data/doc/ex/stroke_linejoin.rb +0 -48
  301. data/doc/ex/stroke_width.rb +0 -49
  302. data/doc/ex/swirl.rb +0 -17
  303. data/doc/ex/text.rb +0 -37
  304. data/doc/ex/text01.rb +0 -16
  305. data/doc/ex/text_align.rb +0 -36
  306. data/doc/ex/text_antialias.rb +0 -37
  307. data/doc/ex/text_styles.rb +0 -19
  308. data/doc/ex/text_undercolor.rb +0 -28
  309. data/doc/ex/texture_fill_to_border.rb +0 -34
  310. data/doc/ex/texture_floodfill.rb +0 -32
  311. data/doc/ex/texturefill.rb +0 -24
  312. data/doc/ex/threshold.rb +0 -13
  313. data/doc/ex/to_blob.rb +0 -13
  314. data/doc/ex/translate.rb +0 -39
  315. data/doc/ex/transparent.rb +0 -38
  316. data/doc/ex/transpose.rb +0 -9
  317. data/doc/ex/transverse.rb +0 -9
  318. data/doc/ex/tref01.rb +0 -24
  319. data/doc/ex/triangle01.rb +0 -15
  320. data/doc/ex/trim.rb +0 -23
  321. data/doc/ex/tspan01.rb +0 -17
  322. data/doc/ex/tspan02.rb +0 -17
  323. data/doc/ex/tspan03.rb +0 -19
  324. data/doc/ex/unsharp_mask.rb +0 -28
  325. data/doc/ex/viewex.rb +0 -33
  326. data/doc/ex/vignette.rb +0 -12
  327. data/doc/ex/watermark.rb +0 -27
  328. data/doc/ex/wave.rb +0 -9
  329. data/doc/ex/wet_floor.rb +0 -58
  330. data/doc/ex/writing_mode01.rb +0 -26
  331. data/doc/ex/writing_mode02.rb +0 -26
  332. data/doc/ilist.html +0 -2056
  333. data/doc/image1.html +0 -4680
  334. data/doc/image2.html +0 -3665
  335. data/doc/image3.html +0 -4522
  336. data/doc/imageattrs.html +0 -1638
  337. data/doc/imusage.html +0 -514
  338. data/doc/index.html +0 -416
  339. data/doc/info.html +0 -1499
  340. data/doc/magick.html +0 -570
  341. data/doc/optequiv.html +0 -2435
  342. data/doc/rvg.html +0 -975
  343. data/doc/rvgclip.html +0 -248
  344. data/doc/rvggroup.html +0 -305
  345. data/doc/rvgimage.html +0 -289
  346. data/doc/rvgpattern.html +0 -475
  347. data/doc/rvgshape.html +0 -406
  348. data/doc/rvgstyle.html +0 -270
  349. data/doc/rvgtext.html +0 -465
  350. data/doc/rvgtspan.html +0 -238
  351. data/doc/rvgtut.html +0 -530
  352. data/doc/rvguse.html +0 -145
  353. data/doc/rvgxform.html +0 -294
  354. data/doc/scripts/doc.js +0 -22
  355. data/doc/scripts/stripeTables.js +0 -23
  356. data/doc/struct.html +0 -1339
  357. data/doc/usage.html +0 -1621
  358. data/examples/constitute.rb +0 -7
  359. data/examples/crop_with_gravity.rb +0 -43
  360. data/examples/demo.rb +0 -323
  361. data/examples/describe.rb +0 -41
  362. data/examples/find_similar_region.rb +0 -34
  363. data/examples/histogram.rb +0 -312
  364. data/examples/identify.rb +0 -174
  365. data/examples/image_opacity.rb +0 -28
  366. data/examples/import_export.rb +0 -31
  367. data/examples/pattern_fill.rb +0 -37
  368. data/examples/rotating_text.rb +0 -45
  369. data/examples/spinner.rb +0 -49
  370. data/examples/thumbnail.rb +0 -64
  371. data/examples/vignette.rb +0 -78
  372. data/spec/rmagick/ImageList1_spec.rb +0 -24
  373. data/spec/rmagick/draw_spec.rb +0 -155
  374. data/spec/rmagick/image/blue_shift_spec.rb +0 -14
  375. data/spec/rmagick/image/channel_entropy_spec.rb +0 -9
  376. data/spec/rmagick/image/composite_spec.rb +0 -72
  377. data/spec/rmagick/image/constitute_spec.rb +0 -13
  378. data/spec/rmagick/image/dispatch_spec.rb +0 -16
  379. data/spec/rmagick/image/dissolve_spec.rb +0 -54
  380. data/spec/rmagick/image/from_blob_spec.rb +0 -12
  381. data/spec/rmagick/image/ping_spec.rb +0 -12
  382. data/spec/rmagick/image/properties_spec.rb +0 -27
  383. data/spec/rmagick/image/read_spec.rb +0 -28
  384. data/spec/spec_helper.rb +0 -9
  385. data/spec/support/issue_200/app.rb +0 -8
  386. data/test/Draw.rb +0 -351
  387. data/test/Enum.rb +0 -228
  388. data/test/Fill.rb +0 -93
  389. data/test/Image1.rb +0 -606
  390. data/test/Image2.rb +0 -1408
  391. data/test/Image3.rb +0 -1086
  392. data/test/ImageList1.rb +0 -858
  393. data/test/ImageList2.rb +0 -375
  394. data/test/Image_attributes.rb +0 -635
  395. data/test/Import_Export.rb +0 -111
  396. data/test/Info.rb +0 -436
  397. data/test/KernelInfo.rb +0 -59
  398. data/test/Magick.rb +0 -311
  399. data/test/Pixel.rb +0 -259
  400. data/test/PolaroidOptions.rb +0 -23
  401. data/test/Preview.rb +0 -26
  402. data/test/Struct.rb +0 -45
  403. data/test/appearance/Montage.rb +0 -26
  404. data/test/appearance/appearance_assertion.rb +0 -13
  405. data/test/appearance/expected/montage_border_color.jpg +0 -0
  406. data/test/cmyk.icm +0 -0
  407. data/test/lib/internal/Draw.rb +0 -811
  408. data/test/lib/internal/Geometry.rb +0 -98
  409. data/test/lib/internal/Magick.rb +0 -40
  410. data/test/srgb.icm +0 -0
  411. data/test/test_all_basic.rb +0 -49
  412. data/test/tmpnam_test.rb +0 -50
@@ -1,23 +0,0 @@
1
- // Alternate gray/white rows in all the tables having the class "striped"
2
- function stripeTables() {
3
- if (!document.getElementsByTagName) {
4
- return false;
5
- }
6
- var tables = document.getElementsByTagName("table");
7
- for (var i = 0; i < tables.length; i++) {
8
- if (tables[i].className == "striped") {
9
- var gray = true;
10
- var rows = tables[i].getElementsByTagName("tr");
11
- for (var j = 0; j < rows.length; j++) {
12
- if (gray) {
13
- rows[j].style.backgroundColor = "#f0f0f0";
14
- gray = false;
15
- }
16
- else {
17
- gray = true;
18
- }
19
- }
20
- }
21
- }
22
- }
23
-
@@ -1,1339 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml">
5
- <head>
6
- <meta name="generator" content=
7
- "HTML Tidy for Linux/x86 (vers 6 November 2007), see www.w3.org" />
8
-
9
- <title>RMagick 0.0.0: Miscellaneous classes</title>
10
- <meta http-equiv="Content-Type" content=
11
- "text/html; charset=us-ascii" />
12
- <meta name="GENERATOR" content="Quanta Plus" />
13
- <meta name="Copyright" content=
14
- "Copyright (C) 2006 by Timothy P. Hunter" />
15
- <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
- <link rel="stylesheet" type="text/css" href="css/ref.css" />
17
- <script type="text/javascript" src="scripts/doc.js">
18
- </script>
19
- <style type="text/css">
20
- /*<![CDATA[*/
21
-
22
- /* Styles local to this page. */
23
-
24
-
25
- /*]]>*/
26
- </style>
27
- </head>
28
-
29
- <body>
30
- <h6 id="header">RMagick 0.0.0 User's Guide and Reference</h6>
31
-
32
- <div class="nav">
33
- &laquo;&nbsp;<a href="draw.html">Prev</a> | <a href=
34
- "index.html">Contents</a> | <a href=
35
- "info.html">Next</a>&nbsp;&raquo;
36
- </div>
37
-
38
- <h1>Miscellaneous classes</h1>
39
-
40
- <div id="toc">
41
- <h2>Table of Contents</h2>
42
-
43
- <h3><a href="#view">The Image::View class</a></h3>
44
-
45
- <ul>
46
- <li><a href="#view">Image::View</a></li>
47
- </ul>
48
-
49
- <h3><a href="#Geometry">The Geometry class</a></h3>
50
-
51
- <ul>
52
- <li><a href="#Geometry">Geometry</a></li>
53
- </ul>
54
-
55
- <h3><a href="#Pixel">The Pixel class</a></h3>
56
-
57
- <ul>
58
- <li><a href="#Pixel">Pixel</a></li>
59
- </ul>
60
-
61
- <h3><a href="#struct">Struct classes</a></h3>
62
-
63
- <ul>
64
- <li><a href="#AffineMatrix">AffineMatrix</a></li>
65
-
66
- <li><a href="#Chromaticity">Chromaticity</a></li>
67
-
68
- <li><a href="#Pixel">Pixel</a></li>
69
-
70
- <li><a href="#Point">Point</a></li>
71
-
72
- <li><a href="#Primary">Primary</a></li>
73
-
74
- <li><a href="#Rectangle">Rectangle</a></li>
75
-
76
- <li><a href="#Segment">Segment</a></li>
77
- </ul>
78
-
79
- <h3><a href="#fill">Fill classes</a></h3>
80
-
81
- <ul>
82
- <li><a href="#GradientFill">GradientFill</a></li>
83
-
84
- <li><a href="#HatchFill">HatchFill</a></li>
85
-
86
- <li><a href="#TextureFill">TextureFill</a></li>
87
- </ul>
88
-
89
- <h3><a href="#exception">Exception classes</a></h3>
90
-
91
- <ul>
92
- <li><a href="#MagickError">ImageMagickError</a></li>
93
-
94
- <li><a href=
95
- "#FatalImageMagickError">FatalImageMagickError</a></li>
96
-
97
- <li><a href=
98
- "#DestroyedImageError">DestroyedImageError</a></li>
99
- </ul>
100
- </div>
101
-
102
- <div class="subhd">
103
- <h2 id="view">The Image::View class</h2>
104
-
105
- <div class="intro">
106
- <h3>Introduction</h3>
107
-
108
- <p>A view is a rectangle in an image. Within the view pixels
109
- can be addressed by specifying their <code>[i][j]</code>
110
- coordinates. The <span class="arg">i</span>, <span class=
111
- "arg">j</span> index values can identify a single pixel or
112
- multiple pixels. Pixels can be accessed or modified
113
- individually or collectively. Pixel <em>channels</em> (that
114
- is, the red, green, blue, and opacity components) can be
115
- accessed or modified individually or collectively. The
116
- <a href="#view_sync">sync</a> method stores modified pixels
117
- back into the image.</p>
118
- </div>
119
-
120
- <h3>class Image::View <span class="superclass">&lt;
121
- Object</span></h3>
122
-
123
- <div class="sig">
124
- <h4>new</h4>
125
-
126
- <p>Image::View.new(<span class="arg">img</span>, <span class=
127
- "arg">x</span>, <span class="arg">y</span>, <span class=
128
- "arg">width</span>, <span class="arg">height</span>) -&gt;
129
- <em>view</em></p>
130
- </div>
131
-
132
- <div class="desc">
133
- <h5>Description</h5>
134
-
135
- <p>The easiest way to use an <code>Image::View</code> object
136
- is to create it with the <a href=
137
- "image3.html#view">Image#view</a> method, which provides a
138
- block-scoped view and automatic syncing. You probably won't
139
- want to create a view by calling <code>new</code>.</p>
140
-
141
- <h5>Arguments</h5>
142
-
143
- <dl>
144
- <dt>img</dt>
145
-
146
- <dd>The image from which the view is taken.</dd>
147
-
148
- <dt>x, y</dt>
149
-
150
- <dd>The x- and y-offsets of the view relative to the
151
- top-left corner of the image. Within the view, pixel
152
- addresses are relative to the top-left corner of the
153
- view.</dd>
154
-
155
- <dt>width, height</dt>
156
-
157
- <dd>The number of columns and the number of rows in the
158
- view.</dd>
159
- </dl>
160
-
161
- <p>It is an error to specify a view that exceeds the
162
- boundaries of the image.</p>
163
- </div>
164
-
165
- <div class="sig">
166
- <h4>[][]</h4>
167
-
168
- <p><span class="arg">view</span>[<span class=
169
- "arg">i</span>][<span class="arg">j</span>] -&gt;
170
- <em>pixel</em> or <em>array</em></p>
171
- </div>
172
-
173
- <div class="desc">
174
- <h5>Description</h5>
175
-
176
- <p>Return one or more pixels in the view. If i and j are each
177
- a single integer value, returns a single pixel. For any other
178
- indexes, returns an array of one or more pixels. If any index
179
- exceeds the boundaries of the view, raises
180
- <code>IndexError</code>.</p>
181
-
182
- <h5>Arguments</h5>
183
-
184
- <p>The <span class="arg">i</span> index identifies a set of
185
- rows in the view. The <span class="arg">j</span> index
186
- identifies a set of columns in the view. The pixels that are
187
- returned are the intersection of these two sets. The indexes
188
- can be:</p>
189
-
190
- <dl>
191
- <dt>omitted</dt>
192
-
193
- <dd>If <span class="arg">i</span> is omitted, all the rows
194
- are used. If <code>j</code> is omitted, all the columns are
195
- used.</dd>
196
-
197
- <dt>an integer</dt>
198
-
199
- <dd>or an object that can be converted to an integer. A
200
- single integer identifies a single row or column. Identify
201
- a single pixel by specifying integers for both indexes. If
202
- the index is negative, counts from the bottom row or right
203
- column of the view.</dd>
204
-
205
- <dt>start, length</dt>
206
-
207
- <dd>Identifies the set of <code>length</code> rows or
208
- columns starting with <code>start</code>. If
209
- <code>start</code> is negative, starts at the bottom row or
210
- right column of the view.</dd>
211
-
212
- <dt>an object that responds to <code>each</code></dt>
213
-
214
- <dd>The index may be any object that responds to
215
- <code>each</code> by returning a sequence of objects that
216
- can be converted to integers. An array with integer values
217
- or a range of integers are two examples.</dd>
218
- </dl>
219
-
220
- <h5>Examples</h5>
221
- <pre>
222
- # Get the 2nd pixel in the 4th row of the view.
223
- pixel = view[3][1] # returns a pixel
224
- # Returns an array with only one value
225
- pixels = view[[3]][[1]]
226
- # Get all the pixels in the 4th row
227
- pixels = view[3][]
228
- # Use arrays to specify a non-contiguous set of rows and columns
229
- pixels = view[[1,3,5]][[2,4,6]]
230
- # Use ranges to specify a contiguous set of rows and columns
231
- pixels = view[1..5][2..6]
232
- </pre>
233
- </div>
234
-
235
- <div class="sig">
236
- <h4>[][].red<br />
237
- [][].green<br />
238
- [][].blue<br />
239
- [][].opacity</h4>
240
-
241
- <p>[<span class="arg">i</span>][<span class=
242
- "arg">j</span>].red -&gt; <em>integer</em> or
243
- <em>array</em><br />
244
- [<span class="arg">i</span>][<span class=
245
- "arg">j</span>].green -&gt; <em>integer</em> or
246
- <em>array</em><br />
247
- [<span class="arg">i</span>][<span class="arg">j</span>].blue
248
- -&gt; <em>integer</em> or <em>array</em><br />
249
- [<span class="arg">i</span>][<span class=
250
- "arg">j</span>].opacity -&gt; <em>integer</em> or
251
- <em>array</em></p>
252
- </div>
253
-
254
- <div class="desc">
255
- <h5>Description</h5>
256
-
257
- <p>If the indexes identify a single pixel, these methods
258
- return the value of the red, green, blue, or opacity channel
259
- of that pixel. If the indexes identify more than one pixel,
260
- these methods return an array of values. See
261
- <code>[][]</code> for a description of possible index
262
- arguments.</p>
263
-
264
- <h5>Examples</h5>
265
- <pre>
266
- # Get the value of the green channel of
267
- # the top-left pixel in the view.
268
- view[0][0] = Pixel(0,128,255)
269
- g = view[0][0].green # returns 128
270
-
271
- # Get the maximum value of the red channel
272
- # for all the pixels in the top row of the view.
273
- m = view[0][].red.max
274
- </pre>
275
- </div>
276
-
277
- <div class="sig">
278
- <h4>[][]=</h4>
279
-
280
- <p><span class="arg">view</span>[<span class=
281
- "arg">i</span>][<span class="arg">j</span>] =
282
- <em>rvalue</em></p>
283
- </div>
284
-
285
- <div class="desc">
286
- <h5>Description</h5>
287
-
288
- <p>Replaces each pixel identified by the indexes with a
289
- duplicate of <span class="arg">rvalue</span>. The rvalue is
290
- either a <a href="#Pixel">Pixel</a> object or a <a href=
291
- "imusage.html#color_name">color name</a>. If
292
- <code>rvalue</code> is a color name, calls
293
- <code>Pixel.from_color</code> to create a pixel.</p>
294
-
295
- <h5>Arguments</h5>
296
-
297
- <p>The indexes are the same as <code>[][]</code>, above.</p>
298
-
299
- <dl>
300
- <dt>rvalue</dt>
301
-
302
- <dd>Either a pixel or a color name.</dd>
303
- </dl>
304
- </div>
305
-
306
- <div class="sig">
307
- <h4>[][].red=<br />
308
- [][].green=<br />
309
- [][].blue=<br />
310
- [][].opacity=</h4>
311
-
312
- <p>[<span class="arg">i</span>][<span class=
313
- "arg">j</span>].red = <em>integer</em><br />
314
- [<span class="arg">i</span>][<span class=
315
- "arg">j</span>].green = <em>integer</em><br />
316
- [<span class="arg">i</span>][<span class="arg">j</span>].blue
317
- = <em>integer</em><br />
318
- [<span class="arg">i</span>][<span class=
319
- "arg">j</span>].opacity = <em>integer</em></p>
320
- </div>
321
-
322
- <div class="desc">
323
- <h5>Description</h5>
324
-
325
- <p>Assigns <em>integer</em> to the red, green, blue, or
326
- opacity channel of the pixel or pixels identified by the
327
- indexes.</p>
328
-
329
- <h5>Examples</h5>
330
- <pre>
331
- # Set the red channel of all the pixels in the 2nd
332
- # row of the view to QuantumRange
333
- view[1][].red = QuantumRange
334
- # Set the green channel of the pixel at [20][30] to
335
- # half that of its left-hand neighbor.
336
- view[20][30].green = view[20][29].green * 0.5
337
- </pre>
338
- </div>
339
-
340
- <div id="view_sync" class="sig">
341
- <h4>sync</h4>
342
-
343
- <p><span class="arg">view</span>.sync(<span class=
344
- "arg">force</span>=<code>false</code>) -&gt;
345
- <code>true</code> or <code>false</code></p>
346
- </div>
347
-
348
- <div class="desc">
349
- <h5>Description</h5>
350
-
351
- <p>If any of the pixels in the view have been modified, this
352
- method stores them in the image. If no pixels have been
353
- modified, this method has no effect.</p>
354
-
355
- <h5>Arguments</h5>
356
-
357
- <dl>
358
- <dt>force</dt>
359
-
360
- <dd>If <code>true</code>, forces the view pixels to be
361
- stored in the image even if none have been modified.</dd>
362
- </dl>
363
-
364
- <h5>Returns</h5>Returns <code>true</code> if the pixels were
365
- stored in the image either because the <code>dirty</code>
366
- flag was <code>true</code> or <code>force</code> was
367
- <code>true</code>, <code>false</code> otherwise.
368
- </div>
369
-
370
- <div class="sig">
371
- <h4>dirty<br />
372
- dirty=</h4>
373
-
374
- <p>view.dirty -&gt; <code>true</code> or
375
- <code>false</code><br />
376
- view.dirty = <code>true</code> or <code>false</code></p>
377
- </div>
378
-
379
- <div class="desc">
380
- <h5>Description</h5>
381
-
382
- <p>Any modification to a pixel in the view causes the
383
- <code>dirty</code> attribute to be set to <code>true</code>.
384
- You can (although normally you don't need to) set
385
- <code>dirty=true</code> to force <code>sync</code> to store
386
- the pixels in the image, or set <code>dirty=false</code> to
387
- keep <code>sync</code> from storing the pixels.</p>
388
- </div>
389
-
390
- <div class="sig">
391
- <h4>x<br />
392
- y<br />
393
- width<br />
394
- height</h4>
395
-
396
- <p>x -&gt; integer<br />
397
- y -&gt; integer<br />
398
- width -&gt; integer<br />
399
- height -&gt; integer</p>
400
- </div>
401
-
402
- <div class="desc">
403
- <h5>Description</h5>
404
-
405
- <p>The <span class="arg">x</span>, <span class=
406
- "arg">y</span>, <span class="arg">width</span>, and
407
- <span class="arg">height</span> arguments specified when the
408
- view was created.</p>
409
- </div>
410
- </div>
411
-
412
- <div class="subhd" id="Geometry">
413
- <h2>The Geometry class</h2>
414
-
415
- <div class="intro">
416
- <h3>Introduction</h3>
417
-
418
- <p>The Geometry class contains the same information as an
419
- ImageMagick <a href="imusage.html#geometry">geometry
420
- string</a>. Geometry objects are interchangeable with
421
- geometry strings.</p>
422
- </div>
423
-
424
- <h3>class Geometry <span class="superclass">&lt;
425
- Object</span></h3>
426
-
427
- <div class="sig">
428
- <h4>new</h4>
429
-
430
- <p>Geometry.new(<span class="arg">width</span>=nil,
431
- <span class="arg">height</span>=nil, <span class=
432
- "arg">x</span>=nil, <span class="arg">y</span>=nil,
433
- <span class="arg">flag</span>=nil) -&gt;
434
- <em>geometry</em></p>
435
- </div>
436
-
437
- <div class="desc">
438
- <h5>Description</h5>
439
-
440
- <p>Constructs a new <code>Geometry</code> object.</p>
441
-
442
- <h5>Attributes</h5>
443
-
444
- <p>A geometry string has the general form
445
- "WxH+x+y[!@%&lt;&gt;]. In a <code>Geometry</code> object,</p>
446
-
447
- <dl>
448
- <dt>width</dt>
449
-
450
- <dd>specifies the W value</dd>
451
-
452
- <dt>height</dt>
453
-
454
- <dd>specifies the H value</dd>
455
-
456
- <dt>x, y</dt>
457
-
458
- <dd>specify the x and y values, respectively</dd>
459
-
460
- <dt>flag</dt>
461
-
462
- <dd>one of the constants shown in this table:</dd>
463
- </dl>
464
-
465
- <table summary="geometry flag constants" class=
466
- "simple_table">
467
- <caption>
468
- <strong>Geometry flag constants</strong>
469
- </caption>
470
-
471
- <tr>
472
- <td align="center"><strong>Constant<br />
473
- name</strong></td>
474
-
475
- <td align="center"><strong>Geometry<br />
476
- string flag</strong></td>
477
-
478
- <td align="center"><strong>Explanation</strong></td>
479
- </tr>
480
-
481
- <tr>
482
- <td valign="top">PercentGeometry</td>
483
-
484
- <td valign="top" align="center">%</td>
485
-
486
- <td>Normally the attributes are treated as pixels. Use
487
- this flag when the <code>width</code> and
488
- <code>height</code> attributes represent
489
- <em>percentages</em>. For example, 125x75 means 125% of
490
- the height and 75% of the width. The <code>x</code> and
491
- <code>y</code> attributes are not affected by this
492
- flag.</td>
493
- </tr>
494
-
495
- <tr>
496
- <td valign="top">AspectGeometry</td>
497
-
498
- <td valign="top" align="center">!</td>
499
-
500
- <td>Use this flag when you want to force the new image to
501
- have exactly the size specified by the the
502
- <code>width</code> and <code>height</code>
503
- attributes.</td>
504
- </tr>
505
-
506
- <tr>
507
- <td valign="top">LessGeometry</td>
508
-
509
- <td valign="top" align="center">&lt;</td>
510
-
511
- <td>Use this flag when you want to change the size of the
512
- image only if both its width and height are smaller the
513
- values specified by those attributes. The image size is
514
- changed proportionally.</td>
515
- </tr>
516
-
517
- <tr>
518
- <td valign="top">GreaterGeometry</td>
519
-
520
- <td valign="top" align="center">&gt;</td>
521
-
522
- <td>Use this flag when you want to change the size of the
523
- image if either its width and height exceed the values
524
- specified by those attributes. The image size is changed
525
- proportionally.</td>
526
- </tr>
527
-
528
- <tr>
529
- <td valign="top">AreaGeometry</td>
530
-
531
- <td valign="top" align="center">@</td>
532
-
533
- <td>This flag is useful only with a single
534
- <code>width</code> attribute. When present, it means the
535
- <code>width</code> attribute represents the total area of
536
- the image in pixels.</td>
537
- </tr>
538
-
539
- <tr>
540
- <td valign="top">MinimumGeometry</td>
541
-
542
- <td valign="top" align="center">^</td>
543
-
544
- <td class="imquote">Use ^ to set a minimum image size
545
- limit. The geometry 640x480^, for example, means the
546
- image width will not be less than 640 and the image
547
- height will not be less than 480 pixels after the resize.
548
- One of those dimensions will match the requested size,
549
- but the image will likely overflow the space requested to
550
- preserve its aspect ratio.</td>
551
- </tr>
552
- </table>
553
-
554
- <p>If any attribute is omitted the default is nil or 0.</p>
555
-
556
- <h5>Example</h5>
557
- <pre>
558
- g = Magick::Geometry.new(100,200,nil,nil,Magick::AspectGeometry)
559
- </pre>
560
- </div>
561
- </div>
562
-
563
- <div class="sig">
564
- <h4>from_s</h4>
565
-
566
- <p>Geometry.<span class="arg">from_s</span>(<span class=
567
- "arg">string</span>) -&gt; <em>geometry</em></p>
568
- </div>
569
-
570
- <div class="desc">
571
- <h5>Description</h5>
572
-
573
- <p>Constructs a new <code>Geometry</code> object from a
574
- <a href="imusage.html#geometry">geometry string</a>.</p>
575
- </div>
576
-
577
- <div class="sig">
578
- <h4>to_s</h4>
579
-
580
- <p><span class="arg">geom.</span>to_s() -&gt;
581
- <em>string</em></p>
582
- </div>
583
-
584
- <div class="desc">
585
- <h5>Description</h5>
586
-
587
- <p>Returns the string equivalent of the <code>Geometry</code>
588
- object..</p>
589
- </div>
590
-
591
- <div class="subhd" id="Pixel">
592
- <h2>The Pixel class</h2>
593
-
594
- <div class="intro">
595
- <h3>Introduction</h3>
596
-
597
- <p>A pixel describes the smallest individually addressable
598
- part of an image. In the RGB <a href=
599
- "constants.html#ColorspaceType">colorspace</a>, a pixel's
600
- color is described by its intensity in the red, green, and
601
- blue channels. Its opacity is described by its intensity in
602
- the opacity (also called alpha, or matte) channel. In the
603
- CMYK colorspace a pixel's color is described by its intensity
604
- in the cyan, magenta, yellow and black (K) channels.
605
- Intensity is a value between 0 and <a href=
606
- "constants.html#QuantumRange">QuantumRange</a>.</p>
607
-
608
- <p>Usually, RMagick methods operate on entire images or on
609
- groups of pixels that have been selected by their position or
610
- color. Some methods, such as <a href=
611
- "image2.html#pixel_color">pixel_color</a> and <a href=
612
- "image3.html#view">view</a>, operate on individual pixels or
613
- even on the RGBA (or CMYK) components thereof.</p>
614
- </div>
615
-
616
- <h3>class Pixel <span class="superclass">&lt;
617
- Object</span><br />
618
- <span class="mixin">mixes in Comparable, Observable</span></h3>
619
-
620
- <div class="sig">
621
- <h4>new</h4>
622
-
623
- <p>Pixel.new(<span class="arg">red</span>, <span class=
624
- "arg">green</span>, <span class="arg">blue</span>,
625
- <span class="arg">opacity</span>) -&gt; <em>pixel</em></p>
626
- </div>
627
-
628
- <div class="desc">
629
- <h5>Description</h5>
630
-
631
- <p>Constructs a pixel object from the specified red, green,
632
- blue, and opacity intensities. The intensity is a number
633
- between 0 and <a href=
634
- "constants.html#Miscellaneous_constants">QuantumRange</a>.</p>
635
-
636
- <h5>Attributes</h5>
637
-
638
- <dl>
639
- <dt>red, green, blue</dt>
640
-
641
- <dd>The red, green, and blue intensities of the pixel,
642
- respectively. If the colorspace is <a href=
643
- "constants.html#ColorspaceType">CMYKColorspace</a>, these
644
- attributes are interpreted as the cyan, magenta, and yellow
645
- intensities.</dd>
646
-
647
- <dt>opacity</dt>
648
-
649
- <dd>The opacity level. Higher intensities are more
650
- transparent. If the colorspace is CMYKColorspace, this
651
- attribute is interpreted as the black intensity.</dd>
652
-
653
- <dt>cyan, magenta, yellow, black</dt>
654
-
655
- <dd>These attributes are aliases for <code>red</code>,
656
- <code>green</code>, <code>blue</code>, and
657
- <code>opacity</code>, respectively.</dd>
658
- </dl>
659
- </div>
660
-
661
- <div class="sig">
662
- <h4>from_color</h4>
663
-
664
- <p>Pixel.from_color(<span class="arg">color_name</span>)
665
- -&gt; <em>pixel</em></p>
666
- </div>
667
-
668
- <div class="desc">
669
- <h5>Description</h5>
670
-
671
- <p>Constructs a new Pixel object from the <a href=
672
- "imusage.html#color_names">color name</a>. Raises
673
- ArgumentError if the name is unknown.</p>
674
- </div>
675
-
676
- <div class="sig">
677
- <h4 id="from_hsla">from_hsla</h4>
678
-
679
- <p>Pixel.from_hsla(<span class="arg">hue</span>, <span class=
680
- "arg">saturation</span>, <span class="arg">lightness</span>,
681
- <span class="arg">alpha</span>=1.0) -&gt; <em>pixel</em></p>
682
- </div>
683
-
684
- <div class="desc">
685
- <h5>Description</h5>
686
-
687
- <p>Constructs a pixel object from the specified
688
- arguments.</p>
689
-
690
- <h5>Arguments</h5>
691
-
692
- <dl>
693
- <dt>hue</dt>
694
-
695
- <dd>Either a String percentage (e.g., "25%") or a value in
696
- the range [0.0, 360.0).</dd>
697
-
698
- <dt>saturation</dt>
699
-
700
- <dd>Either a String percentage (e.g., "25%") or a value in
701
- the range [0.0, 255.0].</dd>
702
-
703
- <dt>lightness</dt>
704
-
705
- <dd>Either a String percentage (e.g., "25%") or a value in
706
- the range [0.0, 255.0].</dd>
707
-
708
- <dt>alpha</dt>
709
-
710
- <dd>Either a String percentage (e.g., "25%") or a value in
711
- the range [0.0, 1.0], where 1.0 is fully opaque and 0.0 is
712
- fully transparent. This argument may be omitted. The default
713
- is 1.0.</dd>
714
- </dl>
715
-
716
- <h5>See also</h5>
717
-
718
- <p><a href="#to_hsla">to_hsla</a></p>
719
- </div>
720
-
721
- <div class="sig">
722
- <h4 id="spaceship">&lt;=&gt;</h4>
723
-
724
- <p><span class="arg">pixel1</span> &lt;=&gt; <span class=
725
- "arg">pixel2</span> -&gt; -1, 0, <em>or</em> 1</p>
726
- </div>
727
-
728
- <div class="desc">
729
- <h5>Description</h5>
730
-
731
- <p>Returns -1, 0, or 1 depending on if <span class=
732
- "arg">pixel1</span> is "less than," equal, or "greater than"
733
- the <span class="arg">pixel2</span>.</p>
734
-
735
- <p>Since there is no way to rank order pixels, and thus
736
- determine if one pixel is "greater than" or "less than"
737
- another, this method uses an arbitrary algorithm that ensures
738
- these two conditions:</p>
739
-
740
- <ol>
741
- <li>pixels with equal RGBA (or CMYK) values compare equal,
742
- and</li>
743
-
744
- <li>comparing the same two unequal pixels always returns
745
- the same result.</li>
746
- </ol>
747
-
748
- <h5>Returns</h5>
749
-
750
- <p>-1, 0, or 1</p>
751
-
752
- <h5>See also</h5>
753
-
754
- <p><a href="#fcmp">fcmp</a></p>
755
- </div>
756
-
757
- <div class="sig">
758
- <h4 id="fcmp">fcmp</h4>
759
-
760
- <p><span class="arg">pixel</span>.fcmp(<span class=
761
- "arg">pixel</span>, <span class="arg">fuzz</span>=0.0,
762
- <span class="arg">colorspace</span>=RGBColorspace) -&gt;
763
- <code>true</code> <em>or</em> <code>false</code></p>
764
- </div>
765
-
766
- <div class="desc">
767
- <h5>Description</h5>
768
-
769
- <p>Returns true if the argument is the same color as
770
- <span class="arg">pixel</span>.</p>
771
-
772
- <h5>Arguments</h5>
773
-
774
- <dl>
775
- <dt>pixel</dt>
776
-
777
- <dd>The pixel to which the receiver is compared.</dd>
778
-
779
- <dt>fuzz</dt>
780
-
781
- <dd>The amount of fuzz to allow before the colors are
782
- considered to be different.</dd>
783
-
784
- <dt>colorspace</dt>
785
-
786
- <dd>If the pixels are in the CMYK colorspace, specify
787
- <a href=
788
- "constants.html#ColorspaceType">Magick::CMYKColorspace</a>.</dd>
789
- </dl>
790
-
791
- <h5>Returns</h5>
792
-
793
- <p><code>true</code> or <code>false</code></p>
794
-
795
- <h5>See also</h5>
796
-
797
- <p><a href="#spaceship">&lt;=&gt;</a></p>
798
- </div>
799
-
800
- <div class="sig">
801
- <h4>intensity</h4>
802
-
803
- <p><span class="arg">pixel</span>.intensity() -&gt;
804
- integer</p>
805
- </div>
806
-
807
- <div class="desc">
808
- <h5>Description</h5>
809
-
810
- <p>Returns the intensity of the pixel. The intensity is
811
- computed as 0.299*R+0.587*G+0.114*B.</p>
812
- </div>
813
-
814
- <div class="sig">
815
- <h4>to_color</h4>
816
-
817
- <p><span class="arg">pixel</span>.to_color(<span class=
818
- "arg">compliance</span>=AllCompliance, <span class=
819
- "arg">matte</span>=<code>false</code>, <span class=
820
- "arg">depth</span>=<code>QuantumDepth</code>, <span class=
821
- "arg">hex</span>=<code>false</code>) -&gt;
822
- <em>string</em></p>
823
- </div>
824
-
825
- <div class="desc">
826
- <h5>Description</h5>
827
-
828
- <p>Returns the <a href="imusage.html#color_names">color
829
- name</a> corresponding the the pixel values. If there is no
830
- such named color in the specified color standard, returns a
831
- string in the form "rgb(r,g,b,a)".</p>
832
-
833
- <h5>Arguments</h5>
834
-
835
- <dl>
836
- <dt>compliance</dt>
837
-
838
- <dd>A <a href=
839
- "constants.html#ComplianceType">ComplianceType</a>
840
- constant. The default value of AllCompliance causes
841
- <code>to_color</code> to search for a color name in any of
842
- the 3 defined color standards.</dd>
843
-
844
- <dt>matte</dt>
845
-
846
- <dd>If false, the pixel's opacity attribute is
847
- ignored.</dd>
848
-
849
- <dt>depth</dt>
850
-
851
- <dd>An image depth. The default is the quantum depth used
852
- when ImageMagick was compiled. The values 16 and 32 can be
853
- used only when ImageMagick was compiled with the
854
- appropriate QuantumDepth.</dd>
855
-
856
- <dt>hex</dt>
857
-
858
- <dd>If true, represent the color name in hex (#rrggbbaa or
859
- #rrrrggggbbbbaaaa) format. In this case <span class=
860
- "arg">compliance</span> is meaningless.</dd>
861
- </dl>
862
-
863
- <h5>See also</h5>
864
-
865
- <p>Compare this method to <a href=
866
- "image3.html#to_color">Image#to_color</a>, in which the
867
- <span class="arg">matte</span> and <span class=
868
- "arg">depth</span> values are taken from an image.</p>
869
- </div>
870
-
871
- <div class="sig">
872
- <h4 id="to_hsla">to_hsla</h4>
873
-
874
- <p><span class="arg">pixel</span>.to_HSL -&gt;
875
- <em>array</em></p>
876
- </div>
877
-
878
- <div class="desc">
879
- <h5>Description</h5>
880
-
881
- <p>Converts the RGB representation of the pixel to hue,
882
- saturation, lightness, and alpha values.</p>
883
-
884
- <h5>Returns</h5>
885
-
886
- <p>An array of the form <code>[hue, saturation, lightness,
887
- alpha]</code>. Each value is in the range specified for it,
888
- as described in <a href="#from_hsla">from_hsla</a>,
889
- above.</p>
890
- </div>
891
- </div>
892
-
893
- <div class="subhd">
894
- <h2 id="struct">Struct classes</h2>
895
-
896
- <div class="intro">
897
- <h3>Introduction</h3>
898
-
899
- <p>These classes are created by the Struct class and are used
900
- to create objects used as attribute and argument values in
901
- other RMagick classes. Like all the classes created by
902
- Struct, these classes define both getter and setter methods
903
- for their attributes. That is, for an attribute <em>x</em>
904
- both the <code>x</code> and <code>x=</code> methods are
905
- defined.</p>
906
-
907
- <p>The <code>Pixel</code> and <code>Geometry</code> classes
908
- define additional constructors and conversion methods.</p>
909
- </div>
910
-
911
- <h3 id="AffineMatrix">class AffineMatrix <span class=
912
- "superclass">&lt; Struct</span></h3>
913
-
914
- <div class="sig">
915
- <h4>new</h4>
916
-
917
- <p>AffineMatrix.new(<span class="arg">sx</span>, <span class=
918
- "arg">rx</span>, <span class="arg">ry</span>, <span class=
919
- "arg">sy</span>, <span class="arg">tx</span>, <span class=
920
- "arg">ty</span>) -&gt; <em>matrix</em></p>
921
- </div>
922
-
923
- <div class="desc">
924
- <h5>Description</h5>
925
-
926
- <p>An AffineMatrix object describes a coordinate
927
- transformation. This object is used as an argument to the
928
- <a href=
929
- "image1.html#affine_transform">Image#affine_transform</a>,
930
- <a href=
931
- "image1.html#composite_affine">Image#composite_affine</a>,
932
- and <a href="draw.html#affine_eq">Draw#affine</a>
933
- methods.</p>
934
-
935
- <h5>Attributes</h5>
936
-
937
- <dl>
938
- <dt>sx, sy</dt>
939
-
940
- <dd>The amount of scaling on the x- and y- axes.</dd>
941
-
942
- <dt>rx, ry</dt>
943
-
944
- <dd>The amount of rotation on the x- and y-axes, in
945
- radians.</dd>
946
-
947
- <dt>tx, ty</dt>
948
-
949
- <dd>The amount of translation on the x- and y-axes, in
950
- pixels.</dd>
951
- </dl>
952
- </div>
953
-
954
- <h3 id="Chromaticity">class Chromaticity <span class=
955
- "superclass">&lt; Struct</span></h3>
956
-
957
- <div class="sig">
958
- <h4>new</h4>
959
-
960
- <p>Chromaticity.new(<span class="arg">red_primary</span>,
961
- <span class="arg">green_primary</span>, <span class=
962
- "arg">blue_primary</span>, <span class=
963
- "arg">white_point</span>) -&gt; <em>chromaticity</em></p>
964
- </div>
965
-
966
- <div class="desc">
967
- <h5>Description</h5>
968
-
969
- <p>A Chromaticity object represents chromaticity values for
970
- the <a href=
971
- "imageattrs.html#chromaticity">Image#chromaticity</a>
972
- attribute.</p>
973
-
974
- <h5>Attributes</h5>
975
-
976
- <p>The attribute values are <a href="#Primary">Primary</a>
977
- objects.</p>
978
-
979
- <dl>
980
- <dt>red_primary</dt>
981
-
982
- <dd>Red primary point (e.g. red_primary.x=0.64,
983
- red_primary.y=0.33)</dd>
984
-
985
- <dt>green_primary</dt>
986
-
987
- <dd>Green primary point (e.g. green_primary.x=0.3,
988
- green_primary.y=0.6)</dd>
989
-
990
- <dt>blue_primary</dt>
991
-
992
- <dd>Blue primary point (e.g. blue_primary.x=0.15,
993
- blue_primary.y=0.06)</dd>
994
-
995
- <dt>white_point</dt>
996
-
997
- <dd>White point (e.g. white_point.x=0.3127,
998
- white_point.y=0.329)</dd>
999
- </dl>
1000
- </div>
1001
-
1002
- <h3 id="Point">class Point <span class="superclass">&lt;
1003
- Struct</span></h3>
1004
-
1005
- <div class="sig">
1006
- <h4>new</h4>
1007
-
1008
- <p>Point.new(<span class="arg">x</span>, <span class=
1009
- "arg">y</span>) -&gt; <em>point</em></p>
1010
- </div>
1011
-
1012
- <div class="desc">
1013
- <h5>Description</h5>
1014
-
1015
- <p>The value of the <code>pixels_per_em</code> attribute in
1016
- the TypeMetric struct returned by <a href=
1017
- "draw.html#get_type_metrics">Draw#get_type_metrics</a> is a
1018
- <code>Point</code> object..</p>
1019
-
1020
- <h5>Attributes</h5>
1021
-
1022
- <dl>
1023
- <dt>x</dt>
1024
-
1025
- <dd>Character width</dd>
1026
-
1027
- <dt>y</dt>
1028
-
1029
- <dd>Character height</dd>
1030
- </dl>
1031
- </div>
1032
-
1033
- <h3 id="Primary">class Primary <span class="superclass">&lt;
1034
- Struct</span></h3>
1035
-
1036
- <div class="sig">
1037
- <h4>new</h4>
1038
-
1039
- <p>Primary.new(<span class="arg">x</span>, <span class=
1040
- "arg">y</span>, <span class="arg">z</span>) -&gt;
1041
- <em>primary</em></p>
1042
- </div>
1043
-
1044
- <div class="desc">
1045
- <h5>Description</h5>
1046
-
1047
- <p>See <a href="#Chromaticity">class Chromaticity</a>.</p>
1048
-
1049
- <h5>Attributes</h5>
1050
-
1051
- <dl>
1052
- <dt>x</dt>
1053
-
1054
- <dd>X ordinate</dd>
1055
-
1056
- <dt>y</dt>
1057
-
1058
- <dd>Y ordinate</dd>
1059
-
1060
- <dt>z</dt>
1061
-
1062
- <dd>Z ordinate. This attribute is always ignored.</dd>
1063
- </dl>
1064
- </div>
1065
-
1066
- <h3 id="Rectangle">class Rectangle <span class=
1067
- "superclass">&lt; Struct</span></h3>
1068
-
1069
- <div class="sig">
1070
- <h4>new</h4>
1071
-
1072
- <p>Rectangle.new(<span class="arg">width</span>, <span class=
1073
- "arg">height</span>, <span class="arg">x</span>, <span class=
1074
- "arg">y</span>) -&gt; <em>rectangle</em></p>
1075
- </div>
1076
-
1077
- <div class="desc">
1078
- <h5>Description</h5>
1079
-
1080
- <p>The value of the <a href=
1081
- "imageattrs.html#tile_info">Image#tile_info</a> and <a href=
1082
- "imageattrs.html#bounding_box">Image#bounding_box</a>
1083
- attributes.</p>
1084
-
1085
- <h5>Attributes</h5>
1086
-
1087
- <dl>
1088
- <dt>width</dt>
1089
-
1090
- <dd>Rectangle width</dd>
1091
-
1092
- <dt>height</dt>
1093
-
1094
- <dd>Rectangle height</dd>
1095
-
1096
- <dt>x</dt>
1097
-
1098
- <dd>Offset from the left edge of the image</dd>
1099
-
1100
- <dt>y</dt>
1101
-
1102
- <dd>Offset from the top edge of the image</dd>
1103
- </dl>
1104
- </div>
1105
-
1106
- <h3 id="Segment">class Segment <span class="superclass">&lt;
1107
- Struct</span></h3>
1108
-
1109
- <div class="sig">
1110
- <h4>new</h4>
1111
-
1112
- <p>Segment.new(<span class="arg">x1</span>, <span class=
1113
- "arg">y1</span>, <span class="arg">x2</span>, <span class=
1114
- "arg">y2</span>) -&gt; <em>segment</em></p>
1115
- </div>
1116
-
1117
- <div class="desc">
1118
- <h5>Description</h5>
1119
-
1120
- <p>The value of the <code>bounds</code> attribute in the
1121
- <a href="draw.html#get_type_metrics">TypeMetric</a>
1122
- class.</p>
1123
-
1124
- <h5>Attributes</h5>
1125
-
1126
- <p><em>x1</em>, <em>y1</em>, <em>x2</em>, <em>y2</em></p>
1127
- </div>
1128
- </div>
1129
-
1130
- <div class="subhd">
1131
- <h2 id="fill">Fill classes</h2>
1132
- </div>
1133
-
1134
- <div class="intro">
1135
- <h3>Introduction</h3>
1136
-
1137
- <p>The <a href="image1.html#new">Image#new</a> and <a href=
1138
- "ilist.html#new_image">ImageList#new_image</a> methods accept a
1139
- <code>Fill</code> object as an optional third argument. A
1140
- <code>Fill</code> object is an instance of a <em>Fill
1141
- class</em>. Fill classes are designed to support custom
1142
- background fills. Each <code>Fill</code> class defines only two
1143
- methods, <code>initialize</code> and <code>fill</code>. The
1144
- <code>initialize</code> method is called from the application
1145
- to create an instance of the fill class. It accepts any
1146
- arguments and does whatever is necessary to create the fill.
1147
- The <code>fill</code> method is called from the initialize
1148
- method of the new image object, after the image is completely
1149
- initialized. The <code>fill</code> method gets the image as its
1150
- only argument and sends whatever methods are necessary to the
1151
- image to fill the image's background.</p>
1152
-
1153
- <p>RMagick supplies three Fill classes,
1154
- <code><strong>HatchFill</strong></code>,
1155
- <code><strong>GradientFill</strong></code>, and
1156
- <code><strong>TextureFill</strong></code>. These classes are
1157
- explained below. The <code>HatchFill</code> class is intended
1158
- as an example of how to write a <code>Fill</code> class and is
1159
- written in pure Ruby. You can read it in RMagick.rb.</p>
1160
- </div>
1161
-
1162
- <h3 id="GradientFill">class GradientFill <span class=
1163
- "superclass">&lt; Object</span></h3>
1164
-
1165
- <div class="sig">
1166
- <h4>new</h4>
1167
-
1168
- <p>GradientFill.new(<span class="arg">x1</span>, <span class=
1169
- "arg">y1</span>, <span class="arg">x2</span>, <span class=
1170
- "arg">y2</span>, <span class="arg">start_color</span>,
1171
- <span class="arg">end_color</span>) -&gt;
1172
- <em>gradient_fill</em></p>
1173
- </div>
1174
-
1175
- <div class="desc">
1176
- <h5>Description</h5>
1177
-
1178
- <p>Creates a gradient fill. The <span class="arg">x1</span>,
1179
- <span class="arg">y1</span>, and <span class="arg">x2</span>,
1180
- <span class="arg">y2</span> arguments describe either a line or
1181
- a point. If <span class="arg">x1</span> != <span class=
1182
- "arg">x2</span> or <span class="arg">y1</span> != <span class=
1183
- "arg">y2</span>, then the arguments describe the starting line
1184
- for the gradient. The gradient will start with <span class=
1185
- "arg">start_color</span> at the starting line and gradually
1186
- transform to <span class="arg">end_color</span> as the distance
1187
- increases from the starting line.</p>
1188
-
1189
- <p>If <span class="arg">x1</span> == <span class=
1190
- "arg">x2</span> and <span class="arg">y1</span> == <span class=
1191
- "arg">y2</span>, the gradient radiates from the specified
1192
- point, gradually transforming from <span class=
1193
- "arg">start_color</span> to <span class=
1194
- "arg">end_color</span>.</p>
1195
-
1196
- <p>The line or point does not have to lie within the image
1197
- bounds.</p>
1198
-
1199
- <h5>Arguments</h5>
1200
-
1201
- <dl>
1202
- <dt>x1, y1</dt>
1203
-
1204
- <dd>One of the starting line end-points.</dd>
1205
-
1206
- <dt>x2, y2</dt>
1207
-
1208
- <dd>The other end-point on the starting line.</dd>
1209
-
1210
- <dt>start_color</dt>
1211
-
1212
- <dd>The color at the starting line.</dd>
1213
-
1214
- <dt>end_color</dt>
1215
-
1216
- <dd>The color to which the gradient transforms.</dd>
1217
- </dl>
1218
-
1219
- <h5>Example</h5>
1220
-
1221
- <p><a href="javascript:popup('gradientfill.rb.html')"><img src=
1222
- "ex/gradientfill.gif" alt="GradientFill example" title=
1223
- "Click to see the example script" /></a></p>
1224
- </div>
1225
-
1226
- <h3 id="HatchFill">class HatchFill <span class="superclass">&lt;
1227
- Object</span></h3>
1228
-
1229
- <div class="sig">
1230
- <h4>new</h4>
1231
-
1232
- <p>HatchFill.new(<span class="arg">background_color</span>,
1233
- <span class="arg">hatch_color</span>='white', <span class=
1234
- "arg">dist</span>=10) -&gt; <em>hatch_fill</em></p>
1235
- </div>
1236
-
1237
- <div class="desc">
1238
- <h4>Description</h4>
1239
-
1240
- <p>Creates a cross-hatched fill.</p>
1241
-
1242
- <h4>Arguments</h4>
1243
-
1244
- <dl>
1245
- <dt>background_color</dt>
1246
-
1247
- <dd>The image background color.</dd>
1248
-
1249
- <dt>hatch_color</dt>
1250
-
1251
- <dd>The color of the cross-hatch lines.</dd>
1252
-
1253
- <dt>dist</dt>
1254
-
1255
- <dd>The distance between cross-hatch lines, in pixels.</dd>
1256
- </dl>
1257
-
1258
- <h4>Example</h4>
1259
-
1260
- <p><a href="javascript:popup('hatchfill.rb.html')"><img src=
1261
- "ex/hatchfill.gif" alt="HatchFill example" title=
1262
- "Click to see the example script" /></a></p>
1263
- </div>
1264
-
1265
- <h3 id="TextureFill">class TextureFill <span class=
1266
- "superclass">&lt; Object</span></h3>
1267
-
1268
- <div class="sig">
1269
- <h4>new</h4>
1270
-
1271
- <p>TextureFill.new(<span class="arg">texture_image</span>)
1272
- -&gt; <em>texture_fill</em></p>
1273
- </div>
1274
-
1275
- <div class="desc">
1276
- <h5>Description</h5>
1277
-
1278
- <p>Creates a texture fill by tiling the <span class=
1279
- "arg">texture_image</span> to fill the image.</p>
1280
-
1281
- <h5>Arguments</h5>
1282
-
1283
- <p>The texture to be used as the background. May be an image or
1284
- imagelist. If <span class="arg">texture_image</span> is an
1285
- imagelist, uses the current image.</p>
1286
-
1287
- <h5>Example</h5>
1288
-
1289
- <p><a href="javascript:popup('texturefill.rb.html')"><img src=
1290
- "ex/texturefill.gif" alt="TextureFill example" title=
1291
- "Click to see the example script" /></a></p>
1292
- </div>
1293
-
1294
- <div class="subhd">
1295
- <h2 id="exception">Exception classes</h2>
1296
-
1297
- <h3 id="MagickError">class ImageMagickError <span class=
1298
- "superclass">&lt; StandardError</span></h3>
1299
-
1300
- <div class="desc">
1301
- <h4>Description</h4>
1302
-
1303
- <p>RMagick raises this exception when an ImageMagick function
1304
- returns an error condition.</p>
1305
- </div>
1306
-
1307
- <h3 id="FatalImageMagickError">class FatalImageMagickError
1308
- <span class="superclass">&lt; StandardError</span></h3>
1309
-
1310
- <div class="desc">
1311
- <h4>Description</h4>
1312
-
1313
- <p>RMagick raises this exception when ImageMagick raises a
1314
- fatal (unrecoverable) error condition.</p>
1315
- </div>
1316
-
1317
- <h3 id="DestroyedImageError">class DestroyedImageError
1318
- <span class="superclass">&lt; StandardError</span></h3>
1319
-
1320
- <div class="desc">
1321
- <h4>Description</h4>
1322
-
1323
- <p>RMagick raises this exception when any Image method
1324
- (except <a href="image1.html#destroyed_q">destroyed?</a> and
1325
- <a href="image2.html#inspect">inspect</a>) is called after an
1326
- image has been <a href=
1327
- "image1.html#destroy_bang">destroyed</a>.</p>
1328
- </div>
1329
- </div>
1330
-
1331
- <p class="spacer">&nbsp;</p>
1332
-
1333
- <div class="nav">
1334
- &laquo;&nbsp;<a href="draw.html">Prev</a> | <a href=
1335
- "index.html">Contents</a> | <a href=
1336
- "info.html">Next</a>&nbsp;&raquo;
1337
- </div>
1338
- </body>
1339
- </html>