#!/usr/bin/php5 1) caca_draw_thin_line($cv, $xa, $ya, $xb, $yb); else caca_draw_line($cv, $xa, $ya, $xb, $yb, '#'); } function demo_boxes($cv, $bounds, $outline, $dithering) { $w = caca_get_canvas_width($cv); $h = caca_get_canvas_height($cv); if ($bounds) { $xa = caca_rand(- $w, 2 * $w); $ya = caca_rand(- $h, 2 * $h); $xb = caca_rand(- $w, 2 * $w); $yb = caca_rand(- $h, 2 * $h); } else { $xa = caca_rand(0, $w); $ya = caca_rand(0, $h); $xb = caca_rand(0, $w); $yb = caca_rand(0, $h); } caca_set_color_ansi($cv, caca_rand(0, 16), caca_rand(0, 16)); caca_fill_box($cv, $xa, $ya, $xb, $yb, '#'); caca_set_color_ansi($cv, caca_rand(0, 16), CACA_BLACK); if($outline == 2) caca_draw_thin_box($cv, $xa, $ya, $xb, $yb); else if($outline == 1) caca_draw_box($cv, $xa, $ya, $xb, $yb, '#'); } function demo_ellipses($cv, $bounds, $outline, $dithering) { $w = caca_get_canvas_width($cv); $h = caca_get_canvas_height($cv); if ($bounds) { $x = caca_rand(- $w, 2 * $w); $y = caca_rand(- $h, 2 * $h); $a = caca_rand(0, $w); $b = caca_rand(0, $h); } else { do { $x = caca_rand(0, $w); $y = caca_rand(0, $h); $a = caca_rand(0, $w); $b = caca_rand(0, $h); } while ($x - $a < 0 || $x + $a >= $w || $y - $b < 0 || $y + $b >= $h); } caca_set_color_ansi($cv, caca_rand(0, 16), caca_rand(0, 16)); caca_fill_ellipse($cv, $x, $y, $a, $b, '#'); caca_set_color_ansi($cv, caca_rand(0, 16), CACA_BLACK); if ($outline == 2) caca_draw_thin_ellipse($cv, $x, $y, $a, $b); else if ($outline == 1) caca_draw_ellipse($cv, $x, $y, $a, $b, '#'); } main();