You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README 3.7 KiB

17 years ago
17 years ago
17 years ago
17 years ago
17 years ago
17 years ago
17 years ago
17 years ago
17 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* $Id$ */ /** \page libcaca-ruby Libcaca ruby bindings
  2. This a Ruby binding for libcucul, libcaca will be added later.
  3. There is no real documentation but "methods" on any object should help you :)
  4. The objects available are :
  5. - Cucul::Canvas (functions that have a cucul_canvas_t* as first argument)
  6. - Cucul::Dither (functions that have a cucul_dither_t* as first argument)
  7. - Cucul::Font (functions that have a cucul_font_t* as first argument)
  8. * The constructor can currently only accept the name of a builtin font
  9. The character set conversion functions are not available yet in the binding.
  10. I tried to follow Ruby spirit meaning that :
  11. - most of the methods return self
  12. - the methods set_foo with only an argument are also available as foo=
  13. (returning the value instead of self)
  14. - the methods originally named get_foo are available only as foo
  15. What is currently available is :
  16. \code
  17. $ irb -rcucul
  18. irb(main):001: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):002:0> Cucul::Canvas.methods.sort -
  26. Cucul::Canvas.ancestors[1].methods
  27. => ["export_list", "import_list"]
  28. \endcode
  29. \code
  30. irb(main):003:0> Cucul::Canvas.instance_methods.sort -
  31. Cucul::Canvas.ancestors[1].instance_methods
  32. => ["attr=", "blit", "clear", "create_frame", "cursor_x", "cursor_y",
  33. "draw_box", "draw_circle", "draw_cp437_box", "draw_ellipse",
  34. "draw_line", "draw_polyline", "draw_thin_box", "draw_thin_ellipse",
  35. "draw_thin_line", "draw_thin_polyline", "draw_thin_triangle",
  36. "draw_triangle", "export_memory", "fill_box", "fill_ellipse",
  37. "fill_triangle", "flip", "flop", "frame=", "frame_count", "frame_name",
  38. "frame_name=", "free_frame", "get_attr", "get_char", "gotoxy",
  39. "handle_x", "handle_y", "height", "height=", "import_file",
  40. "import_memory", "invert", "printf", "put_attr", "put_char", "put_str",
  41. "rotate_180", "rotate_left", "rotate_right", "set_attr",
  42. "set_boundaries", "set_color_ansi", "set_color_argb", "set_frame",
  43. "set_frame_name", "set_handle", "set_height", "set_size", "set_width",
  44. "stretch_left", "stretch_right", "width", "width="]
  45. \endcode
  46. \code
  47. irb(main):004:0> Cucul::Font.methods.sort -
  48. Cucul::Font.ancestors[1].methods
  49. => ["list"]
  50. \endcode
  51. \code
  52. irb(main):005:0> Cucul::Font.instance_methods.sort -
  53. Cucul::Font.ancestors[1].instance_methods
  54. => ["blocks", "height", "width"]
  55. \endcode
  56. \code
  57. irb(main):006:0> Cucul::Dither.instance_methods.sort -
  58. Cucul::Dither.ancestors[1].instance_methods
  59. => ["algorithm=", "algorithm_list", "antialias=", "antialias_list",
  60. "brightness=", "charset=", "charset_list", "color=", "color_list",
  61. "contrast=", "gamma=", "palette=", "set_algorithm", "set_antialias",
  62. "set_brightness", "set_charset", "set_color", "set_contrast",
  63. "set_gamma", "set_palette"]
  64. \endcode
  65. And here are sample uses :
  66. \code
  67. $ ruby -rcucul -e 'c=Cucul::Canvas.new(6, 3).fill_box(0,0,2,2,"#"[0]);
  68. c2=Cucul::Canvas.new(1, 1).put_str(0,0,"x"); c.blit(1,1,c2); puts
  69. c.export_memory("irc")'
  70. ###
  71. #x#
  72. ###
  73. \endcode
  74. \code
  75. $ ruby -e 'puts Cucul::Canvas.new(6,3).draw_thin_polyline([[0,0], [2,0],
  76. [5,2],[0,0]]).export_memory("irc")'
  77. -.
  78. | `.
  79. ----`-
  80. \endcode
  81. \code
  82. $ ruby -rcucul -e 'p Cucul::Canvas.export_list'
  83. [["caca", "native libcaca format"], ["ansi", "ANSI"], ["utf8", "UTF-8
  84. with ANSI escape codes"], ["utf8cr", "UTF-8 with ANSI escape codes and
  85. MS-DOS \\r"], ["html", "HTML"], ["html3", "backwards-compatible HTML"],
  86. ["irc", "IRC with mIRC colours"], ["ps", "PostScript document"], ["svg",
  87. "SVG vector image"], ["tga", "TGA image"]]
  88. \endcode
  89. \code
  90. $ ruby -rcucul -e 'p Cucul::Font.list'
  91. ["Monospace 9", "Monospace Bold 12"]
  92. \endcode
  93. */