source: libcaca/trunk/ruby/ruby-cucul.dox @ 2033

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