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.
 
 
 
 
 
 

106 wiersze
3.4 KiB

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