rmagick 3.2.0 → 4.3.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 (420) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +63 -0
  3. data/.devcontainer/Dockerfile +14 -0
  4. data/.devcontainer/ImageMagick6/devcontainer.json +11 -0
  5. data/.devcontainer/devcontainer.json +11 -0
  6. data/.devcontainer/setup-repo.sh +10 -0
  7. data/.devcontainer/setup-user.sh +45 -0
  8. data/.editorconfig +3 -0
  9. data/.github/ISSUE_TEMPLATE.md +17 -0
  10. data/.github/workflows/ci.yml +79 -0
  11. data/.gitignore +3 -1
  12. data/.rspec +1 -0
  13. data/.rubocop.yml +24 -0
  14. data/.rubocop_todo.yml +151 -297
  15. data/.yardopts +5 -0
  16. data/CHANGELOG.md +233 -0
  17. data/CODE_OF_CONDUCT.md +122 -7
  18. data/CONTRIBUTING.md +14 -10
  19. data/README.md +326 -0
  20. data/Rakefile +16 -22
  21. data/before_install_linux.sh +22 -28
  22. data/before_install_osx.sh +57 -2
  23. data/ext/RMagick/extconf.rb +149 -105
  24. data/ext/RMagick/rmagick.c +77 -104
  25. data/ext/RMagick/rmagick.h +121 -103
  26. data/ext/RMagick/rmdraw.c +364 -436
  27. data/ext/RMagick/rmenum.c +106 -114
  28. data/ext/RMagick/rmfill.c +149 -70
  29. data/ext/RMagick/rmilist.c +225 -367
  30. data/ext/RMagick/rmimage.c +4751 -4405
  31. data/ext/RMagick/rminfo.c +574 -787
  32. data/ext/RMagick/rmkinfo.c +51 -121
  33. data/ext/RMagick/rmmain.c +454 -286
  34. data/ext/RMagick/rmmontage.c +64 -130
  35. data/ext/RMagick/rmpixel.c +488 -437
  36. data/ext/RMagick/rmstruct.c +83 -96
  37. data/ext/RMagick/rmutil.c +302 -214
  38. data/lib/rmagick/version.rb +1 -1
  39. data/lib/rmagick_internal.rb +138 -93
  40. data/lib/rvg/clippath.rb +2 -1
  41. data/lib/rvg/container.rb +10 -5
  42. data/lib/rvg/describable.rb +1 -1
  43. data/lib/rvg/embellishable.rb +5 -4
  44. data/lib/rvg/misc.rb +15 -12
  45. data/lib/rvg/paint.rb +2 -1
  46. data/lib/rvg/pathdata.rb +12 -11
  47. data/lib/rvg/rvg.rb +12 -8
  48. data/lib/rvg/stylable.rb +9 -7
  49. data/lib/rvg/text.rb +11 -6
  50. data/lib/rvg/transformable.rb +3 -2
  51. data/lib/rvg/units.rb +1 -1
  52. data/rmagick.gemspec +10 -11
  53. metadata +52 -423
  54. data/.appveyor.yml +0 -45
  55. data/.circleci/config.yml +0 -56
  56. data/.ruby-version +0 -1
  57. data/.simplecov +0 -27
  58. data/.travis.yml +0 -62
  59. data/Doxyfile +0 -1514
  60. data/README.textile +0 -259
  61. data/benchmarks/memory/README.md +0 -50
  62. data/benchmarks/memory/image_new.rb +0 -8
  63. data/benchmarks/memory/rmagick.gnuplot +0 -16
  64. data/doc/.cvsignore +0 -1
  65. data/doc/comtasks.html +0 -287
  66. data/doc/constants.html +0 -1581
  67. data/doc/css/doc.css +0 -299
  68. data/doc/css/popup.css +0 -34
  69. data/doc/css/ref.css +0 -67
  70. data/doc/draw.html +0 -3272
  71. data/doc/ex/InitialCoords.rb +0 -22
  72. data/doc/ex/NewCoordSys.rb +0 -30
  73. data/doc/ex/OrigCoordSys.rb +0 -16
  74. data/doc/ex/PreserveAspectRatio.rb +0 -204
  75. data/doc/ex/RotateScale.rb +0 -36
  76. data/doc/ex/Skew.rb +0 -38
  77. data/doc/ex/Use01.rb +0 -15
  78. data/doc/ex/Use02.rb +0 -20
  79. data/doc/ex/Use03.rb +0 -16
  80. data/doc/ex/ViewBox.rb +0 -31
  81. data/doc/ex/adaptive_threshold.rb +0 -9
  82. data/doc/ex/add_noise.rb +0 -16
  83. data/doc/ex/affine.rb +0 -48
  84. data/doc/ex/affine_transform.rb +0 -20
  85. data/doc/ex/arc.rb +0 -49
  86. data/doc/ex/arcpath.rb +0 -32
  87. data/doc/ex/arcs01.rb +0 -28
  88. data/doc/ex/arcs02.rb +0 -59
  89. data/doc/ex/average.rb +0 -15
  90. data/doc/ex/axes.rb +0 -64
  91. data/doc/ex/baseline_shift01.rb +0 -17
  92. data/doc/ex/bilevel_channel.rb +0 -8
  93. data/doc/ex/blur_image.rb +0 -12
  94. data/doc/ex/border.rb +0 -10
  95. data/doc/ex/bounding_box.rb +0 -42
  96. data/doc/ex/cbezier1.rb +0 -41
  97. data/doc/ex/cbezier2.rb +0 -41
  98. data/doc/ex/cbezier3.rb +0 -41
  99. data/doc/ex/cbezier4.rb +0 -42
  100. data/doc/ex/cbezier5.rb +0 -42
  101. data/doc/ex/cbezier6.rb +0 -53
  102. data/doc/ex/channel.rb +0 -25
  103. data/doc/ex/charcoal.rb +0 -12
  104. data/doc/ex/chop.rb +0 -29
  105. data/doc/ex/circle.rb +0 -33
  106. data/doc/ex/circle01.rb +0 -16
  107. data/doc/ex/clip_path.rb +0 -60
  108. data/doc/ex/coalesce.rb +0 -57
  109. data/doc/ex/color_fill_to_border.rb +0 -29
  110. data/doc/ex/color_floodfill.rb +0 -28
  111. data/doc/ex/color_histogram.rb +0 -47
  112. data/doc/ex/color_reset.rb +0 -11
  113. data/doc/ex/colorize.rb +0 -16
  114. data/doc/ex/colors.rb +0 -64
  115. data/doc/ex/compose_mask.rb +0 -22
  116. data/doc/ex/composite.rb +0 -133
  117. data/doc/ex/composite_layers.rb +0 -52
  118. data/doc/ex/composite_tiled.rb +0 -21
  119. data/doc/ex/contrast.rb +0 -36
  120. data/doc/ex/crop.rb +0 -31
  121. data/doc/ex/crop_with_gravity.rb +0 -42
  122. data/doc/ex/cubic01.rb +0 -43
  123. data/doc/ex/cubic02.rb +0 -91
  124. data/doc/ex/cycle_colormap.rb +0 -21
  125. data/doc/ex/dissolve.rb +0 -12
  126. data/doc/ex/drawcomp.rb +0 -41
  127. data/doc/ex/drop_shadow.rb +0 -60
  128. data/doc/ex/edge.rb +0 -11
  129. data/doc/ex/ellipse.rb +0 -45
  130. data/doc/ex/ellipse01.rb +0 -21
  131. data/doc/ex/emboss.rb +0 -11
  132. data/doc/ex/enhance.rb +0 -28
  133. data/doc/ex/equalize.rb +0 -11
  134. data/doc/ex/evenodd.rb +0 -42
  135. data/doc/ex/fill_pattern.rb +0 -23
  136. data/doc/ex/flatten_images.rb +0 -36
  137. data/doc/ex/flip.rb +0 -11
  138. data/doc/ex/flop.rb +0 -11
  139. data/doc/ex/font_styles.rb +0 -32
  140. data/doc/ex/fonts.rb +0 -16
  141. data/doc/ex/frame.rb +0 -12
  142. data/doc/ex/gaussian_blur.rb +0 -11
  143. data/doc/ex/get_multiline_type_metrics.rb +0 -41
  144. data/doc/ex/get_pixels.rb +0 -45
  145. data/doc/ex/get_type_metrics.rb +0 -142
  146. data/doc/ex/gradientfill.rb +0 -27
  147. data/doc/ex/grav.rb +0 -45
  148. data/doc/ex/gravity.rb +0 -78
  149. data/doc/ex/group.rb +0 -26
  150. data/doc/ex/hatchfill.rb +0 -27
  151. data/doc/ex/image.rb +0 -44
  152. data/doc/ex/images/Apple.miff +0 -0
  153. data/doc/ex/images/Ballerina.jpg +0 -0
  154. data/doc/ex/images/Ballerina3.jpg +0 -0
  155. data/doc/ex/images/Button_0.gif +0 -0
  156. data/doc/ex/images/Button_1.gif +0 -0
  157. data/doc/ex/images/Button_2.gif +0 -0
  158. data/doc/ex/images/Button_3.gif +0 -0
  159. data/doc/ex/images/Button_4.gif +0 -0
  160. data/doc/ex/images/Button_5.gif +0 -0
  161. data/doc/ex/images/Button_6.gif +0 -0
  162. data/doc/ex/images/Button_7.gif +0 -0
  163. data/doc/ex/images/Button_8.gif +0 -0
  164. data/doc/ex/images/Button_9.gif +0 -0
  165. data/doc/ex/images/Button_A.gif +0 -0
  166. data/doc/ex/images/Button_B.gif +0 -0
  167. data/doc/ex/images/Button_C.gif +0 -0
  168. data/doc/ex/images/Button_D.gif +0 -0
  169. data/doc/ex/images/Button_E.gif +0 -0
  170. data/doc/ex/images/Button_F.gif +0 -0
  171. data/doc/ex/images/Button_G.gif +0 -0
  172. data/doc/ex/images/Button_H.gif +0 -0
  173. data/doc/ex/images/Button_I.gif +0 -0
  174. data/doc/ex/images/Button_J.gif +0 -0
  175. data/doc/ex/images/Button_K.gif +0 -0
  176. data/doc/ex/images/Button_L.gif +0 -0
  177. data/doc/ex/images/Button_M.gif +0 -0
  178. data/doc/ex/images/Button_N.gif +0 -0
  179. data/doc/ex/images/Button_O.gif +0 -0
  180. data/doc/ex/images/Button_P.gif +0 -0
  181. data/doc/ex/images/Button_Q.gif +0 -0
  182. data/doc/ex/images/Button_R.gif +0 -0
  183. data/doc/ex/images/Button_S.gif +0 -0
  184. data/doc/ex/images/Button_T.gif +0 -0
  185. data/doc/ex/images/Button_U.gif +0 -0
  186. data/doc/ex/images/Button_V.gif +0 -0
  187. data/doc/ex/images/Button_W.gif +0 -0
  188. data/doc/ex/images/Button_X.gif +0 -0
  189. data/doc/ex/images/Button_Y.gif +0 -0
  190. data/doc/ex/images/Button_Z.gif +0 -0
  191. data/doc/ex/images/Cheetah.jpg +0 -0
  192. data/doc/ex/images/Coffee.png +0 -0
  193. data/doc/ex/images/Flower_Hat.jpg +0 -0
  194. data/doc/ex/images/Gold_Statue.jpg +0 -0
  195. data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
  196. data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
  197. data/doc/ex/images/Leaf.miff +0 -0
  198. data/doc/ex/images/No.png +0 -0
  199. data/doc/ex/images/Polynesia.jpg +0 -0
  200. data/doc/ex/images/Red_Rocks.jpg +0 -0
  201. data/doc/ex/images/Rocks_On_Beach.miff +0 -0
  202. data/doc/ex/images/Shorts.jpg +0 -0
  203. data/doc/ex/images/Snake.png +0 -0
  204. data/doc/ex/images/Violin.jpg +0 -0
  205. data/doc/ex/images/Yellow_Rose.miff +0 -0
  206. data/doc/ex/images/big-duck.gif +0 -0
  207. data/doc/ex/images/duck.gif +0 -0
  208. data/doc/ex/images/duck0.gif +0 -0
  209. data/doc/ex/images/duck1.gif +0 -0
  210. data/doc/ex/images/duck10.gif +0 -0
  211. data/doc/ex/images/duck11.gif +0 -0
  212. data/doc/ex/images/duck12.gif +0 -0
  213. data/doc/ex/images/duck13.gif +0 -0
  214. data/doc/ex/images/duck14.gif +0 -0
  215. data/doc/ex/images/duck15.gif +0 -0
  216. data/doc/ex/images/duck2.gif +0 -0
  217. data/doc/ex/images/duck3.gif +0 -0
  218. data/doc/ex/images/duck4.gif +0 -0
  219. data/doc/ex/images/duck5.gif +0 -0
  220. data/doc/ex/images/duck6.gif +0 -0
  221. data/doc/ex/images/duck7.gif +0 -0
  222. data/doc/ex/images/duck8.gif +0 -0
  223. data/doc/ex/images/duck9.gif +0 -0
  224. data/doc/ex/images/graydient230x6.gif +0 -0
  225. data/doc/ex/images/image_with_profile.jpg +0 -0
  226. data/doc/ex/images/logo400x83.gif +0 -0
  227. data/doc/ex/images/model.miff +0 -0
  228. data/doc/ex/images/notimplemented.gif +0 -0
  229. data/doc/ex/images/smile.miff +0 -0
  230. data/doc/ex/images/spin.gif +0 -0
  231. data/doc/ex/implode.rb +0 -34
  232. data/doc/ex/level.rb +0 -11
  233. data/doc/ex/level_colors.rb +0 -11
  234. data/doc/ex/line.rb +0 -41
  235. data/doc/ex/line01.rb +0 -21
  236. data/doc/ex/mask.rb +0 -35
  237. data/doc/ex/matte_fill_to_border.rb +0 -39
  238. data/doc/ex/matte_floodfill.rb +0 -32
  239. data/doc/ex/matte_replace.rb +0 -39
  240. data/doc/ex/median_filter.rb +0 -28
  241. data/doc/ex/modulate.rb +0 -11
  242. data/doc/ex/mono.rb +0 -23
  243. data/doc/ex/morph.rb +0 -25
  244. data/doc/ex/mosaic.rb +0 -37
  245. data/doc/ex/motion_blur.rb +0 -11
  246. data/doc/ex/negate.rb +0 -11
  247. data/doc/ex/negate_channel.rb +0 -9
  248. data/doc/ex/nested_rvg.rb +0 -21
  249. data/doc/ex/nonzero.rb +0 -42
  250. data/doc/ex/normalize.rb +0 -11
  251. data/doc/ex/oil_paint.rb +0 -11
  252. data/doc/ex/opacity.rb +0 -37
  253. data/doc/ex/ordered_dither.rb +0 -11
  254. data/doc/ex/path.rb +0 -63
  255. data/doc/ex/pattern1.rb +0 -25
  256. data/doc/ex/pattern2.rb +0 -26
  257. data/doc/ex/polaroid.rb +0 -26
  258. data/doc/ex/polygon.rb +0 -23
  259. data/doc/ex/polygon01.rb +0 -21
  260. data/doc/ex/polyline.rb +0 -22
  261. data/doc/ex/polyline01.rb +0 -21
  262. data/doc/ex/posterize.rb +0 -8
  263. data/doc/ex/preview.rb +0 -8
  264. data/doc/ex/qbezierpath.rb +0 -52
  265. data/doc/ex/quad01.rb +0 -34
  266. data/doc/ex/quantize-m.rb +0 -25
  267. data/doc/ex/radial_blur.rb +0 -9
  268. data/doc/ex/raise.rb +0 -8
  269. data/doc/ex/random_threshold_channel.rb +0 -13
  270. data/doc/ex/rect01.rb +0 -14
  271. data/doc/ex/rect02.rb +0 -20
  272. data/doc/ex/rectangle.rb +0 -34
  273. data/doc/ex/reduce_noise.rb +0 -28
  274. data/doc/ex/remap.rb +0 -11
  275. data/doc/ex/remap_images.rb +0 -19
  276. data/doc/ex/resize_to_fill.rb +0 -8
  277. data/doc/ex/resize_to_fit.rb +0 -8
  278. data/doc/ex/roll.rb +0 -9
  279. data/doc/ex/rotate.rb +0 -44
  280. data/doc/ex/rotate_f.rb +0 -14
  281. data/doc/ex/roundrect.rb +0 -33
  282. data/doc/ex/rubyname.rb +0 -30
  283. data/doc/ex/rvg_clippath.rb +0 -12
  284. data/doc/ex/rvg_linecap.rb +0 -42
  285. data/doc/ex/rvg_linejoin.rb +0 -40
  286. data/doc/ex/rvg_opacity.rb +0 -18
  287. data/doc/ex/rvg_pattern.rb +0 -26
  288. data/doc/ex/rvg_stroke_dasharray.rb +0 -11
  289. data/doc/ex/segment.rb +0 -11
  290. data/doc/ex/sepiatone.rb +0 -7
  291. data/doc/ex/shade.rb +0 -11
  292. data/doc/ex/shadow.rb +0 -30
  293. data/doc/ex/shave.rb +0 -15
  294. data/doc/ex/shear.rb +0 -10
  295. data/doc/ex/sketch.rb +0 -17
  296. data/doc/ex/skewx.rb +0 -51
  297. data/doc/ex/skewy.rb +0 -47
  298. data/doc/ex/smile.rb +0 -126
  299. data/doc/ex/solarize.rb +0 -11
  300. data/doc/ex/sparse_color.rb +0 -55
  301. data/doc/ex/splice.rb +0 -8
  302. data/doc/ex/spread.rb +0 -11
  303. data/doc/ex/stegano.rb +0 -54
  304. data/doc/ex/stroke_dasharray.rb +0 -42
  305. data/doc/ex/stroke_fill.rb +0 -10
  306. data/doc/ex/stroke_linecap.rb +0 -44
  307. data/doc/ex/stroke_linejoin.rb +0 -48
  308. data/doc/ex/stroke_width.rb +0 -49
  309. data/doc/ex/swirl.rb +0 -17
  310. data/doc/ex/text.rb +0 -37
  311. data/doc/ex/text01.rb +0 -16
  312. data/doc/ex/text_align.rb +0 -36
  313. data/doc/ex/text_antialias.rb +0 -37
  314. data/doc/ex/text_styles.rb +0 -19
  315. data/doc/ex/text_undercolor.rb +0 -28
  316. data/doc/ex/texture_fill_to_border.rb +0 -34
  317. data/doc/ex/texture_floodfill.rb +0 -32
  318. data/doc/ex/texturefill.rb +0 -24
  319. data/doc/ex/threshold.rb +0 -13
  320. data/doc/ex/to_blob.rb +0 -13
  321. data/doc/ex/translate.rb +0 -39
  322. data/doc/ex/transparent.rb +0 -38
  323. data/doc/ex/transpose.rb +0 -9
  324. data/doc/ex/transverse.rb +0 -9
  325. data/doc/ex/tref01.rb +0 -24
  326. data/doc/ex/triangle01.rb +0 -15
  327. data/doc/ex/trim.rb +0 -23
  328. data/doc/ex/tspan01.rb +0 -17
  329. data/doc/ex/tspan02.rb +0 -17
  330. data/doc/ex/tspan03.rb +0 -19
  331. data/doc/ex/unsharp_mask.rb +0 -28
  332. data/doc/ex/viewex.rb +0 -33
  333. data/doc/ex/vignette.rb +0 -12
  334. data/doc/ex/watermark.rb +0 -27
  335. data/doc/ex/wave.rb +0 -9
  336. data/doc/ex/wet_floor.rb +0 -58
  337. data/doc/ex/writing_mode01.rb +0 -26
  338. data/doc/ex/writing_mode02.rb +0 -26
  339. data/doc/ilist.html +0 -2056
  340. data/doc/image1.html +0 -4680
  341. data/doc/image2.html +0 -3665
  342. data/doc/image3.html +0 -4522
  343. data/doc/imageattrs.html +0 -1638
  344. data/doc/imusage.html +0 -514
  345. data/doc/index.html +0 -416
  346. data/doc/info.html +0 -1499
  347. data/doc/magick.html +0 -570
  348. data/doc/optequiv.html +0 -2435
  349. data/doc/rvg.html +0 -975
  350. data/doc/rvgclip.html +0 -248
  351. data/doc/rvggroup.html +0 -305
  352. data/doc/rvgimage.html +0 -289
  353. data/doc/rvgpattern.html +0 -475
  354. data/doc/rvgshape.html +0 -406
  355. data/doc/rvgstyle.html +0 -270
  356. data/doc/rvgtext.html +0 -465
  357. data/doc/rvgtspan.html +0 -238
  358. data/doc/rvgtut.html +0 -530
  359. data/doc/rvguse.html +0 -145
  360. data/doc/rvgxform.html +0 -294
  361. data/doc/scripts/doc.js +0 -22
  362. data/doc/scripts/stripeTables.js +0 -23
  363. data/doc/struct.html +0 -1339
  364. data/doc/usage.html +0 -1621
  365. data/examples/constitute.rb +0 -7
  366. data/examples/crop_with_gravity.rb +0 -42
  367. data/examples/demo.rb +0 -323
  368. data/examples/describe.rb +0 -41
  369. data/examples/find_similar_region.rb +0 -34
  370. data/examples/histogram.rb +0 -312
  371. data/examples/identify.rb +0 -174
  372. data/examples/image_opacity.rb +0 -28
  373. data/examples/import_export.rb +0 -31
  374. data/examples/pattern_fill.rb +0 -37
  375. data/examples/rotating_text.rb +0 -45
  376. data/examples/spinner.rb +0 -49
  377. data/examples/thumbnail.rb +0 -64
  378. data/examples/vignette.rb +0 -78
  379. data/lib/obsolete.rb +0 -66
  380. data/spec/rmagick/ImageList1_spec.rb +0 -24
  381. data/spec/rmagick/draw_spec.rb +0 -155
  382. data/spec/rmagick/image/blue_shift_spec.rb +0 -14
  383. data/spec/rmagick/image/channel_entropy_spec.rb +0 -9
  384. data/spec/rmagick/image/composite_spec.rb +0 -72
  385. data/spec/rmagick/image/constitute_spec.rb +0 -13
  386. data/spec/rmagick/image/dispatch_spec.rb +0 -16
  387. data/spec/rmagick/image/from_blob_spec.rb +0 -12
  388. data/spec/rmagick/image/ping_spec.rb +0 -12
  389. data/spec/rmagick/image/properties_spec.rb +0 -27
  390. data/spec/rmagick/image/read_spec.rb +0 -28
  391. data/spec/spec_helper.rb +0 -10
  392. data/spec/support/issue_200/app.rb +0 -8
  393. data/test/Draw.rb +0 -351
  394. data/test/Enum.rb +0 -228
  395. data/test/Fill.rb +0 -93
  396. data/test/Image1.rb +0 -627
  397. data/test/Image2.rb +0 -1426
  398. data/test/Image3.rb +0 -1091
  399. data/test/ImageList1.rb +0 -858
  400. data/test/ImageList2.rb +0 -406
  401. data/test/Image_attributes.rb +0 -666
  402. data/test/Import_Export.rb +0 -115
  403. data/test/Info.rb +0 -444
  404. data/test/KernelInfo.rb +0 -67
  405. data/test/Magick.rb +0 -311
  406. data/test/Pixel.rb +0 -285
  407. data/test/PolaroidOptions.rb +0 -23
  408. data/test/Preview.rb +0 -26
  409. data/test/Struct.rb +0 -45
  410. data/test/appearance/Montage.rb +0 -26
  411. data/test/appearance/appearance_assertion.rb +0 -13
  412. data/test/appearance/expected/montage_border_color.jpg +0 -0
  413. data/test/cmyk.icm +0 -0
  414. data/test/lib/Obsolete.rb +0 -30
  415. data/test/lib/internal/Draw.rb +0 -823
  416. data/test/lib/internal/Geometry.rb +0 -98
  417. data/test/lib/internal/Magick.rb +0 -40
  418. data/test/srgb.icm +0 -0
  419. data/test/test_all_basic.rb +0 -49
  420. data/test/tmpnam_test.rb +0 -50
data/doc/draw.html DELETED
@@ -1,3272 +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 7 December 2008), see www.w3.org" />
8
-
9
- <title>RMagick 0.0.0: class Draw</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
- <script type="text/javascript" src="scripts/doc.js">
17
- </script>
18
- <style type="text/css">
19
- /*<![CDATA[*/
20
-
21
- /* Styles local to this page. */
22
-
23
- /*]]>*/
24
- </style>
25
- </head>
26
-
27
- <body>
28
- <h6 id="header">RMagick 0.0.0 User's Guide and Reference</h6>
29
-
30
- <div class="nav">
31
- &laquo;&nbsp;<a href="image3.html">Prev</a> | <a href=
32
- "index.html">Contents</a> | <a href=
33
- "struct.html">Next</a>&nbsp;&raquo;
34
- </div>
35
-
36
- <h1>class Draw <span class="superclass">&lt; Object</span></h1>
37
-
38
- <div id="toc">
39
- <h2>Table of Contents</h2>
40
-
41
- <h3>class methods</h3>
42
-
43
- <ul>
44
- <li><a href="#new">new</a></li>
45
- </ul>
46
-
47
- <h3>instance methods</h3>
48
-
49
- <div class="toccol">
50
- <ul>
51
- <li><a href="#annotate">annotate</a></li>
52
-
53
- <li><a href="#clone">clone</a></li>
54
- </ul>
55
- </div>
56
-
57
- <div class="toccol">
58
- <ul>
59
- <li><a href="#draw">draw</a></li>
60
-
61
- <li><a href="#dup">dup</a></li>
62
- </ul>
63
- </div>
64
-
65
- <div class="toccol">
66
- <ul>
67
- <li><a href=
68
- "#get_multiline_type_metrics">get_multiline_type_metrics</a></li>
69
-
70
- <li><a href="#get_type_metrics">get_type_metrics</a></li>
71
-
72
- <li><a href="#inspect">inspect</a></li>
73
- </ul>
74
- </div>
75
-
76
- <h3>drawing primitive methods</h3>
77
-
78
- <div class="toccol">
79
- <ul>
80
- <li><a href="#affine">affine</a></li>
81
-
82
- <li><a href="#arc">arc</a></li>
83
-
84
- <li><a href="#bezier">bezier</a></li>
85
-
86
- <li><a href="#circle">circle</a></li>
87
-
88
- <li><a href="#clip_path">clip_path</a></li>
89
-
90
- <li><a href="#clip_rule">clip_rule</a></li>
91
-
92
- <li><a href="#clip_units">clip_units</a></li>
93
-
94
- <li><a href="#color">color</a></li>
95
-
96
- <li><a href="#composite">composite</a></li>
97
-
98
- <li><a href="#decorate">decorate</a></li>
99
-
100
- <li><a href="#define_clip_path">define_clip_path</a></li>
101
-
102
- <li><a href="#ellipse">ellipse</a></li>
103
-
104
- <li><a href="#encoding">encoding</a></li>
105
-
106
- <li><a href="#fill">fill</a></li>
107
-
108
- <li><a href="#fill_opacity">fill_opacity</a></li>
109
-
110
- <li><a href="#fill_rule">fill_rule</a></li>
111
-
112
- <li><a href="#font">font</a></li>
113
-
114
- <li><a href="#font_family">font_family</a></li>
115
-
116
- <li><a href="#font_stretch">font_stretch</a></li>
117
- </ul>
118
- </div>
119
-
120
- <div class="toccol">
121
- <ul>
122
- <li><a href="#font_style">font_style</a></li>
123
-
124
- <li><a href="#font_weight">font_weight</a></li>
125
-
126
- <li><a href="#gravity">gravity</a></li>
127
-
128
- <li><a href="#interline_spacing">interline_spacing</a></li>
129
-
130
- <li><a href="#interword_spacing">interword_spacing</a></li>
131
-
132
- <li><a href="#kerning">kerning</a></li>
133
-
134
- <li><a href="#line">line</a></li>
135
-
136
- <li><a href="#matte">matte</a></li>
137
-
138
- <li><a href="#opacity">opacity</a></li>
139
-
140
- <li><a href="#path">path</a></li>
141
-
142
- <li><a href="#pattern">pattern</a></li>
143
-
144
- <li><a href="#point">point</a></li>
145
-
146
- <li><a href="#pointsize">pointsize</a></li>
147
-
148
- <li><a href="#polygon">polygon</a></li>
149
-
150
- <li><a href="#polyline">polyline</a></li>
151
-
152
- <li><a href="#pop">pop</a></li>
153
-
154
- <li><a href="#push">push</a></li>
155
-
156
- <li><a href="#rectangle">rectangle</a></li>
157
-
158
- <li><a href="#rotate">rotate</a></li>
159
- </ul>
160
- </div>
161
-
162
- <div class="toccol">
163
- <ul>
164
- <li><a href="#roundrectangle">roundrectangle</a></li>
165
-
166
- <li><a href="#scale">scale</a></li>
167
-
168
- <li><a href="#skewx">skewx</a></li>
169
-
170
- <li><a href="#skewy">skewy</a></li>
171
-
172
- <li><a href="#stroke">stroke</a></li>
173
-
174
- <li><a href="#stroke_antialias">stroke_antialias</a></li>
175
-
176
- <li><a href="#stroke_dasharray">stroke_dasharray</a></li>
177
-
178
- <li><a href="#stroke_dashoffset">stroke_dashoffset</a></li>
179
-
180
- <li><a href="#stroke_linecap">stroke_linecap</a></li>
181
-
182
- <li><a href="#stroke_linejoin">stroke_linejoin</a></li>
183
-
184
- <li><a href="#stroke_miterlimit">stroke_miterlimit</a></li>
185
-
186
- <li><a href="#stroke_opacity">stroke_opacity</a></li>
187
-
188
- <li><a href="#stroke_width">stroke_width</a></li>
189
-
190
- <li><a href="#text">text</a></li>
191
-
192
- <li><a href="#text_align">text_align</a></li>
193
-
194
- <li><a href="#text_anchor">text_anchor</a></li>
195
-
196
- <li><a href="#text_antialias">text_antialias</a></li>
197
-
198
- <li><a href="#text_undercolor">text_undercolor</a></li>
199
-
200
- <li><a href="#translate">translate</a></li>
201
- </ul>
202
- </div>
203
-
204
- <h3>annotate attributes</h3>
205
-
206
- <div class="toccol">
207
- <ul>
208
- <li><a href="#affine_eq">affine</a></li>
209
-
210
- <li><a href="#align_eq">align</a></li>
211
-
212
- <li><a href="#decorate_eq">decorate</a></li>
213
-
214
- <li><a href="#density_eq">density</a></li>
215
-
216
- <li><a href="#encoding_eq">encoding</a></li>
217
-
218
- <li><a href="#fill_eq">fill</a></li>
219
-
220
- <li><a href="#fill_pattern_eq">fill_pattern</a></li>
221
-
222
- <li><a href="#font_eq">font</a></li>
223
- </ul>
224
- </div>
225
-
226
- <div class="toccol">
227
- <ul>
228
- <li><a href="#font_family_eq">font_family</a></li>
229
-
230
- <li><a href="#font_stretch_eq">font_stretch</a></li>
231
-
232
- <li><a href="#font_style_eq">font_style</a></li>
233
-
234
- <li><a href="#font_weight_eq">font_weight</a></li>
235
-
236
- <li><a href="#gravity_eq">gravity</a></li>
237
-
238
- <li><a href=
239
- "#interline_spacing_eq">interline_spacing</a></li>
240
-
241
- <li><a href=
242
- "#interword_spacing_eq">interword_spacing</a></li>
243
-
244
- <li><a href="#kerning_eq">kerning</a></li>
245
- </ul>
246
- </div>
247
-
248
- <div class="toccol">
249
- <ul>
250
- <li><a href="#pointsize_eq">pointsize</a></li>
251
-
252
- <li><a href="#rotation_eq">rotation</a></li>
253
-
254
- <li><a href="#stroke_eq">stroke</a></li>
255
-
256
- <li><a href="#stroke_pattern_eq">stroke_pattern</a></li>
257
-
258
- <li><a href="#stroke_width_eq">stroke_width</a></li>
259
-
260
- <li><a href="#text_antialias_eq">text_antialias</a></li>
261
-
262
- <li><a href="#tile_eq">tile</a></li>
263
-
264
- <li><a href="#undercolor_eq">undercolor</a></li>
265
- </ul>
266
- </div>
267
- </div>
268
-
269
- <h2 class="methods">class methods</h2>
270
-
271
- <div class="sig">
272
- <h3 id="new">new</h3>
273
-
274
- <p>Draw.new <span class="arg">[&nbsp;{ optional parameters
275
- }&nbsp;]</span> -&gt; <em>draw</em></p>
276
- </div>
277
-
278
- <div class="desc">
279
- <h4>Description</h4>
280
-
281
- <p>Creates a new Draw object.</p>
282
-
283
- <h4>Arguments</h4>
284
-
285
- <p>If you plan to use the <code>annotate</code> method with
286
- this object you can initialize the <a href=
287
- "#attributes">attributes</a> in the associated block.</p>
288
-
289
- <h4>Returns</h4>A new <code>Draw</code> object.
290
-
291
- <h4>Example</h4>
292
- <pre>
293
- gc = Draw.new
294
- </pre>
295
- </div>
296
-
297
- <h2 class="methods">instance methods</h2>
298
-
299
- <div class="sig">
300
- <h3 id="annotate">annotate</h3>
301
-
302
- <p><span class="arg">draw.</span>annotate(<span class=
303
- "arg">img</span>, <span class="arg">width</span>, <span class=
304
- "arg">height</span>, <span class="arg">x</span>, <span class=
305
- "arg">y</span>, <span class="arg">text</span>) <span class=
306
- "arg">[&nbsp;{ additional parameters }&nbsp;]</span> -&gt;
307
- <em>self</em></p>
308
- </div>
309
-
310
- <div class="desc">
311
- <h4>Description</h4>
312
-
313
- <p>Annotates a image with text. The text is positioned
314
- according to the <code>gravity</code> attribute around the
315
- rectangle described by the <span class="arg">x</span>,
316
- <span class="arg">y</span>, <span class="arg">width</span>, and
317
- <span class="arg">height</span> arguments. If either of the
318
- <span class="arg">width</span> or <span class=
319
- "arg">height</span> arguments are 0, uses the image
320
- width-<span class="arg">x</span> and the image
321
- height-<span class="arg">y</span> to compute the rectangle
322
- width and height. The attributes described in <a href=
323
- "#attributes">annotate attributes</a>, below, influence the
324
- appearance and position of the text. These attributes may be
325
- set in the Draw object before calling <code>annotate</code>, or
326
- within <code>annotate</code>'s optional <span class=
327
- "arg">additional parameters</span> block.</p>
328
-
329
- <p><em>Note</em>: all of the <code>annotate</code> attributes
330
- are set-only.</p>
331
-
332
- <h4>Arguments</h4>
333
-
334
- <dl>
335
- <dt>img</dt>
336
-
337
- <dd>the image or imagelist to be annotated</dd>
338
-
339
- <dt>width</dt>
340
-
341
- <dd>width of the rectangle within which the text is
342
- positioned</dd>
343
-
344
- <dt>height</dt>
345
-
346
- <dd>height of the rectangle within which the text is
347
- positioned</dd>
348
-
349
- <dt>x</dt>
350
-
351
- <dd>x offset of the rectangle</dd>
352
-
353
- <dt>y</dt>
354
-
355
- <dd>y offset of the rectangle</dd>
356
-
357
- <dt>text</dt>
358
-
359
- <dd>the text</dd>
360
- </dl>
361
-
362
- <h4>Returns</h4>
363
-
364
- <p>self</p>
365
-
366
- <h4>Example</h4>
367
-
368
- <p>This example is an excerpt of <a href=
369
- "javascript:popup('colors.rb.html')" title=
370
- "Click to see the example script">colors.rb</a>. Many other
371
- examples also use <code>annotate</code>.</p>
372
- <pre>
373
- title.annotate(montage, 0,0,0,40, 'Named Colors') {
374
- self.font_family = 'Helvetica'
375
- self.fill = 'white'
376
- self.stroke = 'transparent'
377
- self.pointsize = 32
378
- self.font_weight = BoldWeight
379
- self.gravity = NorthGravity
380
- }
381
- </pre>
382
-
383
- <h4>Special characters</h4>
384
-
385
- <p>Escape a blank, quote, or apostrophe by preceding it with a
386
- backslash ("\"). To include a backslash in the text, use two
387
- consecutive backslashes. To include a '%' in the text, use
388
- '%%'. You can include information about the image by including
389
- one or more of the special character sequences shown in this
390
- table.</p>
391
-
392
- <table id="spec_chars_table" summary=
393
- "annotate special characters" class="simple_table">
394
- <caption>
395
- Special characters
396
- </caption>
397
-
398
- <tr>
399
- <th>Replaced by</th>
400
-
401
- <th>&nbsp;</th>
402
- </tr>
403
-
404
- <tr>
405
- <td>%b</td>
406
-
407
- <td>file size in bytes</td>
408
- </tr>
409
-
410
- <tr>
411
- <td>%c</td>
412
-
413
- <td>"comment" property string</td>
414
- </tr>
415
-
416
- <tr>
417
- <td>%d</td>
418
-
419
- <td>directory in which the file resides</td>
420
- </tr>
421
-
422
- <tr>
423
- <td>%e</td>
424
-
425
- <td>filename extension</td>
426
- </tr>
427
-
428
- <tr>
429
- <td>%f</td>
430
-
431
- <td>original filename</td>
432
- </tr>
433
-
434
- <tr>
435
- <td>%g</td>
436
-
437
- <td>group number</td>
438
- </tr>
439
-
440
- <tr>
441
- <td>%h</td>
442
-
443
- <td>height</td>
444
- </tr>
445
-
446
- <tr>
447
- <td>%i</td>
448
-
449
- <td>current filename</td>
450
- </tr>
451
-
452
- <tr>
453
- <td>%k</td>
454
-
455
- <td>number of unique colors</td>
456
- </tr>
457
-
458
- <tr>
459
- <td>%l</td>
460
-
461
- <td>"label" property string</td>
462
- </tr>
463
-
464
- <tr>
465
- <td>%m</td>
466
-
467
- <td>file format</td>
468
- </tr>
469
-
470
- <tr>
471
- <td>%n</td>
472
-
473
- <td>number of images in the sequence (for RMagick, this is
474
- always 1)</td>
475
- </tr>
476
-
477
- <tr>
478
- <td>%o</td>
479
-
480
- <td>output filename</td>
481
- </tr>
482
-
483
- <tr>
484
- <td>%p</td>
485
-
486
- <td>page number (for RMagick, this is always 1)</td>
487
- </tr>
488
-
489
- <tr>
490
- <td>%q</td>
491
-
492
- <td>depth</td>
493
- </tr>
494
-
495
- <tr>
496
- <td>%r</td>
497
-
498
- <td>A string of the form "ClasstypeColorspace," for example
499
- "DirectClassRGB". If the image's <em>matte</em> attribute
500
- is <code>true</code>, appends the word "Matte" to the end
501
- of the string.</td>
502
- </tr>
503
-
504
- <tr>
505
- <td>%s</td>
506
-
507
- <td>scene number (always 1)</td>
508
- </tr>
509
-
510
- <tr>
511
- <td>%t</td>
512
-
513
- <td>filename without extension</td>
514
- </tr>
515
-
516
- <tr>
517
- <td>%u</td>
518
-
519
- <td>unique temporary filename</td>
520
- </tr>
521
-
522
- <tr>
523
- <td>%w</td>
524
-
525
- <td>width</td>
526
- </tr>
527
-
528
- <tr>
529
- <td>%x</td>
530
-
531
- <td>x resolution</td>
532
- </tr>
533
-
534
- <tr>
535
- <td>%y</td>
536
-
537
- <td>y resolution</td>
538
- </tr>
539
-
540
- <tr>
541
- <td>%z</td>
542
-
543
- <td>depth</td>
544
- </tr>
545
- </table>
546
-
547
- <h4>See also</h4>
548
-
549
- <p>This method is also defined in the <a href=
550
- "image1.html#annotate">Image</a> class.</p>
551
-
552
- <h4>Magick API</h4>
553
-
554
- <p>AnnotateImage</p>
555
- </div>
556
-
557
- <div class="sig">
558
- <h3 id="clone">clone</h3>
559
-
560
- <p><span class="arg">draw</span>.clone -&gt;
561
- <em>other_draw</em></p>
562
- </div>
563
-
564
- <div class="desc">
565
- <h4>Description</h4>
566
-
567
- <p>Same as <a href="#dup">dup</a> except the frozen state of
568
- the original is propagated to the copy.</p>
569
-
570
- <h4>Returns</h4>
571
-
572
- <p>A new Draw object.</p>
573
- </div>
574
-
575
- <div class="sig">
576
- <h3 id="draw">draw</h3>
577
-
578
- <p><span class="arg">draw</span>.draw(<span class=
579
- "arg">img</span>) -&gt; <em>self</em></p>
580
- </div>
581
-
582
- <div class="desc">
583
- <h4>Description</h4>
584
-
585
- <p>Draws the list of graphic primitives on the specified image.
586
- Calling <code>draw</code> does not affect the list of
587
- primitives. Each time you call <code>draw</code> the primitives
588
- will be re-executed from the beginning.</p>
589
-
590
- <h4>Arguments</h4>
591
-
592
- <p>Either an imagelist or a image. If an imagelist, draws on
593
- the current image.</p>
594
-
595
- <h4>Returns</h4>
596
-
597
- <p>self</p>
598
-
599
- <h4>Example</h4>
600
-
601
- <p>See the other examples on this page.</p>
602
-
603
- <h4>Magick API</h4>
604
-
605
- <p>DrawImage</p>
606
- </div>
607
-
608
- <div class="sig">
609
- <h3 id="dup">dup</h3>
610
-
611
- <p><span class="arg">draw</span>.dup -&gt;
612
- <em>other_draw</em></p>
613
- </div>
614
-
615
- <div class="desc">
616
- <h4>Description</h4>
617
-
618
- <p>Duplicate a <code>Draw</code> object.</p>
619
-
620
- <h4>Returns</h4>
621
-
622
- <p>An exact copy of the receiver, including the list of drawing
623
- primitives.</p>
624
-
625
- <h4>See also</h4>
626
-
627
- <p><a href="#clone">clone</a></p>
628
- </div>
629
-
630
- <div class="sig">
631
- <h3 id="get_multiline_type_metrics">
632
- get_multiline_type_metrics</h3>
633
-
634
- <p><span class=
635
- "arg">draw</span>.get_multiline_type_metrics([<span class=
636
- "arg">image</span>,] <span class="arg">string</span>) -&gt;
637
- <em>type_metrics</em></p>
638
- </div>
639
-
640
- <div class="sig">
641
- <h3 id="get_type_metrics">get_type_metrics</h3>
642
-
643
- <p><span class="arg">draw</span>.get_type_metrics([<span class=
644
- "arg">image</span>,] <span class="arg">string</span>) -&gt;
645
- <em>type_metrics</em></p>
646
- </div>
647
-
648
- <div class="desc">
649
- <h4>Description</h4>
650
-
651
- <p>Returns information for a specific string if rendered on a
652
- image. Metrics are derived from either the <a href="#attributes">
653
- annotate attributes</a> or from the <a href="info.html">image
654
- info attributes</a>, but not from any drawing primitive methods.
655
- The <code>get_multiline_type_metrics</code> method is the same as
656
- <code>get_type_metrics</code>, except the former returns the
657
- maximum height and width for multiple lines of text. (Text lines
658
- are separated by "\n" characters.)</p>
659
-
660
- <p>The Magick++ documentation for its TypeMetric class provides
661
- this useful additional information. (I've changed it a bit to
662
- use RMagick names.)</p>
663
-
664
- <blockquote>
665
- <p class="imquote">The TypeMetric class provides the means to
666
- pass data from the Draw class's get_type_metric method to the
667
- user. It provides information regarding font metrics such as
668
- ascent, descent, text width, text height, and maximum
669
- horizontal advance. The units of these font metrics are in
670
- pixels...(T)he metrics are dependent on the current Image
671
- font (default Ghostscript's "Helvetica"), pointsize (default
672
- 12 points), and x/y resolution (default 72 DPI) settings.</p>
673
-
674
- <p class="imquote">The pixel units may be converted to points
675
- (the standard resolution-independent measure used by the
676
- typesetting industry) via the following equation:</p>
677
-
678
- <p><code>size_points = (size_pixels *
679
- 72)/resolution</code></p>
680
-
681
- <p class="imquote">where resolution is in dots-per-inch
682
- (DPI). This means that at the default image resolution, there
683
- is one pixel per point.</p>
684
-
685
- <p class="imquote">Note that a font's pointsize is only a
686
- first-order approximation of the font height (ascender +
687
- descender) in points. The relationship between the specified
688
- pointsize and the rendered font height is determined by the
689
- font designer.</p>
690
-
691
- <p class="imquote">See <a href=
692
- "http://freetype.sourceforge.net/freetype2/docs/glyphs/index.html">
693
- FreeType Glyph Conventions</a> for a detailed description of
694
- font metrics related issues.</p>
695
- </blockquote>
696
-
697
- <h4>Arguments</h4>
698
-
699
- <dl>
700
- <dt>image <em>(optional)</em></dt>
701
-
702
- <dd>The image on which the string will be rendered.
703
- ImageMagick uses the attributes of the image (font name,
704
- pointsize, etc.) to compute the metrics. If this argument is
705
- omitted, <code>get_type_metrics</code> substitutes a dummy
706
- image with default attributes. The <span class=
707
- "arg">string</span> argument may not contain any of the
708
- special characters shown in <a href=
709
- "#spec_chars_table">this</a> table.</dd>
710
-
711
- <dt>string</dt>
712
-
713
- <dd>The string to be rendered. If <span class=
714
- "arg">img</span> is specified, the string may contain special
715
- characters that refer to the image attributes. See <a href=
716
- "#spec_chars_table">this</a> table.</dd>
717
- </dl>
718
-
719
- <h4>Returns</h4>
720
-
721
- <p>A TypeMetric struct. This structure has the following
722
- attributes. (The descriptions are taken from the <a href=
723
- "http://www.imagemagick.org/Magick++/TypeMetric.html">Magick++</a>
724
- documentation and source code.)</p>
725
-
726
- <table summary="type metric attributes" class="simple_table">
727
- <caption>
728
- TypeMetric attributes
729
- </caption>
730
-
731
- <tr>
732
- <th>Accessor</th>
733
-
734
- <th>Description</th>
735
- </tr>
736
-
737
- <tr>
738
- <td>ascent</td>
739
-
740
- <td>Distance in pixels from the text baseline to the
741
- highest/upper grid coordinate used to place an outline
742
- point. Always a positive value.</td>
743
- </tr>
744
-
745
- <tr>
746
- <td>descent</td>
747
-
748
- <td>Distance in pixels from the baseline to the lowest grid
749
- coordinate used to place an outline point. Always a
750
- negative value.</td>
751
- </tr>
752
-
753
- <tr>
754
- <td>width</td>
755
-
756
- <td>Text width in pixels</td>
757
- </tr>
758
-
759
- <tr>
760
- <td>height</td>
761
-
762
- <td>Text height in pixels</td>
763
- </tr>
764
-
765
- <tr>
766
- <td>max_advance</td>
767
-
768
- <td>Maximum horizontal advance (advance from the beginning
769
- of a character to the beginning of the next character) in
770
- pixels.</td>
771
- </tr>
772
- </table>
773
-
774
- <h4>Example</h4>
775
-
776
- <p>This example shows the details of a TypeMetric struct.
777
- <a href="javascript:popup('get_type_metrics.rb.html')" title=
778
- "Click to see the example script"><img src=
779
- "ex/get_type_metrics.gif" alt=
780
- "get_type_metrics example" /></a></p>
781
-
782
- <p>This example uses the <code>width</code> and
783
- <code>height</code> values returned by
784
- <code>get_multiline_type_metrics</code> to draw a border around
785
- the text lines. <a href=
786
- "javascript:popup('get_multiline_type_metrics.rb.html')" title=
787
- "Click to see the example script"><img src=
788
- "ex/get_multiline_type_metrics.gif" alt=
789
- "get_multiline_type_metrics example" /></a></p>
790
-
791
- <h4>Magick API</h4>
792
-
793
- <p>GetTypeMetrics, GetMultilineTypeMetrics</p>
794
- </div>
795
-
796
- <div class="sig">
797
- <h3 id="inspect">inspect</h3>
798
-
799
- <p><span class="arg">draw</span>.inspect -&gt;
800
- <em>string</em></p>
801
- </div>
802
-
803
- <div class="desc">
804
- <h4>Description</h4>
805
-
806
- <p>Returns the list of primitives that have been added to the
807
- <code>draw</code> object. This is very handy for debugging.</p>
808
-
809
- <h4>Example</h4>
810
- <pre>
811
- draw.inspect &raquo;
812
- "stroke red
813
- fill transparent
814
- rectangle 20,20 380,180
815
- line 200,20 200,180
816
- line 20,100 380,100
817
- stroke transparent
818
- fill black"
819
- </pre>
820
- </div>
821
-
822
- <h2 class="methods">drawing primitive methods</h2>
823
-
824
- <div class="sig">
825
- <h3 id="affine">affine</h3>
826
-
827
- <p><span class="arg">draw</span>.affine(<span class="arg">sx,
828
- rx, ry, sy, tx, ty</span>) -&gt; <em>self</em></p>
829
- </div>
830
-
831
- <div class="desc">
832
- <h4>Description</h4>
833
-
834
- <p>Transforms the coordinate system by a 3x3 transformation
835
- matrix. See <a href=
836
- "http://www.w3.org/TR/SVG/coords.html#EstablishingANewUserSpace">
837
- Coordinate system transformations</a> in the <cite>Scalable
838
- Vector Graphics (SVG) 1.1 Specification</cite>.</p>
839
-
840
- <h4>Arguments</h4>
841
-
842
- <dl>
843
- <dt>sx, sy</dt>
844
-
845
- <dd>The amount of scaling in the <em>x</em> and <em>y</em>
846
- directions</dd>
847
-
848
- <dt>rx, ry</dt>
849
-
850
- <dd>The rotation in the <em>x</em> and <em>y</em> directions,
851
- in radians</dd>
852
-
853
- <dt>tx, ty</dt>
854
-
855
- <dd>The translation distances in the <em>x</em> and
856
- <em>y</em> directions, in pixels</dd>
857
- </dl>
858
-
859
- <h4>Returns</h4>
860
-
861
- <p>self</p>
862
-
863
- <h4>Example</h4>
864
-
865
- <p>This example changes the default coordinate system to the
866
- standard Cartesian coordinate system: the x-axis points
867
- rightward and the y-axis points up.</p>
868
-
869
- <p><code>gc.affine(1, 0, 0, -1, 0, max_y)</code></p>
870
-
871
- <p><a href="javascript:popup('affine.rb.html')" title=
872
- "Click to see the example script"><img src="ex/affine.gif" alt=
873
- "affine example" /></a></p>
874
-
875
- <h4>See also</h4><a href="#rotate">rotate</a>, <a href=
876
- "#scale">scale</a>, <a href="#translate">translate</a>
877
- </div>
878
-
879
- <div class="sig">
880
- <h3 id="arc">arc</h3>
881
-
882
- <p><span class="arg">draw</span>.arc(<span class="arg">start_x,
883
- start_y, end_x, end_y, start_degrees, end_degrees</span>) -&gt;
884
- <em>self</em></p>
885
- </div>
886
-
887
- <div class="desc">
888
- <h4>Description</h4>
889
-
890
- <p>Draws an arc within a rectangle.</p>
891
-
892
- <h4>Arguments</h4>
893
-
894
- <dl>
895
- <dt>start_x, start_y</dt>
896
-
897
- <dd>one corner of the bounding rectangle</dd>
898
-
899
- <dt>end_x, end_y</dt>
900
-
901
- <dd>the opposite corner of the bounding rectangle</dd>
902
-
903
- <dt>start_degrees</dt>
904
-
905
- <dd>where to start drawing the arc</dd>
906
-
907
- <dt>end_degrees</dt>
908
-
909
- <dd>where the arc ends</dd>
910
- </dl>
911
-
912
- <h4>Returns</h4>
913
-
914
- <p>self</p>
915
-
916
- <h4>Example</h4>
917
-
918
- <p><code>gc.arc(40, 50, 250, 180, 0, 270)</code></p>
919
-
920
- <p><a href="javascript:popup('arc.rb.html')" title=
921
- "Click to see the example script"><img src="ex/arc.gif" alt=
922
- "arc example" /></a></p>
923
-
924
- <h4>See also</h4><a href="#ellipse">ellipse</a>, <a href=
925
- "#path">the SVG elliptical arc commands (A and a)</a>
926
- </div>
927
-
928
- <div class="sig">
929
- <h3 id="bezier">bezier</h3>
930
-
931
- <p><span class="arg">draw</span>.bezier(<span class=
932
- "arg">x1</span>, <span class="arg">y1</span>, <span class=
933
- "arg">cx1</span>, <span class="arg">cy1</span>, <span class=
934
- "arg">cx2</span>, <span class="arg">cy2</span>, <span class=
935
- "arg">x2</span>, <span class="arg">y2</span>...) -&gt;
936
- <em>self</em></p>
937
- </div>
938
-
939
- <div class="desc">
940
- <h4>Description</h4>
941
-
942
- <p>Draw a cubic Bezier curve.</p>
943
-
944
- <h4>Arguments</h4>
945
-
946
- <p>The arguments are pairs of points. At least 4 pairs must be
947
- specified. Each point <span class="arg">xn</span>, <span class=
948
- "arg">yn</span> on the curve is associated with a control point
949
- <span class="arg">cxn</span>, <span class="arg">cyn</span>. The
950
- first point, <span class="arg">x1</span>, <span class=
951
- "arg">y1</span>, is the starting point. The last point,
952
- <span class="arg">xn</span>, <span class="arg">yn</span>, is
953
- the ending point. Other point/control point pairs specify
954
- intermediate points on a polybezier curve.</p>
955
-
956
- <h4>Returns</h4>
957
-
958
- <p>self</p>
959
-
960
- <h4>Examples</h4>
961
-
962
- <p>The following examples are taken from the <a href=
963
- "http://www.w3.org/TR/SVG/paths.html">Paths</a> section of the
964
- <cite>Scalable Vector Graphics (SVG) 1.1
965
- Specification</cite>.</p>
966
-
967
- <h4>Example 1</h4>
968
-
969
- <p><code>gc.bezier(20,120, 20,20, 320,20, 320,120)</code></p>
970
-
971
- <p><a href="javascript:popup('cbezier1.rb.html')"><img src=
972
- "ex/cbezier1.gif" alt="bezier example 1" title=
973
- "Click to see the example script" /></a></p>
974
-
975
- <h4>Example 2</h4>
976
-
977
- <p><code>gc.bezier(25,125, 100,25, 400,25, 325,125)</code></p>
978
-
979
- <p><a href="javascript:popup('cbezier2.rb.html')"><img src=
980
- "ex/cbezier2.gif" alt="bezier example 2" title=
981
- "Click to see the example script" /></a></p>
982
-
983
- <h4>Example 3</h4>
984
-
985
- <p><code>gc.bezier(100,150, 25,50, 475,50, 400,150)</code></p>
986
-
987
- <p><a href="javascript:popup('cbezier3.rb.html')"><img src=
988
- "ex/cbezier3.gif" alt="bezier example 3" title=
989
- "Click to see the example script" /></a></p>
990
-
991
- <h4>Example 4</h4>
992
-
993
- <p><code>gc.bezier(20,180, 20,30, 320,330, 320,180)</code></p>
994
-
995
- <p><a href="javascript:popup('cbezier4.rb.html')"><img src=
996
- "ex/cbezier4.gif" alt="bezier example 4" title=
997
- "Click to see the example script" /></a></p>
998
-
999
- <h4>Example 5</h4>
1000
-
1001
- <p><code>gc.bezier(20,120, 95,20, 245,20, 320,120)</code></p>
1002
-
1003
- <p><a href="javascript:popup('cbezier5.rb.html')"><img src=
1004
- "ex/cbezier5.gif" alt="bezier example 5" title=
1005
- "Click to see the example script" /></a></p>
1006
-
1007
- <h4>Example 6</h4>
1008
-
1009
- <p><code>gc.bezier(50,150, 50,50, 200,50, 200,150, 200,250,
1010
- 350,250, 350,150)</code></p>
1011
-
1012
- <p><a href="javascript:popup('cbezier6.rb.html')"><img src=
1013
- "ex/cbezier6.gif" alt="bezier example 6" title=
1014
- "Click to see the example script" /></a></p>
1015
- </div>
1016
-
1017
- <div class="sig">
1018
- <h3 id="circle">circle</h3>
1019
-
1020
- <p><span class="arg">draw</span>.circle(<span class=
1021
- "arg">origin_x, origin_y, perim_x, perim_y</span>) -&gt;
1022
- <em>self</em></p>
1023
- </div>
1024
-
1025
- <p>self</p>
1026
-
1027
- <div class="desc">
1028
- <h4>Description</h4>
1029
-
1030
- <p>Draw a circle.</p>
1031
-
1032
- <h4>Arguments</h4>
1033
-
1034
- <dl>
1035
- <dt>origin_x, origin_y</dt>
1036
-
1037
- <dd>The center of the circle.</dd>
1038
-
1039
- <dt>perim_x, perim_y</dt>
1040
-
1041
- <dd>A point on the perimeter of the circle.</dd>
1042
- </dl>
1043
-
1044
- <h4>Returns</h4>
1045
-
1046
- <p>self</p>
1047
-
1048
- <h4>Example</h4>
1049
-
1050
- <p><code>gc.circle(125,125, 25,125)</code></p>
1051
-
1052
- <p><a href="javascript:popup('circle.rb.html')"><img src=
1053
- "ex/circle.gif" alt="circle example" title=
1054
- "Click to see the example script" /></a></p>
1055
- </div>
1056
-
1057
- <div class="sig">
1058
- <h3 id="clip_path">clip_path</h3>
1059
-
1060
- <p><span class="arg">draw</span>.clip_path(<span class=
1061
- "arg">pathname</span>) -&gt; <em>self</em></p>
1062
- </div>
1063
-
1064
- <div class="desc">
1065
- <h4>Description</h4>
1066
-
1067
- <p class="imquote">Draws the clip path on the image mask. The
1068
- clip path defines a clipping area, where only the contained
1069
- area will be drawn upon. Areas outside of the clipping area are
1070
- masked.</p>
1071
-
1072
- <p>Before using a clip-path, you must create it using the
1073
- <a href="#define_clip_path">define_clip_path</a> method. You
1074
- must precede <code>clip_path</code> with <a href=
1075
- "#push">push</a> and terminate the primitives that draw within
1076
- the clip path with <a href="#pop">pop</a>. For example,</p>
1077
- <pre>
1078
- gc.push
1079
- gc.clip_path('mypath')
1080
- # drawing primitives within the clip path
1081
- gc.pop
1082
- gc.draw
1083
- </pre>
1084
-
1085
- <p>Also see the example below.</p>
1086
-
1087
- <h4>Arguments</h4>
1088
-
1089
- <p>The name of the clip path.</p>
1090
-
1091
- <h4>Returns</h4>
1092
-
1093
- <p>self</p>
1094
-
1095
- <h4>Example</h4>
1096
-
1097
- <p>In this example, the picture of the girl is drawn onto the
1098
- canvas using a star-shaped clipping path.</p>
1099
-
1100
- <p><a href="javascript:popup('clip_path.rb.html')" id=
1101
- "clip_path_ex" name="clip_path_ex"><img src="ex/clip_path.gif"
1102
- alt="clip_path example" title=
1103
- "Click to see the example script" /></a></p>
1104
-
1105
- <h4>See also</h4><a href=
1106
- "#define_clip_path">define_clip_path</a>
1107
- </div>
1108
-
1109
- <div class="sig">
1110
- <h3 id="clip_rule">clip_rule</h3>
1111
-
1112
- <p><span class=
1113
- "arg">draw</span>.clip_rule(<code>"evenodd"</code> or
1114
- <code>"nonzero"</code>) -&gt; <em>self</em></p>
1115
- </div>
1116
-
1117
- <div class="desc">
1118
- <h4>Description</h4>
1119
-
1120
- <p>Specify how to determine if a point on the image is inside
1121
- clipping region. See <a href=
1122
- "http://www.w3.org/TR/SVG/painting.html#FillRuleProperty"><code>
1123
- the <b>'fill-rule'</b> property</code></a> in the
1124
- <cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>
1125
- for a complete description and examples.</p>
1126
-
1127
- <h4>Arguments</h4>
1128
-
1129
- <p>Either "evenodd" or "nonzero".</p>
1130
-
1131
- <h4>Returns</h4>
1132
-
1133
- <p>self</p>
1134
- </div>
1135
-
1136
- <div class="sig">
1137
- <h3 id="clip_units">clip_units</h3>
1138
-
1139
- <p><span class=
1140
- "arg">draw</span>.clip_units(<code>"userSpace"</code>
1141
- <span class="arg">or</span> <code>"userSpaceOnUse"</code> or
1142
- <code>"objectSpace"</code>) -&gt; <em>self</em></p>
1143
- </div>
1144
-
1145
- <div class="desc">
1146
- <h4>Description</h4>
1147
-
1148
- <p>Defines the coordinate space within the clipping region. See
1149
- <a href=
1150
- "http://www.w3.org/TR/SVG/masking.html#EstablishingANewClippingPath">
1151
- Establishing a New Clipping Path</a> in the <cite>Scalable
1152
- Vector Graphics (SVG) 1.1 Specification</cite> for a complete
1153
- description and examples.</p>
1154
-
1155
- <h4>Arguments</h4>
1156
-
1157
- <p>Either "userSpace", "userSpaceOnUse", or "objectSpace".</p>
1158
-
1159
- <h4>Returns</h4>
1160
-
1161
- <p>self</p>
1162
- </div>
1163
-
1164
- <div class="sig">
1165
- <h3 id="color">color</h3>
1166
-
1167
- <p><span class="arg">draw</span>.color(<span class=
1168
- "arg">x</span>, <span class="arg">y</span>, <span class=
1169
- "arg">paint_method</span>) -&gt; <em>self</em></p>
1170
- </div>
1171
-
1172
- <div class="desc">
1173
- <h4>Description</h4>
1174
-
1175
- <p>Set color in image according to the specified <a href=
1176
- "constants.html#PaintMethod">PaintMethod</a> constant.</p>
1177
-
1178
- <h4>Arguments</h4>
1179
-
1180
- <p>A <a href="constants.html#PaintMethod">PaintMethod</a>
1181
- constant. If you use the <code>FillToBorderMethod</code>,
1182
- assign the border color with the
1183
- <code>Draw#border_color=</code> attribute before calling
1184
- <a href="#draw">draw</a>.</p>
1185
-
1186
- <h4>Returns</h4>
1187
-
1188
- <p>self</p>
1189
-
1190
- <h4>Example</h4>
1191
- <pre>
1192
- draw.border_color = 'black'
1193
- draw.color(x, y, FillToBorderMethod)
1194
- </pre>
1195
-
1196
- <h4>See Also</h4>
1197
-
1198
- <p><a href="#matte">matte</a></p>
1199
- </div>
1200
-
1201
- <div class="sig">
1202
- <h3 id="composite">composite</h3>
1203
-
1204
- <p><span class="arg">draw</span>.composite(<span class=
1205
- "arg">x</span>, <span class="arg">y</span>, <span class=
1206
- "arg">width</span>, <span class="arg">height</span>,
1207
- <span class="arg">composite_image</span>, <span class=
1208
- "arg">op</span>=<code>OverCompositeOp</code>) -&gt;
1209
- <em>self</em></p>
1210
- </div>
1211
-
1212
- <div class="desc">
1213
- <h4>Description</h4>
1214
-
1215
- <p>Composite <span class="arg">composite_image</span> with the
1216
- receiver image.</p>
1217
-
1218
- <h4>Arguments</h4>
1219
-
1220
- <dl>
1221
- <dt>x, y</dt>
1222
-
1223
- <dd>The offset of <span class="arg">composite_image</span>
1224
- relative to the receiver image.</dd>
1225
-
1226
- <dt>width, height</dt>
1227
-
1228
- <dd>Scale the <span class="arg">composite_image</span> to
1229
- this size. If either value is 0, <span class=
1230
- "arg">composite_image</span> is not scaled.</dd>
1231
-
1232
- <dt>composite_image</dt>
1233
-
1234
- <dd>Either an imagelist or a image. If an imagelist, uses the
1235
- current image.</dd>
1236
-
1237
- <dt>op</dt>
1238
-
1239
- <dd>A <a href=
1240
- "constants.html#CompositeOperator">CompositeOperator</a>
1241
- constant.</dd>
1242
- </dl>
1243
-
1244
- <h4>Returns</h4>
1245
-
1246
- <p>self</p>
1247
-
1248
- <h4>Example 1</h4>
1249
-
1250
- <p><a href="javascript:popup('drawcomp.rb.html')"><img src=
1251
- "ex/drawcomp1.gif" alt="composite example 1" title=
1252
- "Click to see the example script" /></a></p>
1253
-
1254
- <h4>Example 2</h4>
1255
-
1256
- <p><a href="javascript:popup('drawcomp.rb.html')"><img src=
1257
- "ex/drawcomp2.gif" alt="composite example 2" title=
1258
- "Click to see the example script" /></a></p>
1259
-
1260
- <h4>See also</h4>
1261
-
1262
- <p><a href="image1.html#composite">composite</a></p>
1263
- </div>
1264
-
1265
- <div class="sig">
1266
- <h3 id="decorate">decorate</h3>
1267
-
1268
- <p><span class="arg">draw</span>.decorate(<span class=
1269
- "arg">decoration</span>) -&gt; <em>self</em></p>
1270
- </div>
1271
-
1272
- <div class="desc">
1273
- <h4>Description</h4>
1274
-
1275
- <p>Specify text decoration.</p>
1276
-
1277
- <h4>Arguments</h4>
1278
-
1279
- <p>A <a href="constants.html#DecorationType">DecorationType</a>
1280
- constant.</p>
1281
-
1282
- <h4>Returns</h4>
1283
-
1284
- <p>self</p>
1285
-
1286
- <h4>Example</h4>
1287
- <pre>
1288
- draw.decorate(LineThroughDecoration)
1289
- </pre>
1290
- </div>
1291
-
1292
- <div class="sig">
1293
- <h3 id="define_clip_path">define_clip_path</h3>
1294
-
1295
- <p><span class="arg">draw</span>.define_clip_path(<span class=
1296
- "arg">string</span>) { <span class="arg">block</span> } -&gt;
1297
- <em>self</em></p>
1298
- </div>
1299
-
1300
- <div class="desc">
1301
- <h4>Description</h4>
1302
-
1303
- <p>Define a clip-path. Within <span class="arg">block</span>,
1304
- call other drawing primitive methods (<code>rectangle</code>,
1305
- <code>polygon</code>, <code>text</code>, etc.) to define the
1306
- clip-path. The union of all the primitives (excluding the
1307
- effects of rendering methods such as <code>stroke_width</code>,
1308
- etc.) is the clip-path. After the clip-path is invoked by the
1309
- <a href="#clip_path">clip-path</a> method, anything drawn on
1310
- the image inside the clip-path will appear. Anything drawn
1311
- outside the clip-path will be hidden. (See <a href=
1312
- "#clip_rule">clip_rule</a> for a definition of how ImageMagick
1313
- decides what is "inside" and what is "outside" of the
1314
- clip-path.)</p>
1315
-
1316
- <h4>Arguments</h4>
1317
-
1318
- <p>The name of the clip-path. This is the name that is
1319
- specified in the <code>clip_path</code> method.</p>
1320
-
1321
- <h4>Returns</h4>
1322
-
1323
- <p>self</p>
1324
-
1325
- <h4>Example</h4>See <a href="#clip_path">clip_path</a>.
1326
- </div>
1327
-
1328
- <div class="sig">
1329
- <h3 id="ellipse">ellipse</h3>
1330
-
1331
- <p>draw.ellipse(<span class="arg">origin_x</span>, <span class=
1332
- "arg">origin_y</span>, <span class="arg">width</span>,
1333
- <span class="arg">height</span>, <span class=
1334
- "arg">arc_start</span>, <span class="arg">arc_end</span>) -&gt;
1335
- <em>self</em></p>
1336
- </div>
1337
-
1338
- <div class="desc">
1339
- <h4>Description</h4>
1340
-
1341
- <p>Draw an ellipse.</p>
1342
-
1343
- <h4>Arguments</h4>
1344
-
1345
- <dl>
1346
- <dt>origin_x, origin_y</dt>
1347
-
1348
- <dd>The center of the ellipse</dd>
1349
-
1350
- <dt>width, height</dt>
1351
-
1352
- <dd>The horizontal and vertical radii</dd>
1353
-
1354
- <dt>arc_start</dt>
1355
-
1356
- <dd>Where to start the ellipse, in degrees. 0 degrees is at 3
1357
- o'clock.</dd>
1358
-
1359
- <dt>arc_end</dt>
1360
-
1361
- <dd>Where to end the ellipse, in degrees</dd>
1362
- </dl>
1363
-
1364
- <h4>Returns</h4>
1365
-
1366
- <p>self</p>
1367
-
1368
- <h4>Example</h4>
1369
-
1370
- <p><code>draw.ellipse(180,125, 150,75, 0, 270)</code></p>
1371
-
1372
- <p><a href="javascript:popup('ellipse.rb.html')"><img src=
1373
- "ex/ellipse.gif" alt="ellipse example" title=
1374
- "Click to see the example script" /></a></p>
1375
-
1376
- <h4>See also</h4><a href="#arc">arc</a>, <a href=
1377
- "#circle">circle</a>, <a href="#path">path</a>
1378
- </div>
1379
-
1380
- <div class="sig">
1381
- <h3 id="encoding">encoding</h3>
1382
-
1383
- <p><span class="arg">draw</span>.encoding(<span class=
1384
- "arg">string</span>) -&gt; <em>self</em></p>
1385
- </div>
1386
-
1387
- <div class="desc">
1388
- <h4>Description</h4>
1389
-
1390
- <p>Specify the font encoding.</p>
1391
-
1392
- <h4>Arguments</h4>
1393
-
1394
- <p>See the ImageMagick documentation for the
1395
- <code>-encoding</code> option to the <code>mogrify</code>
1396
- command</p>
1397
-
1398
- <h4>Returns</h4>
1399
-
1400
- <p>self</p>
1401
- </div>
1402
-
1403
- <div class="sig">
1404
- <h3 id="fill">fill</h3>
1405
-
1406
- <p><span class="arg">draw</span>.fill(<span class=
1407
- "arg">string</span>) -&gt; <em>self</em></p>
1408
- </div>
1409
-
1410
- <div class="desc">
1411
- <h4>Description</h4>
1412
-
1413
- <p>Specify the color or pattern with which graphical elements
1414
- are filled.</p>
1415
-
1416
- <h4>Arguments</h4>
1417
-
1418
- <p>A <a href="imusage.html#color_names">color name</a> or
1419
- <a href="#pattern">pattern</a> name.</p>
1420
-
1421
- <h4>Returns</h4>
1422
-
1423
- <p>self</p>
1424
-
1425
- <h4>Example</h4>
1426
- <pre>
1427
- draw.fill('red')
1428
- </pre>
1429
-
1430
- <h4>Aliases</h4>
1431
-
1432
- <p><code>fill_color</code>, <code>fill_pattern</code></p>
1433
- </div>
1434
-
1435
- <div class="sig">
1436
- <h3 id="fill_opacity">fill_opacity</h3>
1437
-
1438
- <p><span class="arg">draw</span>.fill_opacity(<span class=
1439
- "arg">float</span> or <em>string</em>) -&gt; <em>self</em></p>
1440
- </div>
1441
-
1442
- <div class="desc">
1443
- <h4>Description</h4>
1444
-
1445
- <p>Specify the fill opacity.</p>
1446
-
1447
- <h4>Arguments</h4>
1448
-
1449
- <p>A number between 0 and 1, inclusive, or a percentage
1450
- represented as a string, i.e. '30%'. The argument 0.3 is the
1451
- same as '30%'.</p>
1452
-
1453
- <h4>Returns</h4>
1454
-
1455
- <p>self</p>
1456
-
1457
- <h4>Example</h4>
1458
-
1459
- <p>See the example for <a href="#opacity">opacity</a>.</p>
1460
-
1461
- <h4>See also</h4><a href="#opacity">opacity</a>, <a href=
1462
- "#stroke_opacity">stroke_opacity</a>
1463
- </div>
1464
-
1465
- <div class="sig">
1466
- <h3 id="fill_rule">fill_rule</h3>
1467
-
1468
- <p><span class=
1469
- "arg">draw</span>.fill_rule(<code>"evenodd"</code> or
1470
- <code>"nonzero"</code>) -&gt; <em>self</em></p>
1471
- </div>
1472
-
1473
- <div class="desc">
1474
- <h4>Description</h4>
1475
-
1476
- <p>Specify how to determine if a point on the image is inside a
1477
- shape. See <a href=
1478
- "http://www.w3.org/TR/SVG/painting.html#FillRuleProperty"><code>
1479
- the <b>'fill-rule'</b> property</code></a> in the
1480
- <cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>
1481
- for a complete description and examples.</p>
1482
-
1483
- <h4>Arguments</h4>
1484
-
1485
- <p>Either "evenodd" or "nonzero".</p>
1486
-
1487
- <h4>Returns</h4>
1488
-
1489
- <p>self</p>
1490
- </div>
1491
-
1492
- <div class="sig">
1493
- <h3 id="font">font</h3>
1494
-
1495
- <p><span class="arg">draw</span>.font(<span class=
1496
- "arg">string</span>) -&gt; <em>self</em></p>
1497
- </div>
1498
-
1499
- <div class="desc">
1500
- <h4>Description</h4>
1501
-
1502
- <p>Specify the font to draw text with.</p>
1503
-
1504
- <h4>Arguments</h4>
1505
-
1506
- <p>The font name or filename. <span class="imquote">You can tag
1507
- a font to specify whether it is a Postscript, Truetype, or
1508
- OPTION1 font. For example, Arial.ttf is a Truetype font,
1509
- ps:helvetica is Postscript, and x:fixed is OPTION1.</span></p>
1510
-
1511
- <p>The font name can be a complete filename such as
1512
- <code>"/mnt/windows/windows/fonts/Arial.ttf"</code>. The font
1513
- name can also be a fully qualified X font name such as
1514
- <code>"-urw-times-medium-i-normal--0-0-0-0-p-0-iso8859-13"</code>.</p>
1515
-
1516
- <h4>Returns</h4>
1517
-
1518
- <p>self</p>
1519
-
1520
- <h4>See also</h4><a href="#font_family">font_family</a>
1521
- </div>
1522
-
1523
- <div class="sig">
1524
- <h3 id="font_family">font_family</h3>
1525
-
1526
- <p><span class="arg">draw</span>.font_family(<span class=
1527
- "arg">string</span>) -&gt; <em>self</em></p>
1528
- </div>
1529
-
1530
- <div class="desc">
1531
- <h4>Description</h4>
1532
-
1533
- <p>Specify the font family.</p>
1534
-
1535
- <h4>Arguments</h4>
1536
-
1537
- <p>A font family name such as "arial" or "helvetica".</p>
1538
-
1539
- <h4>Returns</h4>
1540
-
1541
- <p>self</p>
1542
-
1543
- <h4>Example</h4>
1544
-
1545
- <p>See the example for <a href="#text">text</a>.</p>
1546
- </div>
1547
-
1548
- <div class="sig">
1549
- <h3 id="font_stretch">font_stretch</h3>
1550
-
1551
- <p><span class="arg">draw</span>.font_stretch(<span class=
1552
- "arg">stretch</span>) -&gt; <em>self</em></p>
1553
- </div>
1554
-
1555
- <div class="desc">
1556
- <h4>Description</h4>
1557
-
1558
- <p>Specify the spacing between text characters.</p>
1559
-
1560
- <h4>Arguments</h4>
1561
-
1562
- <p>A <a href="constants.html#StretchType">StretchType</a>
1563
- constant.</p>
1564
-
1565
- <h4>Returns</h4>
1566
-
1567
- <p>self</p>
1568
- </div>
1569
-
1570
- <div class="sig">
1571
- <h3 id="font_style">font_style</h3>
1572
-
1573
- <p><span class="arg">draw</span>.font_style(<span class=
1574
- "arg">style</span>) -&gt; <em>self</em></p>
1575
- </div>
1576
-
1577
- <div class="desc">
1578
- <h4>Description</h4>
1579
-
1580
- <p>Specify the font style, i.e. italic, oblique, or normal.</p>
1581
-
1582
- <h4>Arguments</h4>
1583
-
1584
- <p>A <a href="constants.html#StyleType">StyleType</a>
1585
- constant.</p>
1586
-
1587
- <h4>Returns</h4>
1588
-
1589
- <p>self</p>
1590
- </div>
1591
-
1592
- <div class="sig">
1593
- <h3 id="font_weight">font_weight</h3>
1594
-
1595
- <p><span class="arg">draw</span>.font_weight(<span class=
1596
- "arg">weight</span>) -&gt; <em>self</em></p>
1597
- </div>
1598
-
1599
- <div class="desc">
1600
- <h4>Description</h4>
1601
-
1602
- <p>Specify the font weight. For example, "bold" or
1603
- "normal".</p>
1604
-
1605
- <h4>Arguments</h4>
1606
-
1607
- <p>A <a href="constants.html#WeightType">WeightType</a>
1608
- constant, or one of the numbers 100, 200, 300, 400, 500, 600,
1609
- 700, 800, or 900.</p>
1610
-
1611
- <h4>Returns</h4>
1612
-
1613
- <p>self</p>
1614
- </div>
1615
-
1616
- <div class="sig">
1617
- <h3 id="gravity">gravity</h3>
1618
-
1619
- <p><span class="arg">draw</span>.gravity(<span class=
1620
- "arg">gravity</span>) -&gt; <em>self</em></p>
1621
- </div>
1622
-
1623
- <div class="desc">
1624
- <h4>Description</h4>
1625
-
1626
- <p>Specify how the text is positioned. The default is
1627
- <code>NorthWestGravity</code>.</p>
1628
-
1629
- <h4>Arguments</h4>
1630
-
1631
- <p>A <a href="constants.html#GravityType">GravityType</a>
1632
- constant.</p>
1633
-
1634
- <h4>Returns</h4>
1635
-
1636
- <p>self</p>
1637
-
1638
- <h4>Example</h4>
1639
-
1640
- <p><a href="javascript:popup('grav.rb.html')"><img src=
1641
- "ex/grav.gif" alt="gravity example" title=
1642
- "Click to see the example script" /></a></p>
1643
-
1644
- <h4>See also</h4>
1645
-
1646
- <p><a href="#text_align">text_align</a></p>
1647
- </div>
1648
-
1649
- <div class="sig">
1650
- <h3 id="interline_spacing">interline_spacing</h3>
1651
-
1652
- <p><span class="arg">draw</span>.interline_spacing(<span class=
1653
- "arg">space</span>) -&gt; <em>self</em></p>
1654
- </div>
1655
-
1656
- <div class="desc">
1657
- <h4>Description</h4>
1658
-
1659
- <p>Modify the spacing between lines when text has multiple
1660
- lines.</p>
1661
-
1662
- <h4>Argument</h4>
1663
-
1664
- <p>A numeric value. If positive, inserts additional space
1665
- between lines. If negative, removes space between lines. The
1666
- amount of space inserted or removed depends on the font.</p>
1667
-
1668
- <h4>Returns</h4>
1669
-
1670
- <p>self</p>
1671
- </div>
1672
-
1673
- <div class="sig">
1674
- <h3 id="interword_spacing">interword_spacing</h3>
1675
-
1676
- <p><span class="arg">draw</span>.interword_spacing(<span class=
1677
- "arg">space</span>) -&gt; <em>self</em></p>
1678
- </div>
1679
-
1680
- <div class="desc">
1681
- <h4>Description</h4>
1682
-
1683
- <p>Modify the spacing between words in text.</p>
1684
-
1685
- <h4>Argument</h4>
1686
-
1687
- <p>A numeric value. If positive, inserts additional space
1688
- between words. If negative, removes space between words. The
1689
- amount of space inserted or removed depends on the font.</p>
1690
-
1691
- <h4>Returns</h4>
1692
-
1693
- <p>self</p>
1694
- </div>
1695
-
1696
- <div class="sig">
1697
- <h3 id="kerning">kerning</h3>
1698
-
1699
- <p><span class="arg">draw</span>.kerning(<span class=
1700
- "arg">space</span>) -&gt; <em>self</em></p>
1701
- </div>
1702
-
1703
- <div class="desc">
1704
- <h4>Description</h4>
1705
-
1706
- <p>Modify the spacing between letters in text.</p>
1707
-
1708
- <h4>Argument</h4>
1709
-
1710
- <p>A numeric value. If positive, inserts additional space
1711
- between letters. If negative, removes space between letters.
1712
- The amount of space inserted or removed depends on the font but
1713
- is usually measured in pixels. That is, the following call adds
1714
- <em>about</em> 5 pixels between each letter.</p>
1715
- <pre>
1716
- gc.kerning(5)
1717
- </pre>
1718
-
1719
- <h4>Returns</h4>
1720
-
1721
- <p>self</p>
1722
- </div>
1723
-
1724
- <div class="sig">
1725
- <h3 id="line">line</h3>
1726
-
1727
- <p><span class="arg">draw</span>.line(<span class=
1728
- "arg">here_x</span>, <span class="arg">here_y</span>,
1729
- <span class="arg">there_x</span>, <span class=
1730
- "arg">there_y</span>) -&gt; <em>self</em></p>
1731
- </div>
1732
-
1733
- <div class="desc">
1734
- <h4>Description</h4>
1735
-
1736
- <p>Draw a line from <em>here</em> to <em>there</em>.</p>
1737
-
1738
- <h4>Arguments</h4>
1739
-
1740
- <dl>
1741
- <dt>here_x, here_y</dt>
1742
-
1743
- <dd>The starting point.</dd>
1744
-
1745
- <dt>there_x, there_y</dt>
1746
-
1747
- <dd>The ending point.</dd>
1748
- </dl>
1749
-
1750
- <h4>Returns</h4>
1751
-
1752
- <p>self</p>
1753
-
1754
- <h4>Example</h4>
1755
-
1756
- <p><code>gc.line(50,50, 50,200)<br />
1757
- gc.line(50,200, 200,200)<br />
1758
- gc.line(200,200, 50,50)</code></p>
1759
-
1760
- <p><a href="javascript:popup('line.rb.html')"><img src=
1761
- "ex/line.gif" alt="line example" title=
1762
- "Click to see the example script" /></a></p>
1763
- </div>
1764
-
1765
- <div class="sig">
1766
- <h3 id="matte">matte</h3>
1767
-
1768
- <p><span class="arg">draw</span>.matte(<span class=
1769
- "arg">x</span>,<span class="arg">y</span>, <span class=
1770
- "arg">paint_method</span>) -&gt; <em>self</em></p>
1771
- </div>
1772
-
1773
- <div class="desc">
1774
- <h4>Description</h4>
1775
-
1776
- <p>Make the image transparent according to the specified
1777
- PaintMethod constant.</p>
1778
-
1779
- <h4>Arguments</h4>
1780
-
1781
- <dl>
1782
- <dt>x, y</dt>
1783
-
1784
- <dd>Point in image to use, along with the PaintMethod
1785
- constant, to set transparent pixels in the image.</dd>
1786
-
1787
- <dt>paint_method</dt>
1788
-
1789
- <dd>
1790
- One of the following <a href=
1791
- "constants.html#PaintMethod">PaintMethod</a> constants:
1792
-
1793
- <dl>
1794
- <dt>PointMethod</dt>
1795
-
1796
- <dd>Make the pixel at <em>(x,y)</em> transparent.</dd>
1797
-
1798
- <dt>ReplaceMethod</dt>
1799
-
1800
- <dd>Make all pixels that are the same color as the pixel
1801
- at <em>(x,y)</em> transparent.</dd>
1802
-
1803
- <dt>FloodfillMethod</dt>
1804
-
1805
- <dd>Make all the pixels surrounding the pixel at
1806
- <em>(x,y)</em> transparent, until encountering pixels
1807
- that fail to match color at <em>(x,y)</em>.</dd>
1808
-
1809
- <dt>FillToBorderMethod</dt>
1810
-
1811
- <dd>Make all the pixels surrounding the pixel at
1812
- <em>(x,y)</em> transparent, until encountering pixels
1813
- that match the border color. Assign the border color with
1814
- the <code>Draw#border_color=</code> attribute before
1815
- calling <a href="#draw">draw</a>.</dd>
1816
-
1817
- <dt>ResetMethod</dt>
1818
-
1819
- <dd>Make the entire image transparent.</dd>
1820
- </dl>
1821
- </dd>
1822
- </dl>
1823
-
1824
- <h4>Returns</h4>
1825
-
1826
- <p>self</p>
1827
-
1828
- <h4>See also</h4><a href="#color">color</a><a href=
1829
- "image2.html#matte_point">matte_point</a>, <a href=
1830
- "image2.html#matte_replace">matte_replace</a>, <a href=
1831
- "image2.html#matte_floodfill">matte_floodfill</a>, <a href=
1832
- "image2.html#matte_fill_to_border">matte_fill_to_border</a>,
1833
- <a href="image2.html#opaque">opaque</a>, <a href=
1834
- "image3.html#transparent">transparent</a>
1835
- </div>
1836
-
1837
- <div class="sig">
1838
- <h3 id="opacity">opacity</h3>
1839
-
1840
- <p><span class="arg">draw</span>.opacity(<span class=
1841
- "arg">opacity</span>) -&gt; <em>self</em></p>
1842
- </div>
1843
-
1844
- <div class="desc">
1845
- <h4>Description</h4>
1846
-
1847
- <p>Specify the fill and stroke opacities.</p>
1848
-
1849
- <h4>Arguments</h4>
1850
-
1851
- <p>Either a number between 0 and 1, or a percentage represented
1852
- as a string, i.e. "25%". The string argument "25%" is the same
1853
- as the numeric argument 0.25. Both the fill and stroke
1854
- opacities are set to the specified value.</p>
1855
-
1856
- <h4>Returns</h4>
1857
-
1858
- <p>self</p>
1859
-
1860
- <h4>Example</h4>
1861
-
1862
- <p>This example demonstrates 4 levels of opacity.</p>
1863
-
1864
- <p><a href="javascript:popup('opacity.rb.html')"><img src=
1865
- "ex/opacity.png" alt="opacity example" title=
1866
- "Click to see the example script" /></a></p>
1867
-
1868
- <h4>See also</h4>
1869
-
1870
- <p><a href="#fill_opacity">fill_opacity</a>, <a href=
1871
- "#stroke_opacity">stroke_opacity</a></p>
1872
- </div>
1873
-
1874
- <div class="sig">
1875
- <h3 id="path">path</h3>
1876
-
1877
- <p><span class="arg">draw</span>.path(<span class=
1878
- "arg">string</span>) -&gt; <em>self</em></p>
1879
- </div>
1880
-
1881
- <div class="desc">
1882
- <h4>Description</h4>
1883
-
1884
- <p>Draw using SVG-compatible path drawing commands. See
1885
- "<a href="http://www.w3.org/TR/SVG/paths.html">Paths</a>" in
1886
- the <cite>Scalable Vector Graphics (SVG) 1.1
1887
- Specification</cite>.</p>
1888
-
1889
- <h4>Arguments</h4>
1890
-
1891
- <p>A string containing SVG <em>moveto</em>, <em>line</em>,
1892
- <em>curve</em>, <em>arc</em>, or <em>closepath</em>
1893
- instructions. The string is equivalent to the
1894
- <strong>d</strong> attribute in an SVG <strong>'path'</strong>
1895
- element.</p>
1896
-
1897
- <h4>Returns</h4>
1898
-
1899
- <p>self</p>
1900
-
1901
- <h4>Example</h4>
1902
-
1903
- <p>These examples are all taken from the <a href=
1904
- "http://www.w3.org/TR/SVG/paths.html">SVG path</a>
1905
- examples.</p>
1906
-
1907
- <h4>Example 1 - Arcs</h4>
1908
-
1909
- <p><code>gc.path('M110,100 h-75 a75,75 0 1,0 75,-75 z')<br />
1910
- gc.path('M97.5,87.5 v-75 a75,75 0 0,0 -75,75 z')</code></p>
1911
-
1912
- <p><a href="javascript:popup('arcpath.rb.html')"><img src=
1913
- "ex/arcpath.gif" alt="path example 1" title=
1914
- "Click to see the example script" /></a></p>
1915
-
1916
- <h4>Example 2 - Quadratic bezier</h4>
1917
-
1918
- <p><code>gc.path("M20,150 Q120,25 220,150 T420,150")</code></p>
1919
-
1920
- <p><a href="javascript:popup('qbezierpath.rb.html')"><img src=
1921
- "ex/qbezierpath.gif" alt="path example 2" title=
1922
- "Click to see the example script" /></a></p>
1923
-
1924
- <h4>Example 3 - Cubic bezier</h4>
1925
-
1926
- <p><code>gc.path("M20,120 C20,20 170,20 170,120 S320,220
1927
- 320,120")</code></p>
1928
-
1929
- <p><a href="javascript:popup('path.rb.html')"><img src=
1930
- "ex/path.gif" alt="path example 3" title=
1931
- "Click to see the example script" /></a></p>
1932
- </div>
1933
-
1934
- <div class="sig">
1935
- <h3 id="pattern">pattern</h3>
1936
-
1937
- <p><span class="arg">draw</span>.pattern(<span class=
1938
- "arg">name</span>, <span class="arg">x</span>, <span class=
1939
- "arg">y</span>, <span class="arg">width</span>, <span class=
1940
- "arg">height</span>) { pattern primitives } -&gt;
1941
- <em>self</em></p>
1942
- </div>
1943
-
1944
- <div class="desc">
1945
- <h4>Description</h4>
1946
-
1947
- <p>Define a pattern that can be used as the <a href=
1948
- "#fill">fill</a> or <a href="#stroke">stroke</a> pattern.</p>
1949
-
1950
- <h4>Arguments</h4>
1951
-
1952
- <dl>
1953
- <dt>name</dt>
1954
-
1955
- <dd>The name of the pattern. The pattern is used in a
1956
- <a href="#fill">fill</a> or <a href="#stroke">stroke</a>
1957
- method by specifying its name.</dd>
1958
-
1959
- <dt>x, y, width, height</dt>
1960
-
1961
- <dd>Define how the pattern is tiled. The pattern rectangles
1962
- start at (<span class="arg">x</span> +
1963
- <em>m</em>*<span class="arg">width</span>, <span class=
1964
- "arg">y</span>+<em>n</em>*<span class="arg">height</span>)
1965
- for the values of <em>n</em> and <em>m</em> as necessary to
1966
- fill the space.</dd>
1967
-
1968
- <dt>pattern primitives</dt>
1969
-
1970
- <dd>The method calls that draw the pattern.</dd>
1971
- </dl>
1972
-
1973
- <h4>Returns</h4>
1974
-
1975
- <p>self</p>
1976
-
1977
- <h4>Example 1</h4>
1978
-
1979
- <p><a href="javascript:popup('pattern1.rb.html')"><img src=
1980
- "ex/pattern1.gif" alt="pattern example 1" title=
1981
- "Click to see the example script" /></a></p>
1982
-
1983
- <h4>Example 2</h4>
1984
-
1985
- <p><a href="javascript:popup('pattern2.rb.html')"><img src=
1986
- "ex/pattern2.gif" alt="pattern example 2" title=
1987
- "Click to see the example script" /></a></p>
1988
-
1989
- <h4>See also</h4>
1990
-
1991
- <p><a href="#fill">fill</a>, <a href="#stroke">stroke</a></p>
1992
- </div>
1993
-
1994
- <div class="sig">
1995
- <h3 id="point">point</h3>
1996
-
1997
- <p><span class="arg">draw</span>.point(<span class=
1998
- "arg">x</span>, <span class="arg">y</span>) -&gt;
1999
- <em>self</em></p>
2000
- </div>
2001
-
2002
- <div class="desc">
2003
- <h4>Description</h4>
2004
-
2005
- <p>Set the pixel at <span class="arg">x</span>,<span class=
2006
- "arg">y</span> to the <a href="#fill">fill</a> color.</p>
2007
-
2008
- <h4>Arguments</h4>
2009
-
2010
- <dl>
2011
- <dt>x, y</dt>
2012
-
2013
- <dd>The pixel location</dd>
2014
- </dl>
2015
-
2016
- <h4>Returns</h4>
2017
-
2018
- <p>self</p>
2019
- </div>
2020
-
2021
- <div class="sig">
2022
- <h3 id="pointsize">pointsize</h3>
2023
-
2024
- <p><span class="arg">draw</span>.pointsize(<span class=
2025
- "arg">integer</span>) -&gt; <em>self</em></p>
2026
- </div>
2027
-
2028
- <div class="desc">
2029
- <h4>Description</h4>
2030
-
2031
- <p>Set the font size in points. The default is 12.</p>
2032
-
2033
- <h4>Arguments</h4>
2034
-
2035
- <p>See the example for <a href="#text">text</a>.</p>
2036
-
2037
- <h4>Returns</h4>
2038
-
2039
- <p>self</p>
2040
-
2041
- <h4>Alias</h4>
2042
-
2043
- <p>font_size</p>
2044
- </div>
2045
-
2046
- <div class="sig">
2047
- <h3 id="polygon">polygon</h3>
2048
-
2049
- <p><span class="arg">draw</span>.polygon(<span class=
2050
- "arg">x1</span>, <span class="arg">y1</span>,...,<span class=
2051
- "arg">xN</span>, <span class="arg">yN</span>) -&gt;
2052
- <em>self</em></p>
2053
- </div>
2054
-
2055
- <div class="desc">
2056
- <h4>Description</h4>
2057
-
2058
- <p>Draw a polygon.</p>
2059
-
2060
- <h4>Arguments</h4>
2061
-
2062
- <p>The arguments are a sequence of 2 or more points. If the
2063
- last point is not the same as the first, the polygon is closed
2064
- by drawing a line from the last point to the first.</p>
2065
-
2066
- <h4>Returns</h4>
2067
-
2068
- <p>self</p>
2069
-
2070
- <h4>Example</h4>
2071
-
2072
- <p>This example is taken from the <a href=
2073
- "http://www.w3.org/TR/SVG/shapes.html#PolygonElement">The
2074
- 'polygon' element</a> in the <cite>Scalable Vector Graphics
2075
- (SVG) 1.1 Specification</cite></p><a href=
2076
- "javascript:popup('polygon.rb.html')"><img src="ex/polygon.gif"
2077
- alt="polygon example" title=
2078
- "Click to see the example script" /></a>
2079
-
2080
- <h4>See also</h4><a href="#path">path</a>
2081
- </div>
2082
-
2083
- <div class="sig">
2084
- <h3 id="polyline">polyline</h3>
2085
-
2086
- <p><span class="arg">draw</span>.polyline(<span class=
2087
- "arg">x1</span>, <span class="arg">y1</span>,...,<span class=
2088
- "arg">xN</span>, <span class="arg">yN</span>) -&gt;
2089
- <em>self</em></p>
2090
- </div>
2091
-
2092
- <div class="desc">
2093
- <h4>Description</h4>
2094
-
2095
- <p>Draw a polyline. Unlike a polygon, a polyline is not
2096
- automatically closed.</p>
2097
-
2098
- <h4>Arguments</h4>
2099
-
2100
- <p>A sequence of 2 or more points.</p>
2101
-
2102
- <h4>Returns</h4>
2103
-
2104
- <p>self</p>
2105
-
2106
- <h4>Example</h4>
2107
-
2108
- <p>This example is taken from the <a href=
2109
- "http://www.w3.org/TR/SVG/shapes.html#PolylineElement">The
2110
- 'polyline' element</a> in the <cite>Scalable Vector Graphics
2111
- (SVG) 1.1 Specification</cite></p>
2112
-
2113
- <p><a href="javascript:popup('polyline.rb.html')"><img src=
2114
- "ex/polyline.gif" alt="polyline example" title=
2115
- "Click to see the example script" /></a></p>
2116
- </div>
2117
-
2118
- <div class="sig">
2119
- <h3 id="pop">pop</h3>
2120
-
2121
- <p><span class="arg">draw</span>.pop -&gt; <em>self</em></p>
2122
- </div>
2123
-
2124
- <div class="desc">
2125
- <h4>Description</h4>
2126
-
2127
- <p>Restore the graphics context to the state it was in when
2128
- <a href="#push">push</a> was called last.</p>
2129
-
2130
- <h4>Returns</h4>
2131
-
2132
- <p>self</p>
2133
-
2134
- <h4>See also</h4><a href="#push">push</a>
2135
- </div>
2136
-
2137
- <div class="sig">
2138
- <h3 id="push">push</h3>
2139
-
2140
- <p><span class="arg">draw</span>.push -&gt; <em>self</em></p>
2141
- </div>
2142
-
2143
- <div class="desc">
2144
- <h4>Description</h4>
2145
-
2146
- <p>Save the current state of the graphics context, including
2147
- the attribute settings and the current set of primitives. Use
2148
- the <a href="#pop">pop</a> primitive to restore the state.</p>
2149
-
2150
- <p><em>Note:</em> The <code>push</code> and <code>pop</code>
2151
- methods are probably not as useful in RMagick as they are in C
2152
- language ImageMagick programs, since it is easy to create
2153
- separate draw objects, each with its own set of properties and
2154
- primitives.</p>
2155
-
2156
- <h4>Returns</h4>
2157
-
2158
- <p>self</p>
2159
-
2160
- <h4>See also</h4><a href="#pop">pop</a>
2161
- </div>
2162
-
2163
- <div class="sig">
2164
- <h3 id="rectangle">rectangle</h3>
2165
-
2166
- <p><span class="arg">draw</span>.rectangle(<span class=
2167
- "arg">x1</span>, <span class="arg">y1</span>, <span class=
2168
- "arg">x2</span>, <span class="arg">y2</span>) -&gt;
2169
- <em>self</em></p>
2170
- </div>
2171
-
2172
- <div class="desc">
2173
- <h4>Description</h4>
2174
-
2175
- <p>Draw a rectangle.</p>
2176
-
2177
- <h4>Arguments</h4>
2178
-
2179
- <dl>
2180
- <dt>x1, y1</dt>
2181
-
2182
- <dd>The upper left hand corner of the rectangle</dd>
2183
-
2184
- <dt>x2, y2</dt>
2185
-
2186
- <dd>The lower right hand corner of the rectangle</dd>
2187
- </dl>
2188
-
2189
- <h4>Returns</h4>
2190
-
2191
- <p>self</p>
2192
-
2193
- <h4>Example</h4>
2194
-
2195
- <p><code>gc.rectangle(20,20, 280,180)</code></p><a href=
2196
- "javascript:popup('rectangle.rb.html')"><img src=
2197
- "ex/rectangle.gif" alt="rectangle example" title=
2198
- "Click to see the example script" /></a>
2199
- </div>
2200
-
2201
- <div class="sig">
2202
- <h3 id="rotate">rotate</h3>
2203
-
2204
- <p><span class="arg">draw</span>.rotate(<span class=
2205
- "arg">degrees</span>) -&gt; <em>self</em></p>
2206
- </div>
2207
-
2208
- <div class="desc">
2209
- <h4>Description</h4>
2210
-
2211
- <p>Specify a rotation transformation to the coordinate space.
2212
- The default is 0.</p>
2213
-
2214
- <h4>Arguments</h4>
2215
-
2216
- <p>The amount of rotation, in degrees. The angle of rotation is
2217
- clockwise, so 90&deg; is South.</p>
2218
-
2219
- <h4>Returns</h4>
2220
-
2221
- <p>self</p>
2222
-
2223
- <h4>Example</h4>
2224
-
2225
- <p><code>gc.rotate(45)</code></p>
2226
-
2227
- <p><a href="javascript:popup('rotate.rb.html')"><img src=
2228
- "ex/rotate.gif" alt="rotate example" title=
2229
- "Click to see the example script" /></a></p>
2230
-
2231
- <h4>See also</h4><a href="#affine">affine</a>
2232
- </div>
2233
-
2234
- <div class="sig">
2235
- <h3 id="roundrectangle">roundrectangle</h3>
2236
-
2237
- <p><span class="arg">draw</span>.roundrectangle(<span class=
2238
- "arg">x1</span>, <span class="arg">y1</span>, <span class=
2239
- "arg">x2</span>, <span class="arg">y2</span>, <span class=
2240
- "arg">cw</span>, <span class="arg">ch</span>) -&gt;
2241
- <em>self</em></p>
2242
- </div>
2243
-
2244
- <div class="desc">
2245
- <h4>Description</h4>
2246
-
2247
- <p>Draw a rectangle with rounded corners.</p>
2248
-
2249
- <h4>Arguments</h4>
2250
-
2251
- <dl>
2252
- <dt>x1, y1</dt>
2253
-
2254
- <dd>The upper left hand corner of the rectangle</dd>
2255
-
2256
- <dt>x2, y2</dt>
2257
-
2258
- <dd>The lower right hand corner of the rectangle</dd>
2259
-
2260
- <dt>cw, ch</dt>
2261
-
2262
- <dd>The corner width and height</dd>
2263
- </dl>
2264
-
2265
- <h4>Returns</h4>
2266
-
2267
- <p>self</p>
2268
-
2269
- <h4>Example</h4>
2270
-
2271
- <p><code>gc.roundrectangle(20,20, 280,180, 8, 8)</code></p>
2272
-
2273
- <p><a href="javascript:popup('roundrect.rb.html')"><img src=
2274
- "ex/roundrect.gif" alt="roundrectangle example" title=
2275
- "Click to see the example script" /></a></p>
2276
- </div>
2277
-
2278
- <div class="sig">
2279
- <h3 id="scale">scale</h3>
2280
-
2281
- <p><span class="arg">draw</span>.scale(<span class=
2282
- "arg">sx</span>, <span class="arg">sy</span>) -&gt;
2283
- <em>self</em></p>
2284
- </div>
2285
-
2286
- <div class="desc">
2287
- <h4>Description</h4>
2288
-
2289
- <p>Define a scale transformation to the coordinate space. The
2290
- default scale is (1.0, 1.0).</p>
2291
-
2292
- <h4>Arguments</h4>
2293
-
2294
- <dl>
2295
- <dt>sx, sy</dt>
2296
-
2297
- <dd>The amount of scaling in the x and y dimensions.</dd>
2298
- </dl>
2299
-
2300
- <h4>Returns</h4>
2301
-
2302
- <p>self</p>
2303
-
2304
- <h4>See also</h4><a href="#affine">affine</a>
2305
- </div>
2306
-
2307
- <div class="sig">
2308
- <h3 id="skewx">skewx</h3>
2309
-
2310
- <p><span class="arg">draw</span>.skewx(<span class=
2311
- "arg">float</span>) -&gt; <em>self</em></p>
2312
- </div>
2313
-
2314
- <div class="desc">
2315
- <h4>Description</h4>
2316
-
2317
- <p>Define a skew transformation along the x-axis.</p>
2318
-
2319
- <h4>Arguments</h4>
2320
-
2321
- <p>The amount of skew, in degrees.</p>
2322
-
2323
- <h4>Returns</h4>
2324
-
2325
- <p>self</p>
2326
-
2327
- <h4>Example</h4>
2328
-
2329
- <p><code>gc.skewx(30)</code></p>
2330
-
2331
- <p><a href="javascript:popup('skewx.rb.html')"><img src=
2332
- "ex/skewx.gif" alt="skewx example" title=
2333
- "Click to see the example script" /></a></p>
2334
-
2335
- <h4>See also</h4><a href="#skewy">skewy</a>, <a href=
2336
- "#affine">affine</a>, <a href="#rotate">rotate</a>
2337
- </div>
2338
-
2339
- <div class="sig">
2340
- <h3 id="skewy">skewy</h3>
2341
-
2342
- <p><span class="arg">draw</span>.skewy(<span class=
2343
- "arg">float</span>) -&gt; <em>self</em></p>
2344
- </div>
2345
-
2346
- <div class="desc">
2347
- <h4>Description</h4>
2348
-
2349
- <p>Define a skew transformation along the y-axis.</p>
2350
-
2351
- <h4>Arguments</h4>
2352
-
2353
- <p>The amount of skew, in degrees.</p>
2354
-
2355
- <h4>Returns</h4>
2356
-
2357
- <p>self</p>
2358
-
2359
- <h4>Example</h4>
2360
-
2361
- <p><code>gc.skewy(30)</code></p>
2362
-
2363
- <p><a href="javascript:popup('skewy.rb.html')"><img src=
2364
- "ex/skewy.gif" alt="skewy example" title=
2365
- "Click to see the example script" /></a></p>
2366
-
2367
- <h4>See also</h4><a href="#affine">affine</a>, <a href=
2368
- "#skewx">skewx</a>, <a href="#rotate">rotate</a>
2369
- </div>
2370
-
2371
- <div class="sig">
2372
- <h3 id="stroke">stroke</h3>
2373
-
2374
- <p><span class="arg">draw</span>.stroke(<span class=
2375
- "arg">string</span>) -&gt; <em>self</em></p>
2376
- </div>
2377
-
2378
- <div class="desc">
2379
- <h4>Description</h4>
2380
-
2381
- <p>Specify the stroke color or pattern.</p>
2382
-
2383
- <h4>Arguments</h4>
2384
-
2385
- <p>A <a href="imusage.html#color_names">color name</a> or
2386
- <a href="#pattern">pattern</a> name.</p>
2387
-
2388
- <h4>Returns</h4>
2389
-
2390
- <p>self</p>
2391
-
2392
- <h4>Aliases</h4><code>stroke_color</code>,
2393
- <code>stroke_pattern</code>
2394
- </div>
2395
-
2396
- <div class="sig">
2397
- <h3 id="stroke_antialias">stroke_antialias</h3>
2398
-
2399
- <p><span class=
2400
- "arg">draw</span>.stroke_antialias(<code>true</code> or
2401
- <code>false</code>) -&gt; <em>self</em></p>
2402
- </div>
2403
-
2404
- <div class="desc">
2405
- <h4>Description</h4>
2406
-
2407
- <p>Specify if the stroke should be antialiased. The default is
2408
- <code>true</code>.</p>
2409
- </div>
2410
-
2411
- <div class="sig">
2412
- <h3 id="stroke_dasharray">stroke_dasharray</h3>
2413
-
2414
- <p><span class="arg">draw</span>.stroke_dasharray(<span class=
2415
- "arg">x1</span>,...,<span class="arg">xn</span>) -&gt;
2416
- <em>self</em></p>
2417
- </div>
2418
-
2419
- <div class="desc">
2420
- <h4>Description</h4>
2421
-
2422
- <p>Describe a pattern of dashes to be used when stroking paths.
2423
- The arguments are a list of pixel widths of alternating dashes
2424
- and gaps.</p>
2425
-
2426
- <h4>Arguments</h4>
2427
-
2428
- <p>The first argument is the width of the first dash. The
2429
- second is the width of the gap following the first dash. The
2430
- third argument is another dash width, followed by another gap
2431
- width, etc. If you specify an odd number of arguments, the
2432
- arguments are repeated to produce an even number. All arguments
2433
- must be &gt; 0.</p>
2434
-
2435
- <p>To produce a solid stroke, specify no arguments, i.e.
2436
- <code>stroke_dasharray()</code></p>
2437
-
2438
- <h4>Returns</h4>
2439
-
2440
- <p>self</p>
2441
-
2442
- <h4>Example</h4>
2443
-
2444
- <p><a href=
2445
- "javascript:popup('stroke_dasharray.rb.html'"><img src=
2446
- "ex/stroke_dasharray.gif" alt="stroke_dasharray example" title=
2447
- "Click to see the example script" /></a></p>
2448
-
2449
- <h4>See also</h4>
2450
-
2451
- <p><a href="#stroke_dashoffset">stroke_dashoffset</a></p>
2452
- </div>
2453
-
2454
- <div class="sig">
2455
- <h3 id="stroke_dashoffset">stroke_dashoffset</h3>
2456
-
2457
- <p><span class="arg">draw</span>.stroke_dashoffset(<span class=
2458
- "arg">integer</span>) -&gt; <em>self</em></p>
2459
- </div>
2460
-
2461
- <div class="desc">
2462
- <h4>Description</h4>
2463
-
2464
- <p>Specify the initial distance into the dash pattern.</p>
2465
-
2466
- <h4>Arguments</h4>
2467
-
2468
- <p>The initial distance into the dash pattern. The units are
2469
- pixels.</p>
2470
-
2471
- <h4>Returns</h4>
2472
-
2473
- <p>self</p>
2474
-
2475
- <h4>Example</h4>See <a href=
2476
- "#stroke_dasharray">stroke_dasharray</a>.
2477
- </div>
2478
-
2479
- <div class="sig">
2480
- <h3 id="stroke_linecap">stroke_linecap</h3>
2481
-
2482
- <p><span class="arg">draw</span>.stroke_linecap(<span class=
2483
- "arg">string</span>) -&gt; <em>self</em></p>
2484
- </div>
2485
-
2486
- <div class="desc">
2487
- <h4>Description</h4>
2488
-
2489
- <p>Specify how the line ends should be drawn.</p>
2490
-
2491
- <h4>Arguments</h4>
2492
-
2493
- <p>One of "butt", "round", or "square".</p>
2494
-
2495
- <h4>Returns</h4>
2496
-
2497
- <p>self</p>
2498
-
2499
- <h4>Example</h4>
2500
-
2501
- <p>The following example is from the <a href=
2502
- "http://www.w3.org/TR/SVG/painting.html#StrokeProperties">Stroke
2503
- Properties</a> section of the <cite>Scalable Vector Graphics
2504
- (SVG) 1.1 Specification</cite>.</p>
2505
-
2506
- <p><a href=
2507
- "javascript:popup('stroke_linecap.rb.html')"><img src=
2508
- "ex/stroke_linecap.gif" alt="stroke_linecap example" title=
2509
- "Click to see the example script" /></a></p>
2510
- </div>
2511
-
2512
- <div class="sig">
2513
- <h3 id="stroke_linejoin">stroke_linejoin</h3>
2514
-
2515
- <p><span class="arg">draw</span>.stroke_linejoin(<span class=
2516
- "arg">string</span>) -&gt; <em>self</em></p>
2517
- </div>
2518
-
2519
- <div class="desc">
2520
- <h4>Description</h4>
2521
-
2522
- <p>Specify how corners are drawn.</p>
2523
-
2524
- <h4>Arguments</h4>
2525
-
2526
- <p>One of "miter", "round", or "bevel".</p>
2527
-
2528
- <h4>Returns</h4>
2529
-
2530
- <p>self</p>
2531
-
2532
- <h4>Example</h4>
2533
-
2534
- <p>The following example is from the <a href=
2535
- "http://www.w3.org/TR/SVG/painting.html#StrokeProperties">Stroke
2536
- Properties</a> section of the <cite>Scalable Vector Graphics
2537
- (SVG) 1.0 Specification</cite>.</p>
2538
-
2539
- <p><a href=
2540
- "javascript:popup('stroke_linejoin.rb.html')"><img src=
2541
- "ex/stroke_linejoin.gif" alt="stroke_linejoin example" title=
2542
- "Click to see the example script" /></a></p>
2543
-
2544
- <h4>See also</h4><a href=
2545
- "#stroke_miterlimit">stroke_miterlimit</a>
2546
- </div>
2547
-
2548
- <div class="sig">
2549
- <h3 id="stroke_miterlimit">stroke_miterlimit</h3>
2550
-
2551
- <p><span class="arg">draw</span>.stroke_miterlimit(<span class=
2552
- "arg">float</span>) -&gt; <em>self</em></p>
2553
- </div>
2554
-
2555
- <div class="desc">
2556
- <h4>Description</h4>
2557
-
2558
- <p>Specify a constraint on the length of the "miter" formed by
2559
- two lines meeting at an angle. If the angle if very sharp, the
2560
- miter could be very long relative to the line thickness. The
2561
- miter limit is a limit on the ratio of the miter length to the
2562
- line width.</p>
2563
-
2564
- <h4>Arguments</h4>
2565
-
2566
- <p>A number &gt;= 1. The limit on the ratio of the miter length
2567
- to the line width.</p>
2568
-
2569
- <h4>Returns</h4>
2570
-
2571
- <p>self</p>
2572
- </div>
2573
-
2574
- <div class="sig">
2575
- <h3 id="stroke_opacity">stroke_opacity</h3>
2576
-
2577
- <p><span class="arg">draw</span>.stroke_opacity(<span class=
2578
- "arg">float</span> or <span class="arg">string</span>) -&gt;
2579
- <em>self</em></p>
2580
- </div>
2581
-
2582
- <div class="desc">
2583
- <h4>Description</h4>
2584
-
2585
- <p>Specify the stroke opacity.</p>
2586
-
2587
- <h4>Arguments</h4>
2588
-
2589
- <p>A number between 0 and 1, inclusive, or a percentage
2590
- represented as a string, i.e. '30%'. The argument 0.3 is the
2591
- same as '30%'.</p>
2592
-
2593
- <h4>Returns</h4>
2594
-
2595
- <p>self</p>
2596
-
2597
- <h4>Example</h4>
2598
- <pre>
2599
- draw.stroke_opacity(0.4)
2600
- draw.stroke_opacity('40%')
2601
- </pre>
2602
-
2603
- <h4>See also</h4><a href="#fill_opacity">fill_opacity</a>,
2604
- <a href="#opacity">opacity</a>
2605
- </div>
2606
-
2607
- <div class="sig">
2608
- <h3 id="stroke_width">stroke_width</h3>
2609
-
2610
- <p><span class="arg">draw</span>.stroke_width(<span class=
2611
- "arg">integer</span>) -&gt; <em>self</em></p>
2612
- </div>
2613
-
2614
- <div class="desc">
2615
- <h4>Description</h4>
2616
-
2617
- <p>Specify the stroke width in pixels. The default is 1.</p>
2618
-
2619
- <h4>Returns</h4>
2620
-
2621
- <p>self</p>
2622
-
2623
- <h4>Example</h4>
2624
-
2625
- <p><a href="javascript:popup('stroke_width.rb.html')"><img src=
2626
- "ex/stroke_width.gif" alt="stroke_width example" title=
2627
- "Click to see the example script" /></a></p>
2628
- </div>
2629
-
2630
- <div class="sig">
2631
- <h3 id="text">text</h3>
2632
-
2633
- <p><span class="arg">draw</span>.text(<span class=
2634
- "arg">x</span>,<span class="arg">y</span>, <span class=
2635
- "arg">text</span>) -&gt; <em>self</em></p>
2636
- </div>
2637
-
2638
- <div class="desc">
2639
- <h4>Description</h4>
2640
-
2641
- <p>Draw text at the location specified by (<span class=
2642
- "arg">x</span>,<span class="arg">y</span>). Use <a href=
2643
- "#gravity">gravity</a> to position <span class=
2644
- "arg">text</span> relative to (<span class="arg">x</span>,
2645
- <span class="arg">y</span>). Specify the font appearance with
2646
- the <a href="#font">font</a>, <a href=
2647
- "#font_family">font_family</a>, <a href=
2648
- "#font_stretch">font_stretch</a>, <a href=
2649
- "#font_style">font_style</a>, and <a href=
2650
- "#font_weight">font_weight</a> methods. Specify the text
2651
- attributes with the <a href="#text_align">text_align</a>,
2652
- <a href="#text_anchor">text_anchor</a>, <a href=
2653
- "text_antialias">text_antialias</a>, and <a href=
2654
- "text_undercolor">text_undercolor</a> methods.</p>
2655
-
2656
- <p>Generally it is a good idea to surround the text string with
2657
- quotes (""), apostrophes (''), or braces ({}). If the text
2658
- string starts with a digit or contains an embedded blank,
2659
- quote, or apostrophe, you must do this. ImageMagick removes
2660
- these characters before drawing the text. You can also escape a
2661
- blank, quote, or apostrophe by preceding it with a backslash
2662
- ("\"). To include a backslash in the text, use two consecutive
2663
- backslashes. To include a '%' in the text, use '%%'. See the
2664
- examples below.</p>
2665
-
2666
- <h4>Arguments</h4>
2667
-
2668
- <dl>
2669
- <dt>x, y</dt>
2670
-
2671
- <dd>The text position, influenced by <a href=
2672
- "#gravity">gravity</a>.</dd>
2673
-
2674
- <dt>text</dt>
2675
-
2676
- <dd>The text.</dd>
2677
- </dl>
2678
-
2679
- <h4>Returns</h4>
2680
-
2681
- <p>self</p>
2682
-
2683
- <h4>Quoting examples</h4>
2684
-
2685
- <p>The text to the right of &raquo; is the text that will be
2686
- drawn.</p>
2687
- <pre>
2688
- gc.text(10,10, '"Hello there!"') &raquo; Hello there!
2689
- gc.text(10,10, "'What\'s up?'") &raquo; What's up?
2690
- gc.text(10,10, %q/"What's up?"/) &raquo; What's up?
2691
- gc.text(10,10, %q/{"What's up?"}/) &raquo; "What's up?"
2692
- </pre>
2693
-
2694
- <h4>Example</h4>
2695
-
2696
- <p><a href="javascript:popup('text.rb.html')"><img src=
2697
- "ex/text.gif" alt="text example" title=
2698
- "Click to see the example script" /></a></p>
2699
-
2700
- <h4>See also</h4><a href="#annotate">annotate</a>
2701
- </div>
2702
-
2703
- <div class="sig">
2704
- <h3 id="text_align">text_align</h3>
2705
-
2706
- <p><span class="arg">draw</span>.text_align(<span class=
2707
- "arg">alignment</span>) -&gt; <em>self</em></p>
2708
- </div>
2709
-
2710
- <div class="desc">
2711
- <h4>Description</h4>
2712
-
2713
- <p>Align text relative to the starting point.</p>
2714
-
2715
- <h4>Arguments</h4>
2716
-
2717
- <p>An <a href="constants.html#AlignType">AlignType</a>
2718
- constant.</p>
2719
-
2720
- <h4>Returns</h4>
2721
-
2722
- <p>self</p>
2723
-
2724
- <h4>Example</h4>
2725
-
2726
- <p><a href="javascript:popup('text_align.rb.html')"><img src=
2727
- "ex/text_align.gif" alt="text_align example" title=
2728
- "Click to see the example script" /></a></p>
2729
- </div>
2730
-
2731
- <div class="sig">
2732
- <h3 id="text_anchor">text_anchor</h3>
2733
-
2734
- <p><span class="arg">draw</span>.text_anchor(<span class=
2735
- "arg">anchor</span>) -&gt; <em>self</em></p>
2736
- </div>
2737
-
2738
- <div class="desc">
2739
- <h4>Description</h4>
2740
-
2741
- <p>Align text relative to the starting point. This is the SVG
2742
- 1.1 equivalent to <a href="#text_align">text_align</a>.</p>
2743
-
2744
- <h4>Arguments</h4>
2745
-
2746
- <p>One of the constants <code>StartAnchor</code>,
2747
- <code>MiddleAnchor</code>, or <code>EndAnchor</code>.</p>
2748
-
2749
- <h4>Returns</h4>
2750
-
2751
- <p>self</p>
2752
- </div>
2753
-
2754
- <div class="sig">
2755
- <h3 id="text_antialias">text_antialias</h3>
2756
-
2757
- <p><span class=
2758
- "arg">draw</span>.text_antialias(<code>true</code> or
2759
- <code>false</code>) -&gt; <em>self</em></p>
2760
- </div>
2761
-
2762
- <div class="desc">
2763
- <h4>Description</h4>
2764
-
2765
- <p>Specify if the text is to be antialiased.</p>
2766
-
2767
- <h4>Arguments</h4>
2768
-
2769
- <p>Either <code>true</code> or <code>false</code>. The default
2770
- is <code>true</code>.</p>
2771
-
2772
- <h4>Returns</h4>
2773
-
2774
- <p>self</p>
2775
-
2776
- <h4>Example</h4>
2777
-
2778
- <p>The character on the left is not antialiased. The character
2779
- on the right is antialiased.</p><a href=
2780
- "javascript:popup('text_antialias.rb.html')"><img src=
2781
- "ex/text_antialias.gif" alt="text_antialias example" title=
2782
- "Click to see the example script" /></a>
2783
-
2784
- <h4>See also</h4><a href=
2785
- "#stroke_antialias">stroke_antialias</a>
2786
- </div>
2787
-
2788
- <div class="sig">
2789
- <h3 id="text_undercolor">text_undercolor</h3>
2790
-
2791
- <p><span class="arg">draw</span>.text_undercolor(<span class=
2792
- "arg">string</span>) -&gt; <em>self</em></p>
2793
- </div>
2794
-
2795
- <div class="desc">
2796
- <h4>Description</h4>
2797
-
2798
- <p>The color to draw underneath text. The default is
2799
- transparent.</p>
2800
-
2801
- <h4>Arguments</h4>
2802
-
2803
- <p>A color name.</p>
2804
-
2805
- <h4>Returns</h4>
2806
-
2807
- <p>self</p>
2808
-
2809
- <h4>Example</h4>
2810
-
2811
- <p><a href=
2812
- "javascript:popup('text_undercolor.rb.html')"><img src=
2813
- "ex/text_undercolor.gif" alt="text_undercolor example" title=
2814
- "Click to see the example script" /></a></p>
2815
- </div>
2816
-
2817
- <div class="sig">
2818
- <h3 id="translate">translate</h3>
2819
-
2820
- <p><span class="arg">draw</span>.translate(<span class=
2821
- "arg">tx</span>, <span class="arg">ty</span>) -&gt;
2822
- <em>self</em></p>
2823
- </div>
2824
-
2825
- <div class="desc">
2826
- <h4>Description</h4>
2827
-
2828
- <p>Specify a translation operation on the coordinate space.</p>
2829
-
2830
- <h4>Arguments</h4>
2831
-
2832
- <dl>
2833
- <dt>tx, ty</dt>
2834
-
2835
- <dd>The amount of translation in the x and y directions.</dd>
2836
- </dl>
2837
-
2838
- <h4>Returns</h4>
2839
-
2840
- <p>self</p>
2841
-
2842
- <h4>Example</h4>
2843
-
2844
- <p><code>gc.translate(125, 125)</code></p>
2845
-
2846
- <p><a href="javascript:popup('translate.rb.html')"><img src=
2847
- "ex/translate.gif" alt="translate example" title=
2848
- "Click to see the example script" /></a></p>
2849
-
2850
- <h4>See also</h4>
2851
-
2852
- <p><a href="#affine">affine</a></p>
2853
- </div>
2854
-
2855
- <h2 class="methods" id="attributes">annotate attributes</h2>
2856
-
2857
- <div class="sig">
2858
- <h3 id="affine_eq">affine=</h3>
2859
-
2860
- <p><span class="arg">draw</span>.affine = <em>matrix</em></p>
2861
- </div>
2862
-
2863
- <div class="desc">
2864
- <h4>Description</h4>
2865
-
2866
- <p>The transformation matrix. The default is the null
2867
- transformation.</p>
2868
-
2869
- <h4>Argument</h4>
2870
-
2871
- <p>An <a href="struct.html#AffineMatrix">AffineMatrix</a>.</p>
2872
- </div>
2873
-
2874
- <div class="sig">
2875
- <h3 id="align_eq">align=</h3>
2876
-
2877
- <p><span class="arg">draw</span>.align = <em>alignment</em></p>
2878
- </div>
2879
-
2880
- <div class="desc">
2881
- <h4>Description</h4>
2882
-
2883
- <p>The text alignment. The default is
2884
- <code>LeftAlign</code>.</p>
2885
-
2886
- <h4>Argument</h4>
2887
-
2888
- <p>A <a href="constants.html#AlignType">AlignType</a>
2889
- constant.</p>
2890
- </div>
2891
-
2892
- <div class="sig">
2893
- <h3 id="decorate_eq">decorate=</h3>
2894
-
2895
- <p><span class="arg">draw</span>.decorate =
2896
- <em>decoration</em></p>
2897
- </div>
2898
-
2899
- <div class="desc">
2900
- <h4>Description</h4>
2901
-
2902
- <p>The text decoration. The default is
2903
- <code>NoDecorationType</code>.</p>
2904
-
2905
- <h4>Argument</h4>
2906
-
2907
- <p>A <a href="constants.html#DecorationType">DecorationType</a>
2908
- constant.</p>
2909
- </div>
2910
-
2911
- <div class="sig">
2912
- <h3 id="density_eq">density=</h3>
2913
-
2914
- <p><span class="arg">draw</span>.density = <em>string</em></p>
2915
- </div>
2916
-
2917
- <div class="desc">
2918
- <h4>Description</h4>
2919
-
2920
- <p>The text density in the x and y directions. The default is
2921
- "72x72".</p>
2922
- </div>
2923
-
2924
- <div class="sig">
2925
- <h3 id="encoding_eq">encoding=</h3>
2926
-
2927
- <p><span class="arg">draw</span>.encoding = <em>string</em></p>
2928
- </div>
2929
-
2930
- <div class="desc">
2931
- <h4>Description</h4>
2932
-
2933
- <p>The text encoding.</p>
2934
-
2935
- <h4>Argument</h4>
2936
-
2937
- <p>See the ImageMagick documentation for the
2938
- <code>-encoding</code> option to the <code>mogrify</code>
2939
- command.</p>
2940
- </div>
2941
-
2942
- <div class="sig">
2943
- <h3 id="fill_eq">fill=</h3>
2944
-
2945
- <p><span class="arg">draw</span>.fill = <em>string</em> or
2946
- <em>pixel</em></p>
2947
- </div>
2948
-
2949
- <div class="desc">
2950
- <h4>Description</h4>The fill color. The default is "black".
2951
-
2952
- <h4>Argument</h4>
2953
-
2954
- <p>May be a <a href="imusage.html#color_names">color name</a>
2955
- or a <a href="struct.html#Pixel">Pixel</a> object.</p>
2956
- </div>
2957
-
2958
- <div class="sig">
2959
- <h3 id="fill_pattern_eq">fill_pattern=</h3>
2960
-
2961
- <p><span class="arg">draw</span>.fill_pattern =
2962
- <em>image</em></p>
2963
- </div>
2964
-
2965
- <div class="desc">
2966
- <h4>Description</h4>Specify an image to use for the fill.
2967
-
2968
- <h4>Argument</h4>
2969
-
2970
- <p>An image.</p>
2971
-
2972
- <h4>Example</h4>
2973
-
2974
- <p><a href="javascript:popup('fill_pattern.rb.html')" title=
2975
- "Click to see the example script"><img src=
2976
- "ex/fill_pattern.gif" alt=
2977
- "fill_pattern and stroke_pattern example" /></a></p>
2978
- </div>
2979
-
2980
- <div class="sig">
2981
- <h3 id="font_eq">font=</h3>
2982
-
2983
- <p><span class="arg">draw</span>.font = <em>string</em></p>
2984
- </div>
2985
-
2986
- <div class="desc">
2987
- <h4>Description</h4>
2988
-
2989
- <p>The font name. The default is "Helvetica". See <a href=
2990
- "#font">font</a> for more information about font names.</p>
2991
- </div>
2992
-
2993
- <div class="sig">
2994
- <h3 id="font_family_eq">font_family=</h3>
2995
-
2996
- <p><span class="arg">draw</span>.font_family =
2997
- <em>string</em></p>
2998
- </div>
2999
-
3000
- <div class="desc">
3001
- <h4>Description</h4>
3002
-
3003
- <p>The font family name. For example, "arial" or
3004
- "helvetica".</p>
3005
- </div>
3006
-
3007
- <div class="sig">
3008
- <h3 id="font_stretch_eq">font_stretch=</h3>
3009
-
3010
- <p><span class="arg">draw</span>.font_stretch =
3011
- <em>stretch</em></p>
3012
- </div>
3013
-
3014
- <div class="desc">
3015
- <h4>Description</h4>
3016
-
3017
- <p>The font stretch.</p>
3018
-
3019
- <h4>Argument</h4>A <a href=
3020
- "constants.html#StretchType">StretchType</a> constant.
3021
- </div>
3022
-
3023
- <div class="sig">
3024
- <h3 id="font_style_eq">font_style=</h3>
3025
-
3026
- <p><span class="arg">draw</span>.font_style =
3027
- <em>style</em></p>
3028
- </div>
3029
-
3030
- <div class="desc">
3031
- <h4>Description</h4>
3032
-
3033
- <p>The font style.</p>
3034
-
3035
- <h4>Argument</h4>
3036
-
3037
- <p>A <a href="constants.html#StyleType">StyleType</a>
3038
- constant.</p>
3039
- </div>
3040
-
3041
- <div class="sig">
3042
- <h3 id="font_weight_eq">font_weight=</h3>
3043
-
3044
- <p><span class="arg">draw</span>.font_weight =
3045
- <em>weight</em></p>
3046
- </div>
3047
-
3048
- <div class="desc">
3049
- <h4>Description</h4>
3050
-
3051
- <p>The font weight.</p>
3052
-
3053
- <h4>Arguments</h4>
3054
-
3055
- <p>A <a href="constants.html#WeightType">WeightType</a>
3056
- constant or one of the numbers 100, 200, 300, 400, 500, 600,
3057
- 700, 800, or 900.</p>
3058
- </div>
3059
-
3060
- <div class="sig">
3061
- <h3 id="gravity_eq">gravity=</h3>
3062
-
3063
- <p><span class="arg">draw</span>.gravity = <em>gravity</em></p>
3064
- </div>
3065
-
3066
- <div class="desc">
3067
- <h4>Description</h4>
3068
-
3069
- <p>Specifies how to orient text with respect to the text's
3070
- origin.</p>
3071
-
3072
- <h4>Arguments</h4>
3073
-
3074
- <p>A <a href="constants.html#GravityType">GravityType</a>
3075
- constant.</p>
3076
- </div>
3077
-
3078
- <div class="sig">
3079
- <h3 id="interline_spacing_eq">interline_spacing=</h3>
3080
-
3081
- <p><span class="arg">draw</span>.interline_spacing =
3082
- <em>space</em></p>
3083
- </div>
3084
-
3085
- <div class="desc">
3086
- <h4>Description</h4>
3087
-
3088
- <p>Modifies the space between lines.</p>
3089
-
3090
- <h4>Arguments</h4>
3091
-
3092
- <p>A numeric value. May be positive or negative.</p>
3093
-
3094
- <h4>Notes</h4>
3095
-
3096
- <p>Available in ImageMagick 6.5.5-8.</p>
3097
- </div>
3098
-
3099
- <div class="sig">
3100
- <h3 id="interword_spacing_eq">interword_spacing=</h3>
3101
-
3102
- <p><span class="arg">draw</span>.interword_spacing =
3103
- <em>space</em></p>
3104
- </div>
3105
-
3106
- <div class="desc">
3107
- <h4>Description</h4>
3108
-
3109
- <p>Modifies the space between two words.</p>
3110
-
3111
- <h4>Arguments</h4>
3112
-
3113
- <p>A numeric value. May be positive or negative.</p>
3114
-
3115
- <h4>Notes</h4>
3116
-
3117
- <p>Available in ImageMagick 6.4.8-0.</p>
3118
- </div>
3119
-
3120
- <div class="sig">
3121
- <h3 id="kerning_eq">kerning=</h3>
3122
-
3123
- <p><span class="arg">draw</span>.kerning = <em>space</em></p>
3124
- </div>
3125
-
3126
- <div class="desc">
3127
- <h4>Description</h4>
3128
-
3129
- <p>Modifies the space between two letters.</p>
3130
-
3131
- <h4>Arguments</h4>
3132
-
3133
- <p>A numeric value. May be positive or negative.</p>
3134
-
3135
- <h4>Notes</h4>
3136
-
3137
- <p>Available in ImageMagick 6.4.7-8.</p>
3138
- </div>
3139
-
3140
- <div class="sig">
3141
- <h3 id="pointsize_eq">pointsize=</h3>
3142
-
3143
- <p><span class="arg">draw</span>.pointsize =
3144
- <em>integer</em></p>
3145
- </div>
3146
-
3147
- <div class="desc">
3148
- <h4>Description</h4>
3149
-
3150
- <p>The font size in points. The default is 12.</p>
3151
- </div>
3152
-
3153
- <div class="sig">
3154
- <h3 id="rotation_eq">rotation=</h3>
3155
-
3156
- <p><span class="arg">draw</span>.rotation = <em>number</em></p>
3157
- </div>
3158
-
3159
- <div class="desc">
3160
- <h4>Description</h4>
3161
-
3162
- <p>Apply rotation to text. The default is no rotation.</p>
3163
-
3164
- <h4>Arguments</h4>
3165
-
3166
- <p>The amount of rotation in degrees.</p>
3167
- </div>
3168
-
3169
- <div class="sig">
3170
- <h3 id="stroke_eq">stroke=</h3>
3171
-
3172
- <p><span class="arg">draw</span>.stroke = <em>string</em> or
3173
- <em>pixel</em></p>
3174
- </div>
3175
-
3176
- <div class="desc">
3177
- <h4>Description</h4>
3178
-
3179
- <p>The stroke color. This is the color used to outline the
3180
- text. The default is "black".</p>
3181
-
3182
- <h4>Arguments</h4>A <a href="imusage.html#color_names">color
3183
- name</a> or <a href="struct.html#Pixel">Pixel</a> object.
3184
- </div>
3185
-
3186
- <div class="sig">
3187
- <h3 id="stroke_pattern_eq">stroke_pattern=</h3>
3188
-
3189
- <p><span class="arg">draw</span>.stroke_pattern =
3190
- <em>image</em></p>
3191
- </div>
3192
-
3193
- <div class="desc">
3194
- <h4>Description</h4>Specify an image to use for the stroke.
3195
-
3196
- <h4>Argument</h4>
3197
-
3198
- <p>An image.</p>
3199
-
3200
- <h4>Example</h4>
3201
-
3202
- <p>See <a href="#fill_pattern_eq">fill_pattern</a></p>
3203
- </div>
3204
-
3205
- <div class="sig">
3206
- <h3 id="stroke_width_eq">stroke_width=</h3>
3207
-
3208
- <p><span class="arg">draw</span>.stroke = <em>integer</em></p>
3209
- </div>
3210
-
3211
- <div class="desc">
3212
- <h4>Description</h4>
3213
-
3214
- <p>The stroke width in pixels. The default is 1.</p>
3215
- </div>
3216
-
3217
- <div class="sig">
3218
- <h3 id="text_antialias_eq">text_antialias=</h3>
3219
-
3220
- <p><span class="arg">draw</span>.text_antialias =
3221
- <em><code>true</code> or <code>false</code></em></p>
3222
- </div>
3223
-
3224
- <div class="desc">
3225
- <h4>Description</h4>
3226
-
3227
- <p>Whether the text is antialiased or not. The default is
3228
- <code>true</code>.</p>
3229
- </div>
3230
-
3231
- <div class="sig">
3232
- <h3 id="tile_eq">tile=</h3>
3233
-
3234
- <p><span class="arg">draw</span>.tile = <em>image</em></p>
3235
- </div>
3236
-
3237
- <div class="desc">
3238
- <h4>Description</h4>
3239
-
3240
- <p>Tile image when filling a graphic primitive.</p>
3241
-
3242
- <h4>Arguments</h4>
3243
-
3244
- <p>An image</p>
3245
- </div>
3246
-
3247
- <div class="sig">
3248
- <h3 id="undercolor_eq">undercolor=</h3>
3249
-
3250
- <p><span class="arg">draw</span>.undercolor = <em>string</em>
3251
- or <em>pixel</em></p>
3252
- </div>
3253
-
3254
- <div class="desc">
3255
- <h4>Description</h4>
3256
-
3257
- <p>If set, causes the text to be drawn over a box of the
3258
- specified color.</p>
3259
-
3260
- <h4>Arguments</h4>A <a href="imusage.html#color_names">color
3261
- name</a> or a <a href="struct.html#Pixel">Pixel</a> object.
3262
- </div>
3263
-
3264
- <p class="spacer">&nbsp;</p>
3265
-
3266
- <div class="nav">
3267
- &laquo;&nbsp;<a href="image3.html">Prev</a> | <a href=
3268
- "index.html">Contents</a> | <a href=
3269
- "struct.html">Next</a>&nbsp;&raquo;
3270
- </div>
3271
- </body>
3272
- </html>