Top Latest Append

pterjan's diary


2007-11-11

  Ruby bindings for libcaca

Few days ago I came across the following in man todo:

Language bindings
   Not that important
       · Ruby

So I decided to start writing some Ruby bindings for libcaca :) I started with the Canvas part of libcucul tonight:

$ irb -rcucul
irb(main):001:0> Cucul.constants
=> ["BROWN", "BOLD", "GREEN", "LIGHTMAGENTA", "LIGHTBLUE", "BLINK", "MAGENTA", "DEFAULT", "TRANSPARENT", "BLUE", "LIGHTRED", "DARKGRAY", "UNDERLINE", "RED", "WHITE", "BLACK", "LIGHTCYAN", "LIGHTGRAY", "ITALICS", "CYAN", "YELLOW", "LIGHTGREEN", "Canvas"]
irb(main):002:0> Cucul::Canvas.methods.sort - Cucul::Canvas.ancestors[1].methods => ["export_list", "import_list"]
irb(main):003:0> Cucul::Canvas.instance_methods.sort - Cucul::Canvas.ancestors[1].instance_methods => ["clear", "cursor_x", "cursor_y", "export_memory", "flip", "flop", "handle_x", "handle_y", "height", "height=", "import_file", "import_memory", "invert", "rotate_180", "rotate_left", "rotate_right", "set_size", "stretch_left", "stretch_right", "width", "width="]
irb(main):004:0> Cucul::Canvas.new(0, 0).import_memory("plop", "").flip.export_memory("irc") => "qolq\r\n"
irb(main):005:0> Cucul::Canvas.export_list => [["caca", "native libcaca format"], ["ansi", "ANSI"], ["utf8", "UTF-8 with ANSI escape codes"], ["utf8cr", "UTF-8 with ANSI escape codes and MS-DOS \\r"], ["html", "HTML"], ["html3", "backwards-compatible HTML"], ["irc", "IRC with mIRC colours"], ["ps", "PostScript document"], ["svg", "SVG vector image"], ["tga", "TGA image"]]


2007-11-18

  Ruby binding for libcaca, again

I have now an almost complete version, with a little documentation and some tests !

The code is in libcaca's subversion repository, and the doc is there.

Have fun and please tell me if you find some use for it or have ideas to improve the API.

Today's TSUKKOMI(Total: 3) [Add a TSUKKOMI]

  Mathieu B [And the Python bindings are called pypycaca héhé.]

  fhqn lkmg [saukcie manrchxlf uohyk epouh hcoi zfxyrgj fuzlij]

  gaeho cjhurtoxv [brcxlmuz nqxagfj tuokzedvb iygjn xdksa tarjqxw aidgh http://www.bexzc.rsfynv.com]


2004|06|07|08|09|11|
2005|01|02|05|06|07|08|09|10|11|12|
2006|01|02|03|06|08|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|12|
2011|02|04|06|
2012|01|05|11|
2013|01|02|04|06|
2014|02|
2015|06|
2017|05|07|12|