Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

ruby-cucul.dox 3.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* $Id$ */ /** \page libcucul-ruby-api Libcucul Ruby API
  2. The classes available for libcucul are :
  3. \li \b Cucul::Canvas : functions that have a cucul_canvas_t* as first argument
  4. \li \b Cucul::Dither : functions that have a cucul_dither_t* as first argument
  5. \li \b Cucul::Font : functions that have a cucul_font_t* as first argument
  6. (The constructor can currently only accept the name of a builtin font)
  7. The character set conversion functions are not available yet in the binding.
  8. \code
  9. $ irb -rcucul
  10. irb(main):001:0> Cucul.constants
  11. => ["BROWN", "BOLD", "GREEN", "LIGHTMAGENTA", "LIGHTBLUE", "BLINK",
  12. "MAGENTA", "DEFAULT", "TRANSPARENT", "BLUE", "LIGHTRED", "DARKGRAY",
  13. "UNDERLINE", "RED", "WHITE", "BLACK", "LIGHTCYAN", "LIGHTGRAY",
  14. "ITALICS", "CYAN", "YELLOW", "LIGHTGREEN", "Canvas", "Dither", "Font"]
  15. \endcode
  16. \code
  17. irb(main):002:0> Cucul::Canvas.methods.sort -
  18. Cucul::Canvas.ancestors[1].methods
  19. => ["export_list", "import_list"]
  20. \endcode
  21. \code
  22. irb(main):003:0> Cucul::Canvas.instance_methods.sort -
  23. Cucul::Canvas.ancestors[1].instance_methods
  24. => ["attr=", "blit", "clear", "create_frame", "cursor_x", "cursor_y",
  25. "dither_bitmap", "draw_box", "draw_circle", "draw_cp437_box", "draw_ellipse",
  26. "draw_line", "draw_polyline", "draw_thin_box", "draw_thin_ellipse",
  27. "draw_thin_line", "draw_thin_polyline", "draw_thin_triangle",
  28. "draw_triangle", "export_memory", "fill_box", "fill_ellipse",
  29. "fill_triangle", "flip", "flop", "frame=", "frame_count", "frame_name",
  30. "frame_name=", "free_frame", "get_attr", "get_char", "gotoxy",
  31. "handle_x", "handle_y", "height", "height=", "import_file",
  32. "import_memory", "invert", "printf", "put_attr", "put_char", "put_str",
  33. "rotate_180", "rotate_left", "rotate_right", "set_attr",
  34. "set_boundaries", "set_color_ansi", "set_color_argb", "set_frame",
  35. "set_frame_name", "set_handle", "set_height", "set_size", "set_width",
  36. "stretch_left", "stretch_right", "width", "width="]
  37. \endcode
  38. \code
  39. irb(main):004:0> Cucul::Font.methods.sort -
  40. Cucul::Font.ancestors[1].methods
  41. => ["list"]
  42. \endcode
  43. \code
  44. irb(main):005:0> Cucul::Font.instance_methods.sort -
  45. Cucul::Font.ancestors[1].instance_methods
  46. => ["blocks", "height", "width"]
  47. \endcode
  48. \code
  49. irb(main):006:0> Cucul::Dither.instance_methods.sort -
  50. Cucul::Dither.ancestors[1].instance_methods
  51. => ["algorithm=", "algorithm_list", "antialias=", "antialias_list",
  52. "brightness=", "charset=", "charset_list", "color=", "color_list",
  53. "contrast=", "gamma=", "palette=", "set_algorithm", "set_antialias",
  54. "set_brightness", "set_charset", "set_color", "set_contrast",
  55. "set_gamma", "set_palette"]
  56. \endcode
  57. \section Samples
  58. \code
  59. $ ruby -rcucul -e 'c=Cucul::Canvas.new(6, 3).fill_box(0,0,2,2,"#"[0]);
  60. c2=Cucul::Canvas.new(1, 1).put_str(0,0,"x"); c.blit(1,1,c2); puts
  61. c.export_memory("irc")'
  62. ###
  63. #x#
  64. ###
  65. \endcode
  66. \code
  67. $ ruby -e 'puts Cucul::Canvas.new(6,3).draw_thin_polyline([[0,0], [0,2],
  68. [5,2],[0,0]]).export_memory("irc")'
  69. -.
  70. | `.
  71. ----`-
  72. \endcode
  73. \code
  74. $ ruby -rcucul -e 'p Cucul::Canvas.export_list'
  75. [["caca", "native libcaca format"], ["ansi", "ANSI"], ["utf8", "UTF-8
  76. with ANSI escape codes"], ["utf8cr", "UTF-8 with ANSI escape codes and
  77. MS-DOS \\r"], ["html", "HTML"], ["html3", "backwards-compatible HTML"],
  78. ["irc", "IRC with mIRC colours"], ["ps", "PostScript document"], ["svg",
  79. "SVG vector image"], ["tga", "TGA image"]]
  80. \endcode
  81. \code
  82. $ ruby -rcucul -e 'p Cucul::Font.list'
  83. ["Monospace 9", "Monospace Bold 12"]
  84. \endcode
  85. */