| 1 |
<?php |
| 2 |
header('Content-Type: text/html; charset=UTF-8'); |
| 3 |
?> |
| 4 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 5 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 6 |
|
| 7 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 8 |
<?php |
| 9 |
/* |
| 10 |
* fullwidth libcaca fullwidth Unicode characters test program |
| 11 |
* Copyright (c) 2008 Benjamin C. Wiley Sittler <[email protected]> |
| 12 |
* |
| 13 |
* This file is a Php port of "examples/fullwidth.c" |
| 14 |
* which is: |
| 15 |
* Copyright (c) 2006 Sam Hocevar <[email protected]> |
| 16 |
* All Rights Reserved |
| 17 |
* |
| 18 |
* This program is free software. It comes without any warranty, to |
| 19 |
* the extent permitted by applicable law. You can redistribute it |
| 20 |
* and/or modify it under the terms of the Do What the Fuck You Want |
| 21 |
* to Public License, Version 2, as published by Sam Hocevar. See |
| 22 |
* http://www.wtfpl.net/ for more details. |
| 23 |
*/ |
| 24 |
?> |
| 25 |
<head> |
| 26 |
<title>sample program for libcaca php binding</title> |
| 27 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 28 |
</head> |
| 29 |
<body text="silver" bgcolor="black"> |
| 30 |
<?php |
| 31 |
|
| 32 |
define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"); |
| 33 |
|
| 34 |
$cv = caca_create_canvas(36, 12); |
| 35 |
if(! $cv) |
| 36 |
{ |
| 37 |
die("Can't created canvas\n"); |
| 38 |
} |
| 39 |
|
| 40 |
$caca = caca_create_canvas(6, 10); |
| 41 |
$line = caca_create_canvas(2, 1); |
| 42 |
|
| 43 |
/* Line of x's */ |
| 44 |
for($i = 0; $i < 10; $i++) |
| 45 |
{ |
| 46 |
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); |
| 47 |
caca_put_str($caca, 0, $i, CACA); |
| 48 |
caca_set_color_ansi($caca, CACA_WHITE, CACA_RED); |
| 49 |
caca_put_char($caca, $i - 2, $i, ord('x')); |
| 50 |
} |
| 51 |
|
| 52 |
caca_blit($cv, 1, 1, $caca); |
| 53 |
|
| 54 |
/* Line of ホ's */ |
| 55 |
for($i = 0; $i < 10; $i++) |
| 56 |
{ |
| 57 |
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); |
| 58 |
caca_put_str($caca, 0, $i, CACA); |
| 59 |
caca_set_color_ansi($caca, CACA_WHITE, CACA_GREEN); |
| 60 |
caca_put_str($caca, $i - 2, $i, "ホ"); |
| 61 |
} |
| 62 |
|
| 63 |
caca_blit($cv, 15, 1, $caca); |
| 64 |
|
| 65 |
/* Line of canvas */ |
| 66 |
caca_set_color_ansi($line, CACA_WHITE, CACA_MAGENTA); |
| 67 |
caca_put_str($line, 0, 0, "ほ"); |
| 68 |
for($i = 0; $i < 10; $i++) |
| 69 |
{ |
| 70 |
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); |
| 71 |
caca_put_str($caca, 0, $i, CACA); |
| 72 |
caca_blit($caca, $i - 2, $i, $line); |
| 73 |
} |
| 74 |
|
| 75 |
caca_blit($cv, 29, 1, $caca); |
| 76 |
|
| 77 |
echo caca_export_string($cv, "html3"); |
| 78 |
|
| 79 |
?> |
| 80 |
</body> |
| 81 |
</html> |