/usr/share/doc/libcaca-dev/html/libcaca-ruby-api.html is in libcaca-dev 0.99.beta19-2ubuntu0.18.04.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>libcaca documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.8.13 -->
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Libcaca Ruby API </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="classes"></a>
Classes</h1>
<p>The classes available for libcaca are :</p>
<ul>
<li><b>Caca::Canvas</b> : functions that have a caca_canvas_t* as first argument </li>
<li><b>Caca::Dither</b> : functions that have a caca_dither_t* as first argument </li>
<li><b>Caca::Font</b> : functions that have a caca_font_t* as first argument (The constructor can currently only accept the name of a builtin font) </li>
<li><b>Caca::Display</b> </li>
<li><b>Caca::Event</b> </li>
<li><b>Caca::Event::Key</b> </li>
<li><b>Caca::Event::Key::Press</b> </li>
<li><b>Caca::Event::Key::Release</b> </li>
<li><b>Caca::Event::Mouse</b> </li>
<li><b>Caca::Event::Mouse::Press</b> </li>
<li><b>Caca::Event::Mouse::Release</b> </li>
<li><b>Caca::Event::Mouse::Motion</b> </li>
<li><b>Caca::Event::Resize</b> </li>
<li><b>Caca::Event::Quit</b> </li>
</ul>
<p>The character set conversion functions are not available yet in the binding.</p>
<div class="fragment"><div class="line">$ irb -rcaca</div><div class="line">irb(main):001:0> class Object</div><div class="line">irb(main):002:1> def Object.my_instance_methods</div><div class="line">irb(main):003:2> instance_methods.sort - ancestors[1].instance_methods</div><div class="line">irb(main):004:2> end</div><div class="line">irb(main):005:1> def Object.my_methods</div><div class="line">irb(main):006:2> methods.sort - ancestors[1].methods</div><div class="line">irb(main):007:2> end</div><div class="line">irb(main):008:1> end</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):009:0> Caca.constants</div><div class="line">=> [<span class="stringliteral">"BROWN"</span>, <span class="stringliteral">"BOLD"</span>, <span class="stringliteral">"GREEN"</span>, <span class="stringliteral">"LIGHTMAGENTA"</span>, <span class="stringliteral">"LIGHTBLUE"</span>, <span class="stringliteral">"BLINK"</span>,</div><div class="line"><span class="stringliteral">"MAGENTA"</span>, <span class="stringliteral">"DEFAULT"</span>, <span class="stringliteral">"TRANSPARENT"</span>, <span class="stringliteral">"BLUE"</span>, <span class="stringliteral">"LIGHTRED"</span>, <span class="stringliteral">"DARKGRAY"</span>,</div><div class="line"><span class="stringliteral">"UNDERLINE"</span>, <span class="stringliteral">"RED"</span>, <span class="stringliteral">"WHITE"</span>, <span class="stringliteral">"BLACK"</span>, <span class="stringliteral">"LIGHTCYAN"</span>, <span class="stringliteral">"LIGHTGRAY"</span>,</div><div class="line"><span class="stringliteral">"ITALICS"</span>, <span class="stringliteral">"CYAN"</span>, <span class="stringliteral">"YELLOW"</span>, <span class="stringliteral">"LIGHTGREEN"</span>, <span class="stringliteral">"Canvas"</span>, <span class="stringliteral">"Dither"</span>, <span class="stringliteral">"Font"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):010:0> Caca.my_methods</div><div class="line">=> [<span class="stringliteral">"version"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):011:0> Caca::Canvas.my_methods</div><div class="line">=> [<span class="stringliteral">"export_list"</span>, <span class="stringliteral">"import_list"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):012:0> Caca::Canvas.my_instance_methods</div><div class="line">=> [<span class="stringliteral">"attr="</span>, <span class="stringliteral">"blit"</span>, <span class="stringliteral">"clear"</span>, <span class="stringliteral">"create_frame"</span>,</div><div class="line"><span class="stringliteral">"dither_bitmap"</span>, <span class="stringliteral">"draw_box"</span>, <span class="stringliteral">"draw_circle"</span>, <span class="stringliteral">"draw_cp437_box"</span>, <span class="stringliteral">"draw_ellipse"</span>,</div><div class="line"><span class="stringliteral">"draw_line"</span>, <span class="stringliteral">"draw_polyline"</span>, <span class="stringliteral">"draw_thin_box"</span>, <span class="stringliteral">"draw_thin_ellipse"</span>,</div><div class="line"><span class="stringliteral">"draw_thin_line"</span>, <span class="stringliteral">"draw_thin_polyline"</span>, <span class="stringliteral">"draw_thin_triangle"</span>,</div><div class="line"><span class="stringliteral">"draw_triangle"</span>, <span class="stringliteral">"export_to_memory"</span>, <span class="stringliteral">"fill_box"</span>, <span class="stringliteral">"fill_ellipse"</span>,</div><div class="line"><span class="stringliteral">"fill_triangle"</span>, <span class="stringliteral">"flip"</span>, <span class="stringliteral">"flop"</span>, <span class="stringliteral">"frame="</span>, <span class="stringliteral">"frame_count"</span>, <span class="stringliteral">"frame_name"</span>,</div><div class="line"><span class="stringliteral">"frame_name="</span>, <span class="stringliteral">"free_frame"</span>, <span class="stringliteral">"get_attr"</span>, <span class="stringliteral">"get_char"</span>, <span class="stringliteral">"gotoxy"</span>,</div><div class="line"><span class="stringliteral">"handle_x"</span>, <span class="stringliteral">"handle_y"</span>, <span class="stringliteral">"height"</span>, <span class="stringliteral">"height="</span>, <span class="stringliteral">"import_file"</span>,</div><div class="line"><span class="stringliteral">"import_from_memory"</span>, <span class="stringliteral">"invert"</span>, <span class="stringliteral">"printf"</span>, <span class="stringliteral">"put_attr"</span>, <span class="stringliteral">"put_char"</span>, <span class="stringliteral">"put_str"</span>,</div><div class="line"><span class="stringliteral">"rotate_180"</span>, <span class="stringliteral">"rotate_left"</span>, <span class="stringliteral">"rotate_right"</span>, <span class="stringliteral">"set_attr"</span>,</div><div class="line"><span class="stringliteral">"set_boundaries"</span>, <span class="stringliteral">"set_color_ansi"</span>, <span class="stringliteral">"set_color_argb"</span>, <span class="stringliteral">"set_frame"</span>,</div><div class="line"><span class="stringliteral">"set_frame_name"</span>, <span class="stringliteral">"set_handle"</span>, <span class="stringliteral">"set_height"</span>, <span class="stringliteral">"set_size"</span>, <span class="stringliteral">"set_width"</span>,</div><div class="line"><span class="stringliteral">"stretch_left"</span>, <span class="stringliteral">"stretch_right"</span>, <span class="stringliteral">"wherex"</span>, <span class="stringliteral">"wherey"</span>, <span class="stringliteral">"width"</span>, <span class="stringliteral">"width="</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):013:0> Caca::Font.my_methods</div><div class="line">=> [<span class="stringliteral">"list"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):014:0> Caca::Font.my_instance_methods</div><div class="line">=> [<span class="stringliteral">"blocks"</span>, <span class="stringliteral">"height"</span>, <span class="stringliteral">"width"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):015:0> Caca::Dither.my_instance_methods</div><div class="line">=> [<span class="stringliteral">"algorithm="</span>, <span class="stringliteral">"algorithm_list"</span>, <span class="stringliteral">"antialias="</span>, <span class="stringliteral">"antialias_list"</span>,</div><div class="line"><span class="stringliteral">"brightness="</span>, <span class="stringliteral">"charset="</span>, <span class="stringliteral">"charset_list"</span>, <span class="stringliteral">"color="</span>, <span class="stringliteral">"color_list"</span>,</div><div class="line"><span class="stringliteral">"contrast="</span>, <span class="stringliteral">"gamma="</span>, <span class="stringliteral">"palette="</span>, <span class="stringliteral">"set_algorithm"</span>, <span class="stringliteral">"set_antialias"</span>,</div><div class="line"><span class="stringliteral">"set_brightness"</span>, <span class="stringliteral">"set_charset"</span>, <span class="stringliteral">"set_color"</span>, <span class="stringliteral">"set_contrast"</span>,</div><div class="line"><span class="stringliteral">"set_gamma"</span>, <span class="stringliteral">"set_palette"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):010:0> Caca::Display.my_instance_methods</div><div class="line">=> [<span class="stringliteral">"canvas"</span>, <span class="stringliteral">"get_event"</span>, <span class="stringliteral">"height"</span>, <span class="stringliteral">"mouse="</span>, <span class="stringliteral">"mouse_x"</span>, <span class="stringliteral">"mouse_y"</span>, <span class="stringliteral">"refresh"</span>,</div><div class="line"><span class="stringliteral">"set_mouse"</span>, <span class="stringliteral">"set_time"</span>, <span class="stringliteral">"set_title"</span>, <span class="stringliteral">"time"</span>, <span class="stringliteral">"time="</span>, <span class="stringliteral">"title="</span>, <span class="stringliteral">"width"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):011:0> Caca::Event.constants</div><div class="line">=> [<span class="stringliteral">"Key"</span>, <span class="stringliteral">"Quit"</span>, <span class="stringliteral">"TYPE"</span>, <span class="stringliteral">"Mouse"</span>, <span class="stringliteral">"Resize"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):012:0> Caca::Event.my_instance_methods</div><div class="line">=> [<span class="stringliteral">"quit?"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):013:0> Caca::Event::Key.my_instance_methods</div><div class="line">=> [<span class="stringliteral">"ch"</span>, <span class="stringliteral">"utf32"</span>, <span class="stringliteral">"utf8"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):014:0> Caca::Event::Mouse.my_instance_methods</div><div class="line">=> [<span class="stringliteral">"button"</span>, <span class="stringliteral">"x"</span>, <span class="stringliteral">"y"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">irb(main):015:0> Caca::Event::Resize.my_instance_methods</div><div class="line">=> [<span class="stringliteral">"w"</span>, <span class="stringliteral">"h"</span>]</div></div><!-- fragment --><h1><a class="anchor" id="Samples"></a>
Samples</h1>
<div class="fragment"><div class="line">$ ruby -rcaca -e <span class="stringliteral">'c=Caca::Canvas.new(6, 3).fill_box(0,0,2,2,"#"[0]);</span></div><div class="line"><span class="stringliteral">c2=Caca::Canvas.new(1,1).put_str(0,0,"x"); c.blit(1,1,c2); puts</span></div><div class="line"><span class="stringliteral">c.export_to_memory("irc")'</span></div><div class="line"><span class="preprocessor">###</span></div><div class="line"><span class="preprocessor">#x#</span></div><div class="line"><span class="preprocessor">###</span></div></div><!-- fragment --><div class="fragment"><div class="line">$ ruby -e <span class="stringliteral">'puts Caca::Canvas.new(6,3).draw_thin_polyline([[0,0], [0,2],</span></div><div class="line"><span class="stringliteral">[5,2],[0,0]]).export_to_memory("irc")'</span></div><div class="line">-.</div><div class="line">| `.</div><div class="line">----`-</div></div><!-- fragment --><div class="fragment"><div class="line">$ ruby -rcaca -e <span class="stringliteral">'p Caca::Canvas.export_list'</span></div><div class="line">[[<span class="stringliteral">"caca"</span>, <span class="stringliteral">"native libcaca format"</span>], [<span class="stringliteral">"ansi"</span>, <span class="stringliteral">"ANSI"</span>], [<span class="stringliteral">"utf8"</span>, <span class="stringliteral">"UTF-8</span></div><div class="line"><span class="stringliteral">withANSI escape codes"</span>], [<span class="stringliteral">"utf8cr"</span>, <span class="stringliteral">"UTF-8 with ANSI escape codes and</span></div><div class="line"><span class="stringliteral">MS-DOS\\r"</span>], [<span class="stringliteral">"html"</span>, <span class="stringliteral">"HTML"</span>], [<span class="stringliteral">"html3"</span>, <span class="stringliteral">"backwards-compatible HTML"</span>],</div><div class="line">[<span class="stringliteral">"irc"</span>, <span class="stringliteral">"IRC with mIRC colours"</span>], [<span class="stringliteral">"ps"</span>, <span class="stringliteral">"PostScript document"</span>], [<span class="stringliteral">"svg"</span>,</div><div class="line"><span class="stringliteral">"SVGvector image"</span>], [<span class="stringliteral">"tga"</span>, <span class="stringliteral">"TGA image"</span>]]</div></div><!-- fragment --><div class="fragment"><div class="line">$ ruby -rcaca -e <span class="stringliteral">'p Caca::Font.list'</span></div><div class="line">[<span class="stringliteral">"Monospace9"</span>, <span class="stringliteral">"Monospace Bold 12"</span>]</div></div><!-- fragment --><div class="fragment"><div class="line">require <span class="stringliteral">'caca'</span></div><div class="line">c = Caca::Canvas.new(20,10)</div><div class="line">c.put_str(2,3, <span class="stringliteral">"plop!"</span>)</div><div class="line">c.draw_thin_polyline([[0,0],[0,2], [5,2], [0,0]])</div><div class="line">d = Caca::Display.new(c)</div><div class="line">d.title= <span class="stringliteral">"Test !"</span></div><div class="line">d.refresh</div><div class="line"></div><div class="line"><span class="preprocessor">#Redefine Event::Key#quit? so that q, Q, and Esc become exit keys</span></div><div class="line">module Caca</div><div class="line"> <span class="keyword">class </span>Event::Key</div><div class="line"> def quit?</div><div class="line"> "qQ^[<span class="stringliteral">".split('').member?(@ch.chr)</span></div><div class="line"><span class="stringliteral"> end</span></div><div class="line"><span class="stringliteral"> end</span></div><div class="line"><span class="stringliteral">end</span></div><div class="line"><span class="stringliteral"></span></div><div class="line"><span class="stringliteral">while((e= d.get_event(Caca::Event, -1)) && ! e.quit?)</span></div><div class="line"><span class="stringliteral"> p e</span></div><div class="line"><span class="stringliteral"> d.refresh</span></div><div class="line"><span class="stringliteral">end</span></div></div><!-- fragment --> </div></div><!-- contents -->
</body>
</html>
|