Procházet zdrojové kódy

* Improve object layer for caca-php

tags/v0.99.beta17
Nicolas Vion nico před 16 roky
rodič
revize
ab44c8daa7
1 změnil soubory, kde provedl 56 přidání a 4 odebrání
  1. +56
    -4
      caca-php/caca.php

+ 56
- 4
caca-php/caca.php Zobrazit soubor

@@ -16,6 +16,38 @@
class Canvas { class Canvas {
private $cv; 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) { function putFigchar($char) {
return caca_put_figchar($this->cv, $char); return caca_put_figchar($this->cv, $char);
} }
@@ -24,10 +56,6 @@ class Canvas {
return caca_canvas_set_figfont($this->cv, $path); return caca_canvas_set_figfont($this->cv, $path);
} }


function getFrameCount() {
return caca_get_frame_count($this->cv);
}

function putAttr($attr) { function putAttr($attr) {
return caca_put_attr($this->cv, $attr); return caca_put_attr($this->cv, $attr);
} }
@@ -216,6 +244,10 @@ class Canvas {
class Display { class Display {
private $dp; private $dp;


function setCursor($visible) {
return caca_set_cursor($this->dp, $visible);
}

function refresh() { function refresh() {
return caca_refresh_display($this->dp); return caca_refresh_display($this->dp);
} }
@@ -365,3 +397,23 @@ class Dither {
$this->img = $image; $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);
}
}

Načítá se…
Zrušit
Uložit