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 <bsittler@gmail.com> |
---|
12 | * |
---|
13 | * This file is a Php port of "examples/fullwidth.c" |
---|
14 | * which is: |
---|
15 | * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> |
---|
16 | * All Rights Reserved |
---|
17 | * |
---|
18 | * $Id: fullwidth.php 3259 2008-11-03 22:30:22Z bsittler $ |
---|
19 | * |
---|
20 | * This program is free software. It comes without any warranty, to |
---|
21 | * the extent permitted by applicable law. You can redistribute it |
---|
22 | * and/or modify it under the terms of the Do What The Fuck You Want |
---|
23 | * To Public License, Version 2, as published by Sam Hocevar. See |
---|
24 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
---|
25 | */ |
---|
26 | ?> |
---|
27 | <head> |
---|
28 | <title>sample program for libcaca php binding</title> |
---|
29 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
---|
30 | </head> |
---|
31 | <body text="silver" bgcolor="black"> |
---|
32 | <?php |
---|
33 | |
---|
34 | define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"); |
---|
35 | |
---|
36 | $cv = caca_create_canvas(36, 12); |
---|
37 | if(! $cv) |
---|
38 | { |
---|
39 | die("Can't created canvas\n"); |
---|
40 | } |
---|
41 | |
---|
42 | $caca = caca_create_canvas(6, 10); |
---|
43 | $line = caca_create_canvas(2, 1); |
---|
44 | |
---|
45 | /* Line of x's */ |
---|
46 | for($i = 0; $i < 10; $i++) |
---|
47 | { |
---|
48 | caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); |
---|
49 | caca_put_str($caca, 0, $i, CACA); |
---|
50 | caca_set_color_ansi($caca, CACA_WHITE, CACA_RED); |
---|
51 | caca_put_char($caca, $i - 2, $i, ord('x')); |
---|
52 | } |
---|
53 | |
---|
54 | caca_blit($cv, 1, 1, $caca); |
---|
55 | |
---|
56 | /* Line of ホ's */ |
---|
57 | for($i = 0; $i < 10; $i++) |
---|
58 | { |
---|
59 | caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); |
---|
60 | caca_put_str($caca, 0, $i, CACA); |
---|
61 | caca_set_color_ansi($caca, CACA_WHITE, CACA_GREEN); |
---|
62 | caca_put_str($caca, $i - 2, $i, "ホ"); |
---|
63 | } |
---|
64 | |
---|
65 | caca_blit($cv, 15, 1, $caca); |
---|
66 | |
---|
67 | /* Line of canvas */ |
---|
68 | caca_set_color_ansi($line, CACA_WHITE, CACA_MAGENTA); |
---|
69 | caca_put_str($line, 0, 0, "ほ"); |
---|
70 | for($i = 0; $i < 10; $i++) |
---|
71 | { |
---|
72 | caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); |
---|
73 | caca_put_str($caca, 0, $i, CACA); |
---|
74 | caca_blit($caca, $i - 2, $i, $line); |
---|
75 | } |
---|
76 | |
---|
77 | caca_blit($cv, 29, 1, $caca); |
---|
78 | |
---|
79 | echo caca_export_string($cv, "html3"); |
---|
80 | |
---|
81 | ?> |
---|
82 | </body> |
---|
83 | </html> |
---|