From ab44c8daa733d8ab67c5fb1226b308224c357c3d Mon Sep 17 00:00:00 2001 From: Nicolas Vion Date: Mon, 3 Nov 2008 22:03:31 +0000 Subject: [PATCH] * Improve object layer for caca-php --- caca-php/caca.php | 60 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/caca-php/caca.php b/caca-php/caca.php index 8ab215e..30139bf 100644 --- a/caca-php/caca.php +++ b/caca-php/caca.php @@ -16,6 +16,38 @@ class Canvas { private $cv; + function importFile($path, $codec) { + return caca_import_file($this->cv, $path, $codec); + } + + function importString($codec) { + return caca_import_string($this->cv, $codec); + } + + function exportString($codec) { + return caca_export_string($this->cv, $codec); + } + + function freeFrame($id) { + return caca_free_frame($this->cv, $id); + } + + function frameCount() { + return caca_get_frame_count($this->cv); + } + + function createFrame($id) { + return caca_create_frame($this->cv, $id); + } + + function setFrameName($name) { + return caca_set_frame_name($this->cv, $name); + } + + function setFrame($id) { + return caca_set_frame($this->cv, $id); + } + function putFigchar($char) { return caca_put_figchar($this->cv, $char); } @@ -24,10 +56,6 @@ class Canvas { return caca_canvas_set_figfont($this->cv, $path); } - function getFrameCount() { - return caca_get_frame_count($this->cv); - } - function putAttr($attr) { return caca_put_attr($this->cv, $attr); } @@ -216,6 +244,10 @@ class Canvas { class Display { private $dp; + function setCursor($visible) { + return caca_set_cursor($this->dp, $visible); + } + function refresh() { return caca_refresh_display($this->dp); } @@ -365,3 +397,23 @@ class Dither { $this->img = $image; } } + +class Font { + private $f; + + function getWidth() { + return caca_get_font_width($this->f); + } + + function getHeight() { + return caca_get_font_height($this->f); + } + + function getBlocks() { + return caca_get_font_blocks($this->f); + } + + function __construct($name) { + $this->f = caca_load_builtin_font($name); + } +}