1 | /* $Id$ */ /** \page libcaca-ruby Libcaca ruby bindings |
---|
2 | |
---|
3 | This a Ruby binding for libcucul, libcaca will be added later. |
---|
4 | |
---|
5 | There is no real documentation but "methods" on any object should help you :) |
---|
6 | |
---|
7 | The objects available for now are : |
---|
8 | |
---|
9 | - Cucul::Canvas (functions that have a cucul_canvas_t* as first argument) |
---|
10 | * dither_bitmap is missing as Cucul::Dither is not yet implemented |
---|
11 | |
---|
12 | - Cucul::Font (functions that have a cucul_font_t* as first argument) |
---|
13 | * The constructor can currently only accept the name of a builtin font |
---|
14 | |
---|
15 | I tried to follow Ruby spirit meaning that : |
---|
16 | - most of the methods return self |
---|
17 | - the methods set_foo with only an argument are also available as foo= |
---|
18 | (returning the value instead of self) |
---|
19 | - the methods originally named get_foo are available only as foo |
---|
20 | |
---|
21 | What is currently available is : |
---|
22 | |
---|
23 | \code |
---|
24 | $ irb -rcucul |
---|
25 | irb(main):001:0> Cucul.constants |
---|
26 | => ["BROWN", "BOLD", "GREEN", "LIGHTMAGENTA", "LIGHTBLUE", "BLINK", |
---|
27 | "MAGENTA", "DEFAULT", "TRANSPARENT", "BLUE", "LIGHTRED", "DARKGRAY", |
---|
28 | "UNDERLINE", "RED", "WHITE", "BLACK", "LIGHTCYAN", "LIGHTGRAY", |
---|
29 | "ITALICS", "CYAN", "YELLOW", "LIGHTGREEN", "Canvas", "Font"] |
---|
30 | \endcode |
---|
31 | |
---|
32 | \code |
---|
33 | irb(main):002:0> Cucul::Canvas.methods.sort - |
---|
34 | Cucul::Canvas.ancestors[1].methods |
---|
35 | => ["export_list", "import_list"] |
---|
36 | \endcode |
---|
37 | |
---|
38 | \code |
---|
39 | irb(main):003:0> Cucul::Canvas.instance_methods.sort - |
---|
40 | Cucul::Canvas.ancestors[1].instance_methods |
---|
41 | => ["attr=", "blit", "clear", "create_frame", "cursor_x", "cursor_y", |
---|
42 | "draw_box", "draw_circle", "draw_cp437_box", "draw_ellipse", |
---|
43 | "draw_line", "draw_polyline", "draw_thin_box", "draw_thin_ellipse", |
---|
44 | "draw_thin_line", "draw_thin_polyline", "draw_thin_triangle", |
---|
45 | "draw_triangle", "export_memory", "fill_box", "fill_ellipse", |
---|
46 | "fill_triangle", "flip", "flop", "frame=", "frame_count", "frame_name", |
---|
47 | "frame_name=", "free_frame", "get_attr", "get_char", "gotoxy", |
---|
48 | "handle_x", "handle_y", "height", "height=", "import_file", |
---|
49 | "import_memory", "invert", "printf", "put_attr", "put_char", "put_str", |
---|
50 | "rotate_180", "rotate_left", "rotate_right", "set_attr", |
---|
51 | "set_boundaries", "set_color_ansi", "set_color_argb", "set_frame", |
---|
52 | "set_frame_name", "set_handle", "set_height", "set_size", "set_width", |
---|
53 | "stretch_left", "stretch_right", "width", "width="] |
---|
54 | \endcode |
---|
55 | |
---|
56 | irb(main):004:0> Cucul::Font.methods.sort - |
---|
57 | Cucul::Font.ancestors[1].methods |
---|
58 | => ["list"] |
---|
59 | |
---|
60 | irb(main):005:0> Cucul::Font.instance_methods.sort - |
---|
61 | Cucul::Font.ancestors[1].instance_methods |
---|
62 | => ["blocks", "height", "width"] |
---|
63 | |
---|
64 | And here are sample uses : |
---|
65 | |
---|
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 | |
---|
75 | \code |
---|
76 | $ ruby -e 'puts Cucul::Canvas.new(6,3).draw_thin_polyline([[0,0], [2,0], |
---|
77 | [5,2],[0,0]]).export_memory("irc")' |
---|
78 | -. |
---|
79 | | `. |
---|
80 | ----`- |
---|
81 | \endcode |
---|
82 | |
---|
83 | \code |
---|
84 | $ ruby -rcucul -e 'p Cucul::Canvas.export_list' |
---|
85 | [["caca", "native libcaca format"], ["ansi", "ANSI"], ["utf8", "UTF-8 |
---|
86 | with ANSI escape codes"], ["utf8cr", "UTF-8 with ANSI escape codes and |
---|
87 | MS-DOS \\r"], ["html", "HTML"], ["html3", "backwards-compatible HTML"], |
---|
88 | ["irc", "IRC with mIRC colours"], ["ps", "PostScript document"], ["svg", |
---|
89 | "SVG vector image"], ["tga", "TGA image"]] |
---|
90 | \endcode |
---|
91 | |
---|
92 | \code |
---|
93 | $ ruby -rcucul -e 'p Cucul::Font.list' |
---|
94 | ["Monospace 9", "Monospace Bold 12"] |
---|
95 | \endcode |
---|
96 | |
---|
97 | */ |
---|