|
|
@@ -12,6 +12,19 @@ |
|
|
|
* http://sam.zoy.org/wtfpl/COPYING for more details. |
|
|
|
*/ |
|
|
|
|
|
|
|
class Libcaca |
|
|
|
{ |
|
|
|
static function Rand($min, $max) |
|
|
|
{ |
|
|
|
return caca_rand($min, $max); |
|
|
|
} |
|
|
|
|
|
|
|
static function getVersion() |
|
|
|
{ |
|
|
|
return caca_get_version(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class AnsiColor |
|
|
|
{ |
|
|
|
const BLACK = CACA_BLACK; |
|
|
@@ -80,15 +93,15 @@ class Canvas { |
|
|
|
} |
|
|
|
|
|
|
|
function putAttr($attr) { |
|
|
|
return caca_put_attr($this->cv, $attr); |
|
|
|
return caca_put_attr($this->cv, $attr); |
|
|
|
} |
|
|
|
|
|
|
|
function stretchRight() { |
|
|
|
return caca_stretch_right($this->cv); |
|
|
|
return caca_stretch_right($this->cv); |
|
|
|
} |
|
|
|
|
|
|
|
function stretchLeft() { |
|
|
|
return caca_stretch_left($this->cv); |
|
|
|
return caca_stretch_left($this->cv); |
|
|
|
} |
|
|
|
|
|
|
|
function setBoundaries($width, $height) { |
|
|
@@ -100,27 +113,27 @@ class Canvas { |
|
|
|
} |
|
|
|
|
|
|
|
function getHandleX() { |
|
|
|
return caca_get_canvas_handle_x($this->cv); |
|
|
|
return caca_get_canvas_handle_x($this->cv); |
|
|
|
} |
|
|
|
|
|
|
|
function getHandleY() { |
|
|
|
return caca_get_canvas_handle_y($this->cv); |
|
|
|
return caca_get_canvas_handle_y($this->cv); |
|
|
|
} |
|
|
|
|
|
|
|
function getCursorX() { |
|
|
|
return caca_get_cursor_x($this->cv); |
|
|
|
return caca_get_cursor_x($this->cv); |
|
|
|
} |
|
|
|
|
|
|
|
function getCursorY() { |
|
|
|
return caca_get_cursor_y($this->cv); |
|
|
|
return caca_get_cursor_y($this->cv); |
|
|
|
} |
|
|
|
|
|
|
|
function getChars() { |
|
|
|
return caca_get_canvas_chars($this->cv); |
|
|
|
return caca_get_canvas_chars($this->cv); |
|
|
|
} |
|
|
|
|
|
|
|
function getAttrs() { |
|
|
|
return caca_get_canvas_attrs($this->cv); |
|
|
|
return caca_get_canvas_attrs($this->cv); |
|
|
|
} |
|
|
|
|
|
|
|
function setSize($width, $height) { |
|
|
@@ -134,7 +147,7 @@ class Canvas { |
|
|
|
function getHeight() { |
|
|
|
return caca_get_canvas_height($this->cv); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getAttr($x, $y) { |
|
|
|
return caca_get_attr($this->cv, $x, $y); |
|
|
|
} |
|
|
@@ -216,15 +229,15 @@ class Canvas { |
|
|
|
} |
|
|
|
|
|
|
|
function drawEllipse($x1, $y1, $x2, $y2, $char) { |
|
|
|
return caca_draw_ellipse($this->cv, $x1, $y1, $x2, $y2, $char); |
|
|
|
return caca_draw_ellipse($this->cv, $x1, $y1, $x2, $y2, $char); |
|
|
|
} |
|
|
|
|
|
|
|
function drawThinEllipse($x1, $y1, $x2, $y2) { |
|
|
|
return caca_draw_thin_ellipse($this->cv, $x1, $y1, $x2, $y2); |
|
|
|
return caca_draw_thin_ellipse($this->cv, $x1, $y1, $x2, $y2); |
|
|
|
} |
|
|
|
|
|
|
|
function fillEllipse($x1, $y1, $x2, $y2, $char) { |
|
|
|
return caca_fill_ellipse($this->cv, $x1, $y1, $x2, $y2, $char); |
|
|
|
return caca_fill_ellipse($this->cv, $x1, $y1, $x2, $y2, $char); |
|
|
|
} |
|
|
|
|
|
|
|
function drawBox($x1, $y1, $x2, $y2, $char) { |
|
|
@@ -258,7 +271,7 @@ class Canvas { |
|
|
|
function __construct($width = 0, $height = 0) { |
|
|
|
$this->cv = caca_create_canvas($width, $height); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function get_resource() { |
|
|
|
return $this->cv; |
|
|
|
} |
|
|
@@ -278,7 +291,7 @@ class EventType |
|
|
|
|
|
|
|
const ANY = CACA_EVENT_ANY; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class EventKey |
|
|
|
{ |
|
|
|
const UNKNOWN = CACA_KEY_UNKNOWN; |
|
|
@@ -368,7 +381,7 @@ class Event { |
|
|
|
function __construct($_ev) { |
|
|
|
$this->ev = $_ev; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function get_resource() { |
|
|
|
return $this->ev; |
|
|
|
} |
|
|
@@ -442,7 +455,7 @@ class Display { |
|
|
|
$this->dp = caca_create_display_with_driver($canvas->get_resource(), $driver); |
|
|
|
else |
|
|
|
$this->dp = caca_create_display($canvas->get_resource()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function get_resource() { |
|
|
|
return $this->dp; |
|
|
@@ -464,71 +477,71 @@ class Dither { |
|
|
|
function getBrightness() { |
|
|
|
return caca_get_dither_brightness($this->dt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setGamme($value) { |
|
|
|
return caca_set_dither_gamma($this->dt, $value); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getGamma() { |
|
|
|
return caca_get_dither_gamma($this->dt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setContrast($value) { |
|
|
|
return caca_set_dither_contrast($this->dt, $value); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getContrast() { |
|
|
|
return caca_get_dither_contrast($this->dt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setAntialias($value) { |
|
|
|
return caca_set_dither_antialias($this->dt, $value); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getAntialiasList() { |
|
|
|
return caca_get_dither_antialias_list($this->dt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getAntialias() { |
|
|
|
return caca_get_dither_antialias($this->dt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setColor($color) { |
|
|
|
return caca_set_dither_color($this->dt, $color); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getColorList() { |
|
|
|
return caca_get_dither_color_list($this->dt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getColor() { |
|
|
|
return caca_get_dither_color($this->dt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setCharset($value) { |
|
|
|
return caca_set_dither_charset($this->dt, $value); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getCharsetList() { |
|
|
|
return caca_get_dither_charset_list($this->dt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getCharset() { |
|
|
|
return caca_get_dither_charset($this->dt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setAlgorithm($name) { |
|
|
|
return caca_set_dither_algorithm($this->dt, $name); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getAlgorithmList() { |
|
|
|
return caca_get_dither_algorithm_list($this->dt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getAlgorithm() { |
|
|
|
return caca_get_dither_algorithm($this->dt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function bitmap($canvas, $x, $y, $width, $height, $load_palette = true) { |
|
|
|
return caca_dither_bitmap($canvas->get_resource(), $x, $y, $width, $height, $this->dt, $this->img, $load_palette); |
|
|
|
} |
|
|
@@ -536,12 +549,12 @@ class Dither { |
|
|
|
function __construct($image) { |
|
|
|
$this->dt = caca_create_dither($image); |
|
|
|
$this->img = $image; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class Font { |
|
|
|
private $f; |
|
|
|
|
|
|
|
|
|
|
|
function getWidth() { |
|
|
|
return caca_get_font_width($this->f); |
|
|
|
} |
|
|
@@ -564,5 +577,5 @@ class Font { |
|
|
|
|
|
|
|
function __construct($name) { |
|
|
|
$this->f = caca_load_builtin_font($name); |
|
|
|
} |
|
|
|
} |
|
|
|
} |