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