Last change
on this file since 3149 was
3149,
checked in by nico, 14 years ago
|
- Add new php specific function caca_load_builtin_font(string name)
- Add php bindings for caca_get_dither_antialias_list, caca_render_canvas
- Add a new sample program examples/render.php
|
-
Property svn:executable set to
*
|
File size:
1.0 KB
|
Line | |
---|
1 | #!/usr/bin/php5 |
---|
2 | <? |
---|
3 | |
---|
4 | $pig_str = <<<EOT |
---|
5 | |
---|
6 | _._ _..._ .-', _.._(`)) |
---|
7 | '-. ` ' /-._.-' ',/ |
---|
8 | ) \ '. |
---|
9 | / _ _ | \ |
---|
10 | | a a / PHP | |
---|
11 | \ .-. ; |
---|
12 | '-('' ).-' ,' ; |
---|
13 | '-; | .' |
---|
14 | \ \ / |
---|
15 | | 7 .__ _.-\ \ |
---|
16 | | | | ``/ /` / |
---|
17 | jgs /,_| | /,_/ / |
---|
18 | /,_/ '`-' |
---|
19 | EOT; |
---|
20 | |
---|
21 | $canvas = caca_create_canvas(0, 0); |
---|
22 | caca_set_color_ansi($canvas, CACA_RED, CACA_WHITE); |
---|
23 | caca_import_string($canvas, $pig_str, "text"); |
---|
24 | caca_set_color_ansi($canvas, CACA_BLUE, CACA_LIGHTGRAY); |
---|
25 | caca_put_str($canvas, 0, 0, "Я люблю Либкаку"); |
---|
26 | echo caca_export_string($canvas, "utf8"); |
---|
27 | |
---|
28 | $img = imagecreatetruecolor(400, 300); |
---|
29 | $font = caca_load_builtin_font("Monospace Bold 12"); |
---|
30 | caca_render_canvas($canvas, $font, $img); |
---|
31 | |
---|
32 | imagepng($img, "out.png"); |
---|
33 | echo "Please, open new created png file: out.png\n"; |
---|
34 | |
---|
35 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.