25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ruby-cucul.dox 3.5 KiB

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