Browse Source

copy render.php to www in preparation for htmlizing

tags/v0.99.beta17
Ben Wiley Sittler bsittler 16 years ago
parent
commit
3fbfa5e3d2
1 changed files with 40 additions and 0 deletions
  1. +40
    -0
      caca-php/examples/www/render.php

+ 40
- 0
caca-php/examples/www/render.php View File

@@ -0,0 +1,40 @@
#!/usr/bin/php5
<?

$pig_str = <<<EOT
_._ _..._ .-', _.._(`))
'-. ` ' /-._.-' ',/
) \ '.
/ _ _ | \
| a a / PHP |
\ .-. ;
'-('' ).-' ,' ;
'-; | .'
\ \ /
| 7 .__ _.-\ \
| | | ``/ /` /
jgs /,_| | /,_/ /
/,_/ '`-'
EOT;

$canvas = caca_create_canvas(0, 0);
caca_set_color_ansi($canvas, CACA_RED, CACA_WHITE);
caca_import_string($canvas, $pig_str, "text");
caca_set_color_ansi($canvas, CACA_BLUE, CACA_LIGHTGRAY);
caca_put_str($canvas, 0, 0, "Я люблю Либкаку");
echo caca_export_string($canvas, "utf8");

$font = caca_load_builtin_font("Monospace Bold 12");

$width = caca_get_canvas_width($canvas) * caca_get_font_width($font);
$height = caca_get_canvas_height($canvas) * caca_get_font_height($font);

$img = imagecreatetruecolor($width, $height);

caca_render_canvas($canvas, $font, $img);

imagepng($img, "out.png");
echo "Please, open new created png file: out.png\n";

?>

Loading…
Cancel
Save