瀏覽代碼

* Improve object layer for caca-php

tags/v0.99.beta17
Nicolas Vion nico 16 年之前
父節點
當前提交
ab44c8daa7
共有 1 個文件被更改,包括 56 次插入4 次删除
  1. +56
    -4
      caca-php/caca.php

+ 56
- 4
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);
}
}

Loading…
取消
儲存