@@ -1,4 +1,4 @@ | |||||
/* $Id$ */ /** \page libcaca-authors Libcaca authors | |||||
/** \page libcaca-authors Libcaca authors | |||||
Sam Hocevar <sam@hocevar.net> | Sam Hocevar <sam@hocevar.net> | ||||
- main programmer | - main programmer | ||||
@@ -1,6 +1,26 @@ | |||||
Commit: UNSUBMITTED | |||||
Author: Sam | |||||
Date: Sun Feb 7 22:30:20 2010 +0000 | |||||
Commit: 4332 | |||||
Author: sam | |||||
Date: Mon Feb 8 00:40:21 2010 +0000 | |||||
Nicer make check output for our custom tests. | |||||
test/check-doxygen | 10 +++++++--- | |||||
test/check-source | 20 +++++++++++++------- | |||||
test/check-win32 | 11 +++++++---- | |||||
3 files changed, 27 insertions(+), 14 deletions(-) | |||||
Commit: 4331 | |||||
Author: sam | |||||
Date: Sun Feb 7 23:44:38 2010 +0000 | |||||
Add missing ruby/test file to the distributed tarball. | |||||
ruby/Makefile.am | 1 + | |||||
1 files changed, 1 insertions(+), 0 deletions(-) | |||||
Commit: 4330 | |||||
Author: sam | |||||
Date: Sun Feb 7 22:37:18 2010 +0000 | |||||
Improve changelog generation. | Improve changelog generation. | ||||
@@ -1,4 +1,3 @@ | |||||
# $Id$ | |||||
SUBDIRS = kernel caca src examples tools \ | SUBDIRS = kernel caca src examples tools \ | ||||
cxx caca-sharp python ruby java \ | cxx caca-sharp python ruby java \ | ||||
@@ -1,33 +1,34 @@ | |||||
/* $Id$ */ /** \page libcaca-news Libcaca news | |||||
/** \page libcaca-news Libcaca news | |||||
\section news0_99_beta17 Changes between 0.9.beta17 and 0.99.beta16 | |||||
\section news0_99_beta17 Changes between 0.99.beta17 and 0.99.beta16 | |||||
- new dirty rectangle framework for accelerated rendering | - new dirty rectangle framework for accelerated rendering | ||||
- new <conio.h> compatible header for old DOS software porting | - new <conio.h> compatible header for old DOS software porting | ||||
- XCode and Visual Studio build improvements | - XCode and Visual Studio build improvements | ||||
- improved HTML output | - improved HTML output | ||||
- new troff output | |||||
- improved Ruby and .NET bindings | - improved Ruby and .NET bindings | ||||
- new comprehensive PHP bindings | - new comprehensive PHP bindings | ||||
- Cocoa driver enhancements | - Cocoa driver enhancements | ||||
- documentation updates | - documentation updates | ||||
- minor improvements and bugfixes | |||||
- numerous improvements and bugfixes | |||||
\section news0_99_beta16 Changes between 0.9.beta16 and 0.99.beta15 | |||||
\section news0_99_beta16 Changes between 0.99.beta16 and 0.99.beta15 | |||||
- many build fixes, especially for nonstandard platforms | - many build fixes, especially for nonstandard platforms | ||||
\section news0_99_beta15 Changes between 0.9.beta15 and 0.99.beta14 | |||||
\section news0_99_beta15 Changes between 0.99.beta15 and 0.99.beta14 | |||||
- libcucul was merged back into libcaca for more clarity | - libcucul was merged back into libcaca for more clarity | ||||
\section news0_99_beta14 Changes between 0.9.beta14 and 0.99.beta13 | |||||
\section news0_99_beta14 Changes between 0.99.beta14 and 0.99.beta13 | |||||
- internal FIGlet font support | - internal FIGlet font support | ||||
- use C99 types in public headers | - use C99 types in public headers | ||||
- runtime support for output drivers | - runtime support for output drivers | ||||
- BBcode export support | - BBcode export support | ||||
\section news0_99_beta13 Changes between 0.9.beta13 and 0.99.beta12 | |||||
\section news0_99_beta13 Changes between 0.99.beta13 and 0.99.beta12 | |||||
- device-dependent cursor support | - device-dependent cursor support | ||||
- event API rewrite | - event API rewrite | ||||
@@ -38,7 +39,7 @@ | |||||
- Python sample code | - Python sample code | ||||
- Visual Studio build solution | - Visual Studio build solution | ||||
\section news0_99_beta12 Changes between 0.9.beta12 and 0.99.beta11 | |||||
\section news0_99_beta12 Changes between 0.99.beta12 and 0.99.beta11 | |||||
- support for 90-degree canvas rotation | - support for 90-degree canvas rotation | ||||
- better behaviour when trying to output Unicode on an ASCII terminal | - better behaviour when trying to output Unicode on an ASCII terminal | ||||
@@ -49,14 +50,14 @@ | |||||
- preliminary .NET bindings | - preliminary .NET bindings | ||||
- many bugfixes and documentation changes | - many bugfixes and documentation changes | ||||
\section news0_99_beta11 Changes between 0.9.beta11 and 0.99.beta10 | |||||
\section news0_99_beta11 Changes between 0.99.beta11 and 0.99.beta10 | |||||
- fixed compilation of the C++ bindings | - fixed compilation of the C++ bindings | ||||
- fixed bugs in cucul_import_memory(), cucul_set_canvas_size() | - fixed bugs in cucul_import_memory(), cucul_set_canvas_size() | ||||
- implemented caca_set_display_title() for ncurses and S-Lang | - implemented caca_set_display_title() for ncurses and S-Lang | ||||
- minor bugfixes | - minor bugfixes | ||||
\section news0_99_beta10 Changes between 0.9.beta10 and 0.99.beta9 | |||||
\section news0_99_beta10 Changes between 0.99.beta10 and 0.99.beta9 | |||||
- new debug mode | - new debug mode | ||||
- blitting canvases now makes use of the canvas' handle coordinates | - blitting canvases now makes use of the canvas' handle coordinates | ||||
@@ -65,7 +66,7 @@ | |||||
- added katakana and hiragana glyphs to the built-in font | - added katakana and hiragana glyphs to the built-in font | ||||
- many bugfixes and documentation changes | - many bugfixes and documentation changes | ||||
\section news0_99_beta9 Changes between 0.9.beta9 and 0.99.beta8 | |||||
\section news0_99_beta9 Changes between 0.99.beta9 and 0.99.beta8 | |||||
- support for blink, bold, italics and underline attributes | - support for blink, bold, italics and underline attributes | ||||
- allow to import and export zero-sized canvases | - allow to import and export zero-sized canvases | ||||
@@ -73,26 +74,26 @@ | |||||
- fixed buffer overlows in the file importer | - fixed buffer overlows in the file importer | ||||
- big documentation updates | - big documentation updates | ||||
\section news0_99_beta8 Changes between 0.9.beta8 and 0.99.beta7 | |||||
\section news0_99_beta8 Changes between 0.99.beta8 and 0.99.beta7 | |||||
- allow to build the X11 and GL drivers as separate plugins | - allow to build the X11 and GL drivers as separate plugins | ||||
- support for fullwidth Unicode characters | - support for fullwidth Unicode characters | ||||
- improved cucul_flip() and cucul_rotate() | - improved cucul_flip() and cucul_rotate() | ||||
- minor bugfixes and documentation updates | - minor bugfixes and documentation updates | ||||
\section news0_99_beta7 Changes between 0.9.beta7 and 0.99.beta6 | |||||
\section news0_99_beta7 Changes between 0.99.beta7 and 0.99.beta6 | |||||
- transparency support in the UTF-8 importer and exporter | - transparency support in the UTF-8 importer and exporter | ||||
- optimised triangle fill routine | - optimised triangle fill routine | ||||
- updated C++ bindings | - updated C++ bindings | ||||
\section news0_99_beta6 Changes between 0.9.beta6 and 0.99.beta5 | |||||
\section news0_99_beta6 Changes between 0.99.beta6 and 0.99.beta5 | |||||
- ANSI importer now handles transparency and UTF-8 | - ANSI importer now handles transparency and UTF-8 | ||||
- Unicode support was broken for about 10% of the set | - Unicode support was broken for about 10% of the set | ||||
- various memory leaks were fixed | - various memory leaks were fixed | ||||
\section news0_99_beta5 Changes between 0.9.beta5 and 0.99.beta4 | |||||
\section news0_99_beta5 Changes between 0.99.beta5 and 0.99.beta4 | |||||
- implemented cucul_getchar() and cucul_get_color() | - implemented cucul_getchar() and cucul_get_color() | ||||
- handle transparency in the IRC export | - handle transparency in the IRC export | ||||
@@ -101,19 +102,19 @@ | |||||
- portability fixes for 64-bit architectures, Win32 and MS-DOS | - portability fixes for 64-bit architectures, Win32 and MS-DOS | ||||
- all demos except cacafire were merged into cacademo | - all demos except cacafire were merged into cacademo | ||||
\section news0_99_beta4 Changes between 0.9.beta4 and 0.99.beta3 | |||||
\section news0_99_beta4 Changes between 0.99.beta4 and 0.99.beta3 | |||||
- added a compatibility layer for pre-1.x libcaca applications | - added a compatibility layer for pre-1.x libcaca applications | ||||
- fixed manpage generation | - fixed manpage generation | ||||
- minor bugfixes and documentation updates | - minor bugfixes and documentation updates | ||||
\section news0_99_beta3 Changes between 0.9.beta3 and 0.99.beta2 | |||||
\section news0_99_beta3 Changes between 0.99.beta3 and 0.99.beta2 | |||||
- libcaca functions use errno for error reporting | - libcaca functions use errno for error reporting | ||||
- updated C++ bindings | - updated C++ bindings | ||||
- minor improvements, bugfixes and documentation updates | - minor improvements, bugfixes and documentation updates | ||||
\section news0_99_beta2 Changes between 0.9.beta2 and 0.99.beta1 | |||||
\section news0_99_beta2 Changes between 0.99.beta2 and 0.99.beta1 | |||||
- ANSI importer | - ANSI importer | ||||
- functions use errno for error reporting | - functions use errno for error reporting | ||||
@@ -1,4 +1,3 @@ | |||||
$Id$ | |||||
o Colour does not work with all backends and all terminals. I tested | o Colour does not work with all backends and all terminals. I tested | ||||
many terminal emulators and tried to summarise which combinations | many terminal emulators and tried to summarise which combinations | ||||
@@ -1,5 +1,4 @@ | |||||
$Id$ | |||||
Building libcaca | Building libcaca | ||||
o Run configure then make. Useful configure flags are: | o Run configure then make. Useful configure flags are: | ||||
@@ -17,7 +16,7 @@ Building libcaca | |||||
--disable-doc: do not build documentation | --disable-doc: do not build documentation | ||||
o Cross-compilation examples: | o Cross-compilation examples: | ||||
./configure --disable-imlib2 --host=i386-pc-msdosdjgpp | ./configure --disable-imlib2 --host=i386-pc-msdosdjgpp | ||||
./configure --disable-imlib2 --host=i586-mingw32msvc | ./configure --disable-imlib2 --host=i586-mingw32msvc | ||||
@@ -31,4 +30,4 @@ Using libcaca | |||||
gcc -c foobar.c -o foobar.o `pkg-config --cflags caca` | gcc -c foobar.c -o foobar.o `pkg-config --cflags caca` | ||||
gcc foobar.o -o foobar `pkg-config --libs caca` | gcc foobar.o -o foobar `pkg-config --libs caca` | ||||
@@ -1,4 +1,4 @@ | |||||
/* $Id$ */ /** \page libcaca-thanks Libcaca thanks | |||||
/** \page libcaca-thanks Libcaca thanks | |||||
\section thanks1 Bugfixes and improvements | \section thanks1 Bugfixes and improvements | ||||
@@ -1,5 +1,4 @@ | |||||
#! /bin/sh | #! /bin/sh | ||||
# $Id$ | |||||
# bootstrap: generic bootstrap/autogen.sh script for autotools projects | # bootstrap: generic bootstrap/autogen.sh script for autotools projects | ||||
# | # | ||||
@@ -1,7 +1,6 @@ | |||||
#! /bin/sh | #! /bin/sh | ||||
## DOS cross-compilation for libcaca -- Sam Hocevar <sam@hocevar.net> | ## DOS cross-compilation for libcaca -- Sam Hocevar <sam@hocevar.net> | ||||
## $Id$ | |||||
set -x | set -x | ||||
set -e | set -e | ||||
@@ -1,7 +1,6 @@ | |||||
#! /bin/sh | #! /bin/sh | ||||
## Kernel-mode libcaca compilation script -- Sam Hocevar <sam@zoy.org> | |||||
## $Id$ | |||||
## Kernel-mode libcaca compilation script -- Sam Hocevar <sam@hocevar.net> | |||||
set -x | set -x | ||||
set -e | set -e | ||||
@@ -1,7 +1,6 @@ | |||||
#! /bin/sh | #! /bin/sh | ||||
## Win32 cross-compilation for libcaca -- Sam Hocevar <sam@hocevar.net> | ## Win32 cross-compilation for libcaca -- Sam Hocevar <sam@hocevar.net> | ||||
## $Id$ | |||||
set -x | set -x | ||||
set -e | set -e | ||||
@@ -1,7 +1,6 @@ | |||||
#! /bin/sh | #! /bin/sh | ||||
## config script for libcaca -- Sam Hocevar <sam@hocevar.net> | ## config script for libcaca -- Sam Hocevar <sam@hocevar.net> | ||||
## $Id$ | |||||
prefix=@prefix@ | prefix=@prefix@ | ||||
exec_prefix=@exec_prefix@ | exec_prefix=@exec_prefix@ | ||||
@@ -19,36 +19,36 @@ function just_for_fun() { | |||||
$moo = <<<EOT | $moo = <<<EOT | ||||
(__) | (__) | ||||
(oo) | (oo) | ||||
/------\/ | |||||
/ | || | |||||
* /\---/\ | |||||
~~ ~~ | |||||
/------\/ | |||||
/ | || | |||||
* /\---/\ | |||||
~~ ~~ | |||||
EOT; | EOT; | ||||
$cv = caca_create_canvas(0, 0); | |||||
caca_set_color_ansi($cv, CACA_LIGHTBLUE, CACA_DEFAULT); | |||||
caca_import_string($cv, $moo, "text"); | |||||
$cv = caca_create_canvas(0, 0); | |||||
caca_set_color_ansi($cv, CACA_LIGHTBLUE, CACA_DEFAULT); | |||||
caca_import_string($cv, $moo, "text"); | |||||
for($j = 0; $j < caca_get_canvas_height($cv); $j++) { | |||||
for($i = 0; $i < caca_get_canvas_width($cv); $i += 2) { | |||||
caca_set_color_ansi($cv, (caca_rand(1, 10) > 5 ? CACA_LIGHTBLUE : CACA_WHITE), CACA_DEFAULT); | |||||
$a = caca_get_attr($cv, -1, -1); | |||||
caca_put_attr($cv, $i, $j, $a); | |||||
caca_put_attr($cv, $i + 1, $j, $a); | |||||
} | |||||
} | |||||
caca_set_canvas_size($cv, 18, 6); | |||||
caca_set_color_ansi($cv, CACA_LIGHTGREEN, CACA_DEFAULT); | |||||
caca_put_str($cv, 14, 0, "Moo!"); | |||||
caca_set_color_ansi($cv, CACA_LIGHTRED, CACA_DEFAULT); | |||||
caca_put_char($cv, 14, 1, hexdec("2765")); //U+2765 | |||||
caca_put_char($cv, 16, 1, hexdec("2764")); //U+2764 | |||||
echo caca_export_string($cv, "utf8"); | |||||
for($j = 0; $j < caca_get_canvas_height($cv); $j++) { | |||||
for($i = 0; $i < caca_get_canvas_width($cv); $i += 2) { | |||||
caca_set_color_ansi($cv, (caca_rand(1, 10) > 5 ? CACA_LIGHTBLUE : CACA_WHITE), CACA_DEFAULT); | |||||
$a = caca_get_attr($cv, -1, -1); | |||||
caca_put_attr($cv, $i, $j, $a); | |||||
caca_put_attr($cv, $i + 1, $j, $a); | |||||
} | |||||
} | |||||
caca_set_canvas_size($cv, 18, 6); | |||||
caca_set_color_ansi($cv, CACA_LIGHTGREEN, CACA_DEFAULT); | |||||
caca_put_str($cv, 14, 0, "Moo!"); | |||||
caca_set_color_ansi($cv, CACA_LIGHTRED, CACA_DEFAULT); | |||||
caca_put_char($cv, 14, 1, hexdec("2765")); //U+2765 | |||||
caca_put_char($cv, 16, 1, hexdec("2764")); //U+2764 | |||||
echo caca_export_string($cv, "utf8"); | |||||
} | } | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
just_for_fun(); | just_for_fun(); | ||||
@@ -59,25 +59,25 @@ echo "libcaca version: ".caca_get_version()."\n\n"; | |||||
echo "Available drivers:\n"; | echo "Available drivers:\n"; | ||||
$list = caca_get_display_driver_list(); | $list = caca_get_display_driver_list(); | ||||
foreach($list as $type => $name) | foreach($list as $type => $name) | ||||
echo "* $name ($type)\n"; | |||||
echo "* $name ($type)\n"; | |||||
echo "\n"; | echo "\n"; | ||||
echo "Available import formats:\n"; | echo "Available import formats:\n"; | ||||
$list = caca_get_import_list(); | $list = caca_get_import_list(); | ||||
foreach($list as $format => $name) | foreach($list as $format => $name) | ||||
echo "* $name ($format)\n"; | |||||
echo "* $name ($format)\n"; | |||||
echo "\n"; | echo "\n"; | ||||
echo "Available export formats:\n"; | echo "Available export formats:\n"; | ||||
$list = caca_get_export_list(); | $list = caca_get_export_list(); | ||||
foreach($list as $format => $name) | foreach($list as $format => $name) | ||||
echo "* $name ($format)\n"; | |||||
echo "* $name ($format)\n"; | |||||
echo "\n"; | echo "\n"; | ||||
echo "Available caca fonts:\n"; | echo "Available caca fonts:\n"; | ||||
$list = caca_get_font_list(); | $list = caca_get_font_list(); | ||||
foreach($list as $name) | foreach($list as $name) | ||||
echo "* $name\n"; | |||||
echo "* $name\n"; | |||||
echo "\n"; | echo "\n"; | ||||
?> | ?> |
@@ -5,7 +5,7 @@ | |||||
* Copyright (c) 2008 Nicolas Vion <nico@yojik.eu> | * Copyright (c) 2008 Nicolas Vion <nico@yojik.eu> | ||||
* | * | ||||
* This file is a Php port of "cxx/cxxtest.cpp" | * This file is a Php port of "cxx/cxxtest.cpp" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
@@ -17,41 +17,41 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
include dirname($argv[0]) . '/../caca.php'; | include dirname($argv[0]) . '/../caca.php'; | ||||
$pig_str = <<<EOT | $pig_str = <<<EOT | ||||
_._ _..._ .-', _.._(`)) | |||||
'-. ` ' /-._.-' ',/ | |||||
) \ '. | |||||
/ _ _ | \ | |||||
| a a / PHP | | |||||
\ .-. ; | |||||
'-('' ).-' ,' ; | |||||
'-; | .' | |||||
\ \ / | |||||
| 7 .__ _.-\ \ | |||||
| | | ``/ /` / | |||||
jgs /,_| | /,_/ / | |||||
/,_/ '`-' | |||||
_._ _..._ .-', _.._(`)) | |||||
'-. ` ' /-._.-' ',/ | |||||
) \ '. | |||||
/ _ _ | \ | |||||
| a a / PHP | | |||||
\ .-. ; | |||||
'-('' ).-' ,' ; | |||||
'-; | .' | |||||
\ \ / | |||||
| 7 .__ _.-\ \ | |||||
| | | ``/ /` / | |||||
jgs /,_| | /,_/ / | |||||
/,_/ '`-' | |||||
EOT; | EOT; | ||||
$canvas = new Canvas(); | $canvas = new Canvas(); | ||||
if (!$canvas) { | if (!$canvas) { | ||||
die("Error while creating main canvas\n"); | |||||
die("Error while creating main canvas\n"); | |||||
} | } | ||||
$pig = new Canvas(); | $pig = new Canvas(); | ||||
if (!$pig) { | if (!$pig) { | ||||
die("Error while creating canvas pig\n"); | |||||
die("Error while creating canvas pig\n"); | |||||
} | } | ||||
$display = new Display($canvas); | $display = new Display($canvas); | ||||
if (!$display) { | if (!$display) { | ||||
die("Error while attaching canvas to display\n"); | |||||
die("Error while attaching canvas to display\n"); | |||||
} | } | ||||
@@ -63,28 +63,28 @@ $x = $y = 0; | |||||
$ix = $iy = 1; | $ix = $iy = 1; | ||||
while (! $display->getEvent(EventType::KEY_PRESS)) { | while (! $display->getEvent(EventType::KEY_PRESS)) { | ||||
// In case of resize ... | |||||
if ($x + $pig->getWidth() - 1 >= $canvas->getWidth() || $x < 0 ) | |||||
$x = 0; | |||||
if ($y + $pig->getHeight() - 1 >= $canvas->getHeight() || $y < 0 ) | |||||
$y = 0; | |||||
$canvas->Clear(); | |||||
// Draw | |||||
$canvas->Blit($x, $y, $pig, NULL); | |||||
$canvas->setColorANSI(AnsiColor::LIGHTBLUE, AnsiColor::BLACK); | |||||
$canvas->putStr($canvas->getWidth() / 2 - 10, $canvas->getHeight() / 2, "Powered by libcaca ".Libcaca::getVersion()); | |||||
$display->refresh(); | |||||
// Move cursor | |||||
$x += $ix; | |||||
$y += $iy; | |||||
if ($x + $pig->getWidth() >= $canvas->getWidth() || $x < 0 ) | |||||
$ix = -$ix; | |||||
if ($y + $pig->getHeight() >= $canvas->getHeight() || $y < 0 ) | |||||
$iy = -$iy; | |||||
// In case of resize ... | |||||
if ($x + $pig->getWidth() - 1 >= $canvas->getWidth() || $x < 0 ) | |||||
$x = 0; | |||||
if ($y + $pig->getHeight() - 1 >= $canvas->getHeight() || $y < 0 ) | |||||
$y = 0; | |||||
$canvas->Clear(); | |||||
// Draw | |||||
$canvas->Blit($x, $y, $pig, NULL); | |||||
$canvas->setColorANSI(AnsiColor::LIGHTBLUE, AnsiColor::BLACK); | |||||
$canvas->putStr($canvas->getWidth() / 2 - 10, $canvas->getHeight() / 2, "Powered by libcaca ".Libcaca::getVersion()); | |||||
$display->refresh(); | |||||
// Move cursor | |||||
$x += $ix; | |||||
$y += $iy; | |||||
if ($x + $pig->getWidth() >= $canvas->getWidth() || $x < 0 ) | |||||
$ix = -$ix; | |||||
if ($y + $pig->getHeight() >= $canvas->getHeight() || $y < 0 ) | |||||
$iy = -$iy; | |||||
} | } | ||||
?> | ?> |
@@ -8,8 +8,6 @@ | |||||
* Copyright (c) 2003-2004 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2003-2004 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -18,33 +16,33 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
$cv = caca_create_canvas(80, 24); | $cv = caca_create_canvas(80, 24); | ||||
if(!$cv) | if(!$cv) | ||||
{ | { | ||||
die("Failed to create canvas\n"); | |||||
die("Failed to create canvas\n"); | |||||
} | } | ||||
$dp = caca_create_display($cv); | $dp = caca_create_display($cv); | ||||
if(!$dp) | if(!$dp) | ||||
{ | { | ||||
die("Failed to create display\n"); | |||||
die("Failed to create display\n"); | |||||
} | } | ||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | ||||
caca_clear_canvas($cv); | caca_clear_canvas($cv); | ||||
for($i = 0; $i < 16; $i++) | for($i = 0; $i < 16; $i++) | ||||
{ | { | ||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_put_str($cv, 3, $i + ($i >= 8 ? 3 : 2), "ANSI " . $i); | |||||
for($j = 0; $j < 16; $j++) | |||||
{ | |||||
caca_set_color_ansi($cv, $i, $j); | |||||
caca_put_str($cv, ($j >= 8 ? 13 : 12) + $j * 4, $i + ($i >= 8 ? 3 : 2), | |||||
"Aaホ"); | |||||
} | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_put_str($cv, 3, $i + ($i >= 8 ? 3 : 2), "ANSI " . $i); | |||||
for($j = 0; $j < 16; $j++) | |||||
{ | |||||
caca_set_color_ansi($cv, $i, $j); | |||||
caca_put_str($cv, ($j >= 8 ? 13 : 12) + $j * 4, $i + ($i >= 8 ? 3 : 2), | |||||
"Aaホ"); | |||||
} | |||||
} | } | ||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | ||||
@@ -4,8 +4,8 @@ | |||||
* demo.php demo for libcaca php binding | * demo.php demo for libcaca php binding | ||||
* Copyright (c) 2008 Nicolas Vion <nico@yojik.eu> | * Copyright (c) 2008 Nicolas Vion <nico@yojik.eu> | ||||
* | * | ||||
* This file is a Php port of the official libcaca's sample program "demo.c" | |||||
* which is: | |||||
* This file is a Php port of the official libcaca's sample program "demo.c" | |||||
* which is: | |||||
* Copyright (c) 2003 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2003 Sam Hocevar <sam@hocevar.net> | ||||
* | * | ||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
@@ -16,345 +16,345 @@ | |||||
*/ | */ | ||||
function main() { | function main() { | ||||
$cv = caca_create_canvas(0, 0); | |||||
if (!$cv) { | |||||
die("Error while creating canvas\n"); | |||||
} | |||||
$dp = caca_create_display($cv); | |||||
if (!$dp) { | |||||
die("Error while attaching canvas to display\n"); | |||||
} | |||||
caca_set_display_time($dp, 40000); | |||||
/* Disable X cursor */ | |||||
caca_set_mouse($dp, 0); | |||||
/* Main menu */ | |||||
$bounds = $outline = $dithering = 0; | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
/* Go ! */ | |||||
$need_refresh = false; | |||||
$quit = 0; | |||||
while(!$quit) { | |||||
while ($ev = caca_get_event($dp, CACA_EVENT_ANY, 1000)) { | |||||
if (caca_get_event_type($ev) & CACA_EVENT_KEY_PRESS) { | |||||
switch (caca_get_event_key_ch($ev)) { | |||||
case ord('q'): | |||||
case ord('Q'): | |||||
case CACA_KEY_ESCAPE: | |||||
$demo = false; | |||||
$quit = 1; | |||||
break; | |||||
case ord('o'): | |||||
case ord('O'): | |||||
$outline = ($outline + 1) % 3; | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
break; | |||||
case ord('b'): | |||||
case ord('B'): | |||||
$bounds = ($bounds + 1) % 2; | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
break; | |||||
case ord('d'): | |||||
case ord('D'): | |||||
$dithering = ($dithering + 1) % 5; | |||||
caca_set_feature($cv, $dithering); | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
break; | |||||
case ord('f'): | |||||
case ord('F'): | |||||
demo_go($dp, "demo_all", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('1'): | |||||
demo_go($dp, "demo_dots", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('2'): | |||||
demo_go($dp, "demo_lines", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('3'): | |||||
demo_go($dp, "demo_boxes", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('4'): | |||||
demo_go($dp, "demo_triangles", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('5'): | |||||
demo_go($dp, "demo_ellipses", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('s'): | |||||
case ord('S'): | |||||
demo_go($dp, "demo_sprites", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('r'): | |||||
case ord('R'): | |||||
demo_go($dp, "demo_render", $cv, $bounds, $outline); | |||||
break; | |||||
} | |||||
} | |||||
else if(caca_get_event_type($ev) & CACA_EVENT_MOUSE_MOTION) { | |||||
$x = caca_get_event_mouse_x($ev); | |||||
$y = caca_get_event_mouse_y($ev); | |||||
display_menu($cv, $dp, $bounds, $outline, false); | |||||
caca_set_color_ansi($cv, CACA_RED, CACA_BLACK); | |||||
caca_put_str($cv, $x, $y, "."); | |||||
caca_put_str($cv, $x, $y + 1, "|\\"); | |||||
$need_refresh = true; | |||||
} | |||||
else if(caca_get_event_type($ev) & CACA_EVENT_RESIZE) { | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
} | |||||
} | |||||
if ($need_refresh) { | |||||
caca_refresh_display($dp); | |||||
$need_refresh = false; | |||||
} | |||||
} | |||||
$cv = caca_create_canvas(0, 0); | |||||
if (!$cv) { | |||||
die("Error while creating canvas\n"); | |||||
} | |||||
$dp = caca_create_display($cv); | |||||
if (!$dp) { | |||||
die("Error while attaching canvas to display\n"); | |||||
} | |||||
caca_set_display_time($dp, 40000); | |||||
/* Disable X cursor */ | |||||
caca_set_mouse($dp, 0); | |||||
/* Main menu */ | |||||
$bounds = $outline = $dithering = 0; | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
/* Go ! */ | |||||
$need_refresh = false; | |||||
$quit = 0; | |||||
while(!$quit) { | |||||
while ($ev = caca_get_event($dp, CACA_EVENT_ANY, 1000)) { | |||||
if (caca_get_event_type($ev) & CACA_EVENT_KEY_PRESS) { | |||||
switch (caca_get_event_key_ch($ev)) { | |||||
case ord('q'): | |||||
case ord('Q'): | |||||
case CACA_KEY_ESCAPE: | |||||
$demo = false; | |||||
$quit = 1; | |||||
break; | |||||
case ord('o'): | |||||
case ord('O'): | |||||
$outline = ($outline + 1) % 3; | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
break; | |||||
case ord('b'): | |||||
case ord('B'): | |||||
$bounds = ($bounds + 1) % 2; | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
break; | |||||
case ord('d'): | |||||
case ord('D'): | |||||
$dithering = ($dithering + 1) % 5; | |||||
caca_set_feature($cv, $dithering); | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
break; | |||||
case ord('f'): | |||||
case ord('F'): | |||||
demo_go($dp, "demo_all", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('1'): | |||||
demo_go($dp, "demo_dots", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('2'): | |||||
demo_go($dp, "demo_lines", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('3'): | |||||
demo_go($dp, "demo_boxes", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('4'): | |||||
demo_go($dp, "demo_triangles", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('5'): | |||||
demo_go($dp, "demo_ellipses", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('s'): | |||||
case ord('S'): | |||||
demo_go($dp, "demo_sprites", $cv, $bounds, $outline); | |||||
break; | |||||
case ord('r'): | |||||
case ord('R'): | |||||
demo_go($dp, "demo_render", $cv, $bounds, $outline); | |||||
break; | |||||
} | |||||
} | |||||
else if(caca_get_event_type($ev) & CACA_EVENT_MOUSE_MOTION) { | |||||
$x = caca_get_event_mouse_x($ev); | |||||
$y = caca_get_event_mouse_y($ev); | |||||
display_menu($cv, $dp, $bounds, $outline, false); | |||||
caca_set_color_ansi($cv, CACA_RED, CACA_BLACK); | |||||
caca_put_str($cv, $x, $y, "."); | |||||
caca_put_str($cv, $x, $y + 1, "|\\"); | |||||
$need_refresh = true; | |||||
} | |||||
else if(caca_get_event_type($ev) & CACA_EVENT_RESIZE) { | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
} | |||||
} | |||||
if ($need_refresh) { | |||||
caca_refresh_display($dp); | |||||
$need_refresh = false; | |||||
} | |||||
} | |||||
} | } | ||||
function display_menu($cv, $dp, $bounds, $outline, $refresh = true) { | function display_menu($cv, $dp, $bounds, $outline, $refresh = true) { | ||||
$xo = caca_get_canvas_width($cv) - 2; | |||||
$yo = caca_get_canvas_height($cv) - 2; | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_clear_canvas($cv); | |||||
caca_draw_thin_box($cv, 1, 1, $xo, $yo); | |||||
caca_put_str($cv, ($xo - strlen("libcaca demo")) / 2, 3, "libcaca demo"); | |||||
caca_put_str($cv, ($xo - strlen("==============")) / 2, 4, "=============="); | |||||
caca_put_str($cv, 4, 6, "demos:"); | |||||
caca_put_str($cv, 4, 7, "'f': full"); | |||||
caca_put_str($cv, 4, 8, "'1': dots"); | |||||
caca_put_str($cv, 4, 9, "'2': lines"); | |||||
caca_put_str($cv, 4, 10, "'3': boxes"); | |||||
caca_put_str($cv, 4, 11, "'4': triangles"); | |||||
caca_put_str($cv, 4, 12, "'5': ellipses"); | |||||
// caca_put_str($cv, 4, 13, "'c': colour"); | |||||
// caca_put_str($cv, 4, 14, "'r': render"); | |||||
// caca_put_str($cv, 4, 15, "'s': sprites"); | |||||
caca_put_str($cv, 4, 16, "settings:"); | |||||
caca_put_str($cv, 4, 17, "'o': outline: ".(($outline == 0) ? "none" : (($outline == 1) ? "solid" : "thin"))); | |||||
caca_put_str($cv, 4, 18, "'b': drawing boundaries: ".(($bounds == 0) ? "screen" : "infinite")); | |||||
caca_put_str($cv, 4, $yo - 2, "'q': quit"); | |||||
if ($refresh) | |||||
caca_refresh_display($dp); | |||||
$xo = caca_get_canvas_width($cv) - 2; | |||||
$yo = caca_get_canvas_height($cv) - 2; | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_clear_canvas($cv); | |||||
caca_draw_thin_box($cv, 1, 1, $xo, $yo); | |||||
caca_put_str($cv, ($xo - strlen("libcaca demo")) / 2, 3, "libcaca demo"); | |||||
caca_put_str($cv, ($xo - strlen("==============")) / 2, 4, "=============="); | |||||
caca_put_str($cv, 4, 6, "demos:"); | |||||
caca_put_str($cv, 4, 7, "'f': full"); | |||||
caca_put_str($cv, 4, 8, "'1': dots"); | |||||
caca_put_str($cv, 4, 9, "'2': lines"); | |||||
caca_put_str($cv, 4, 10, "'3': boxes"); | |||||
caca_put_str($cv, 4, 11, "'4': triangles"); | |||||
caca_put_str($cv, 4, 12, "'5': ellipses"); | |||||
// caca_put_str($cv, 4, 13, "'c': colour"); | |||||
// caca_put_str($cv, 4, 14, "'r': render"); | |||||
// caca_put_str($cv, 4, 15, "'s': sprites"); | |||||
caca_put_str($cv, 4, 16, "settings:"); | |||||
caca_put_str($cv, 4, 17, "'o': outline: ".(($outline == 0) ? "none" : (($outline == 1) ? "solid" : "thin"))); | |||||
caca_put_str($cv, 4, 18, "'b': drawing boundaries: ".(($bounds == 0) ? "screen" : "infinite")); | |||||
caca_put_str($cv, 4, $yo - 2, "'q': quit"); | |||||
if ($refresh) | |||||
caca_refresh_display($dp); | |||||
} | } | ||||
function demo_go($dp, $demo, $cv, $bounds, $outline) { | function demo_go($dp, $demo, $cv, $bounds, $outline) { | ||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_clear_canvas($cv); | |||||
while (!caca_get_event($dp, CACA_EVENT_KEY_PRESS)) { | |||||
if (function_exists($demo)) | |||||
$demo($cv, $bounds, $outline); | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_draw_thin_box($cv, 1, 1, caca_get_canvas_width($cv) - 2, caca_get_canvas_height($cv) - 2); | |||||
$rate = sprintf("%01.2f", 1000000 / caca_get_display_time($dp)); | |||||
caca_put_str($cv, 4, 1, "[$rate fps]----"); | |||||
caca_refresh_display($dp); | |||||
} | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
caca_refresh_display($dp); | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_clear_canvas($cv); | |||||
while (!caca_get_event($dp, CACA_EVENT_KEY_PRESS)) { | |||||
if (function_exists($demo)) | |||||
$demo($cv, $bounds, $outline); | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_draw_thin_box($cv, 1, 1, caca_get_canvas_width($cv) - 2, caca_get_canvas_height($cv) - 2); | |||||
$rate = sprintf("%01.2f", 1000000 / caca_get_display_time($dp)); | |||||
caca_put_str($cv, 4, 1, "[$rate fps]----"); | |||||
caca_refresh_display($dp); | |||||
} | |||||
display_menu($cv, $dp, $bounds, $outline); | |||||
caca_refresh_display($dp); | |||||
} | } | ||||
function demo_all($cv, $bounds, $outline) { | function demo_all($cv, $bounds, $outline) { | ||||
global $i; | |||||
$i++; | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_clear_canvas($cv); | |||||
/* Draw the sun */ | |||||
caca_set_color_ansi($cv, CACA_YELLOW, CACA_BLACK); | |||||
$xo = caca_get_canvas_width($cv) / 4; | |||||
$yo = caca_get_canvas_height($cv) / 4 + 5 * sin(0.03 * $i); | |||||
for ($j = 0; $j < 16; $j++) { | |||||
$xa = $xo - (30 + sin(0.03 * $i) * 8) * sin(0.03 * $i + M_PI * $j / 8); | |||||
$ya = $yo + (15 + sin(0.03 * $i) * 4) * cos(0.03 * $i + M_PI * $j / 8); | |||||
caca_draw_thin_line($cv, $xo, $yo, $xa, $ya); | |||||
} | |||||
$j = 15 + sin(0.03 * $i) * 8; | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_BLACK); | |||||
caca_fill_ellipse($cv, $xo, $yo, $j, $j / 2, ord('#')); | |||||
caca_set_color_ansi($cv, CACA_YELLOW, CACA_BLACK); | |||||
caca_draw_ellipse($cv, $xo, $yo, $j, $j / 2, ord('#')); | |||||
/* Draw the pyramid */ | |||||
$xo = caca_get_canvas_width($cv) * 5 / 8; | |||||
$yo = 2; | |||||
$xa = caca_get_canvas_width($cv) / 8 + sin(0.03 * $i) * 5; | |||||
$ya = caca_get_canvas_height($cv) / 2 + cos(0.03 * $i) * 5; | |||||
$xb = caca_get_canvas_width($cv) - 10 - cos(0.02 * $i) * 10; | |||||
$yb = caca_get_canvas_height($cv) * 3 / 4 - 5 + sin(0.02 * $i) * 5; | |||||
$xc = caca_get_canvas_width($cv) / 4 - sin(0.02 * $i) * 5; | |||||
$yc = caca_get_canvas_height($cv) * 3 / 4 + cos(0.02 * $i) * 5; | |||||
caca_set_color_ansi($cv, CACA_GREEN, CACA_BLACK); | |||||
caca_fill_triangle($cv, $xo, $yo, $xb, $yb, $xa, $ya, ord('%')); | |||||
caca_set_color_ansi($cv, CACA_YELLOW, CACA_BLACK); | |||||
caca_draw_thin_triangle($cv, $xo, $yo, $xb, $yb, $xa, $ya); | |||||
caca_set_color_ansi($cv, CACA_RED, CACA_BLACK); | |||||
caca_fill_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc, ord('#')); | |||||
caca_set_color_ansi($cv, CACA_YELLOW, CACA_BLACK); | |||||
caca_draw_thin_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc); | |||||
caca_set_color_ansi($cv, CACA_BLUE, CACA_BLACK); | |||||
caca_fill_triangle($cv, $xo, $yo, $xb, $yb, $xc, $yc, ord('%')); | |||||
caca_set_color_ansi($cv, CACA_YELLOW, CACA_BLACK); | |||||
caca_draw_thin_triangle($cv, $xo, $yo, $xb, $yb, $xc, $yc); | |||||
/* Draw a background triangle */ | |||||
$xa = 2; | |||||
$ya = 2; | |||||
$xb = caca_get_canvas_width($cv) - 3; | |||||
$yb = caca_get_canvas_height($cv) / 2; | |||||
$xc = caca_get_canvas_width($cv) / 3; | |||||
$yc = caca_get_canvas_height($cv) - 3; | |||||
caca_set_color_ansi($cv, CACA_CYAN, CACA_BLACK); | |||||
caca_draw_thin_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc); | |||||
$xo = caca_get_canvas_width($cv) / 2 + cos(0.027 * $i) * caca_get_canvas_width($cv) / 3; | |||||
$yo = caca_get_canvas_height($cv) / 2 - sin(0.027 * $i) * caca_get_canvas_height($cv) / 2; | |||||
caca_draw_thin_line($cv, $xa, $ya, $xo, $yo); | |||||
caca_draw_thin_line($cv, $xb, $yb, $xo, $yo); | |||||
caca_draw_thin_line($cv, $xc, $yc, $xo, $yo); | |||||
/* Draw a trail behind the foreground sprite */ | |||||
for($j = $i - 60; $j < $i; $j++) { | |||||
$delta = caca_rand(-5, 6); | |||||
caca_set_color_ansi($cv, caca_rand(0, 16), caca_rand(0, 16)); | |||||
caca_put_char($cv, | |||||
caca_get_canvas_width($cv) / 2 + cos(0.02 * $j) * ($delta + caca_get_canvas_width($cv) / 4), | |||||
caca_get_canvas_height($cv) / 2 + sin(0.02 * $j) * ($delta + caca_get_canvas_height($cv) / 3), | |||||
ord('#')); | |||||
} | |||||
global $i; | |||||
$i++; | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_clear_canvas($cv); | |||||
/* Draw the sun */ | |||||
caca_set_color_ansi($cv, CACA_YELLOW, CACA_BLACK); | |||||
$xo = caca_get_canvas_width($cv) / 4; | |||||
$yo = caca_get_canvas_height($cv) / 4 + 5 * sin(0.03 * $i); | |||||
for ($j = 0; $j < 16; $j++) { | |||||
$xa = $xo - (30 + sin(0.03 * $i) * 8) * sin(0.03 * $i + M_PI * $j / 8); | |||||
$ya = $yo + (15 + sin(0.03 * $i) * 4) * cos(0.03 * $i + M_PI * $j / 8); | |||||
caca_draw_thin_line($cv, $xo, $yo, $xa, $ya); | |||||
} | |||||
$j = 15 + sin(0.03 * $i) * 8; | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_BLACK); | |||||
caca_fill_ellipse($cv, $xo, $yo, $j, $j / 2, ord('#')); | |||||
caca_set_color_ansi($cv, CACA_YELLOW, CACA_BLACK); | |||||
caca_draw_ellipse($cv, $xo, $yo, $j, $j / 2, ord('#')); | |||||
/* Draw the pyramid */ | |||||
$xo = caca_get_canvas_width($cv) * 5 / 8; | |||||
$yo = 2; | |||||
$xa = caca_get_canvas_width($cv) / 8 + sin(0.03 * $i) * 5; | |||||
$ya = caca_get_canvas_height($cv) / 2 + cos(0.03 * $i) * 5; | |||||
$xb = caca_get_canvas_width($cv) - 10 - cos(0.02 * $i) * 10; | |||||
$yb = caca_get_canvas_height($cv) * 3 / 4 - 5 + sin(0.02 * $i) * 5; | |||||
$xc = caca_get_canvas_width($cv) / 4 - sin(0.02 * $i) * 5; | |||||
$yc = caca_get_canvas_height($cv) * 3 / 4 + cos(0.02 * $i) * 5; | |||||
caca_set_color_ansi($cv, CACA_GREEN, CACA_BLACK); | |||||
caca_fill_triangle($cv, $xo, $yo, $xb, $yb, $xa, $ya, ord('%')); | |||||
caca_set_color_ansi($cv, CACA_YELLOW, CACA_BLACK); | |||||
caca_draw_thin_triangle($cv, $xo, $yo, $xb, $yb, $xa, $ya); | |||||
caca_set_color_ansi($cv, CACA_RED, CACA_BLACK); | |||||
caca_fill_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc, ord('#')); | |||||
caca_set_color_ansi($cv, CACA_YELLOW, CACA_BLACK); | |||||
caca_draw_thin_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc); | |||||
caca_set_color_ansi($cv, CACA_BLUE, CACA_BLACK); | |||||
caca_fill_triangle($cv, $xo, $yo, $xb, $yb, $xc, $yc, ord('%')); | |||||
caca_set_color_ansi($cv, CACA_YELLOW, CACA_BLACK); | |||||
caca_draw_thin_triangle($cv, $xo, $yo, $xb, $yb, $xc, $yc); | |||||
/* Draw a background triangle */ | |||||
$xa = 2; | |||||
$ya = 2; | |||||
$xb = caca_get_canvas_width($cv) - 3; | |||||
$yb = caca_get_canvas_height($cv) / 2; | |||||
$xc = caca_get_canvas_width($cv) / 3; | |||||
$yc = caca_get_canvas_height($cv) - 3; | |||||
caca_set_color_ansi($cv, CACA_CYAN, CACA_BLACK); | |||||
caca_draw_thin_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc); | |||||
$xo = caca_get_canvas_width($cv) / 2 + cos(0.027 * $i) * caca_get_canvas_width($cv) / 3; | |||||
$yo = caca_get_canvas_height($cv) / 2 - sin(0.027 * $i) * caca_get_canvas_height($cv) / 2; | |||||
caca_draw_thin_line($cv, $xa, $ya, $xo, $yo); | |||||
caca_draw_thin_line($cv, $xb, $yb, $xo, $yo); | |||||
caca_draw_thin_line($cv, $xc, $yc, $xo, $yo); | |||||
/* Draw a trail behind the foreground sprite */ | |||||
for($j = $i - 60; $j < $i; $j++) { | |||||
$delta = caca_rand(-5, 6); | |||||
caca_set_color_ansi($cv, caca_rand(0, 16), caca_rand(0, 16)); | |||||
caca_put_char($cv, | |||||
caca_get_canvas_width($cv) / 2 + cos(0.02 * $j) * ($delta + caca_get_canvas_width($cv) / 4), | |||||
caca_get_canvas_height($cv) / 2 + sin(0.02 * $j) * ($delta + caca_get_canvas_height($cv) / 3), | |||||
ord('#')); | |||||
} | |||||
} | } | ||||
function demo_dots($cv, $bounds, $outline) { | function demo_dots($cv, $bounds, $outline) { | ||||
$xmax = caca_get_canvas_width($cv); | |||||
$ymax = caca_get_canvas_height($cv); | |||||
$xmax = caca_get_canvas_width($cv); | |||||
$ymax = caca_get_canvas_height($cv); | |||||
$chars = array('+', '-', '*', '#', 'X', '@', '%', '$', 'M', 'W'); | |||||
$chars = array('+', '-', '*', '#', 'X', '@', '%', '$', 'M', 'W'); | |||||
for ($i = 1000; $i--;) { | |||||
/* Putpixel */ | |||||
caca_set_color_ansi($cv, caca_rand(0, 16), caca_rand(0, 16)); | |||||
caca_put_char($cv, caca_rand(0, $xmax), caca_rand(0, $ymax), ord($chars[caca_rand(0, 9)])); | |||||
} | |||||
for ($i = 1000; $i--;) { | |||||
/* Putpixel */ | |||||
caca_set_color_ansi($cv, caca_rand(0, 16), caca_rand(0, 16)); | |||||
caca_put_char($cv, caca_rand(0, $xmax), caca_rand(0, $ymax), ord($chars[caca_rand(0, 9)])); | |||||
} | |||||
} | } | ||||
function demo_lines($cv, $bounds, $outline) { | function demo_lines($cv, $bounds, $outline) { | ||||
$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_BLACK); | |||||
if ($outline > 1) | |||||
caca_draw_thin_line($cv, $xa, $ya, $xb, $yb); | |||||
else | |||||
caca_draw_line($cv, $xa, $ya, $xb, $yb, ord('#')); | |||||
$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_BLACK); | |||||
if ($outline > 1) | |||||
caca_draw_thin_line($cv, $xa, $ya, $xb, $yb); | |||||
else | |||||
caca_draw_line($cv, $xa, $ya, $xb, $yb, ord('#')); | |||||
} | } | ||||
function demo_boxes($cv, $bounds, $outline) { | function demo_boxes($cv, $bounds, $outline) { | ||||
$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, ord('#')); | |||||
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, ord('#')); | |||||
$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, ord('#')); | |||||
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, ord('#')); | |||||
} | } | ||||
function demo_ellipses($cv, $bounds, $outline) { | function demo_ellipses($cv, $bounds, $outline) { | ||||
$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, ord('#')); | |||||
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, ord('#')); | |||||
$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, ord('#')); | |||||
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, ord('#')); | |||||
} | } | ||||
function demo_triangles($cv, $bounds, $outline) { | function demo_triangles($cv, $bounds, $outline) { | ||||
$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); | |||||
$xc = caca_rand(- $w, 2 * $w); $yc = 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); | |||||
$xc = caca_rand(0, $w); $yc = caca_rand(0, $h); | |||||
} | |||||
caca_set_color_ansi($cv, caca_rand(0, 16), caca_rand(0, 16)); | |||||
caca_fill_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc, ord('#')); | |||||
caca_set_color_ansi($cv, caca_rand(0, 16), CACA_BLACK); | |||||
if ($outline == 2) | |||||
caca_draw_thin_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc); | |||||
else if ($outline == 1) | |||||
caca_draw_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc, ord('#')); | |||||
$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); | |||||
$xc = caca_rand(- $w, 2 * $w); $yc = 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); | |||||
$xc = caca_rand(0, $w); $yc = caca_rand(0, $h); | |||||
} | |||||
caca_set_color_ansi($cv, caca_rand(0, 16), caca_rand(0, 16)); | |||||
caca_fill_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc, ord('#')); | |||||
caca_set_color_ansi($cv, caca_rand(0, 16), CACA_BLACK); | |||||
if ($outline == 2) | |||||
caca_draw_thin_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc); | |||||
else if ($outline == 1) | |||||
caca_draw_triangle($cv, $xa, $ya, $xb, $yb, $xc, $yc, ord('#')); | |||||
} | } | ||||
function demo_render($cv, $bounds, $outline) { | function demo_render($cv, $bounds, $outline) { | ||||
@@ -362,7 +362,7 @@ function demo_render($cv, $bounds, $outline) { | |||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
main(); | main(); | ||||
@@ -12,23 +12,23 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
$img = imagecreatefrompng(dirname(__FILE__)."/logo-caca.png"); | $img = imagecreatefrompng(dirname(__FILE__)."/logo-caca.png"); | ||||
if (!$img) { | if (!$img) { | ||||
die("Can not open image.\n"); | |||||
die("Can not open image.\n"); | |||||
} | } | ||||
$dither = caca_create_dither($img); | $dither = caca_create_dither($img); | ||||
if (!$dither) { | if (!$dither) { | ||||
die("Can not create dither. Maybe you compiled caca-php without gd support.\n"); | |||||
die("Can not create dither. Maybe you compiled caca-php without gd support.\n"); | |||||
} | } | ||||
$canvas = caca_create_canvas(0, 0); | $canvas = caca_create_canvas(0, 0); | ||||
$display = caca_create_display($canvas); | $display = caca_create_display($canvas); | ||||
if (!$display) { | if (!$display) { | ||||
die("Can not create display.\n"); | |||||
die("Can not create display.\n"); | |||||
} | } | ||||
caca_dither_bitmap($canvas, 0, 0, caca_get_canvas_width($canvas), caca_get_canvas_height($canvas), $dither, $img); | caca_dither_bitmap($canvas, 0, 0, caca_get_canvas_width($canvas), caca_get_canvas_height($canvas), $dither, $img); | ||||
@@ -5,12 +5,10 @@ | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/export.c" | * This file is a Php port of "examples/export.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -19,7 +17,7 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
define('WIDTH', 80); | define('WIDTH', 80); | ||||
@@ -31,104 +29,104 @@ $exports = caca_get_export_list(); | |||||
if($argc < 2 || $argc > 3) | if($argc < 2 || $argc > 3) | ||||
{ | { | ||||
$msg = ($argv[0] . ": wrong argument count\n" . | |||||
"usage: " . $argv[0] . " [file] <format>\n" . | |||||
"where <format> is one of:\n"); | |||||
foreach($exports as $format => $name) | |||||
$msg .= " \"" . $name . "\" (" . $format . ")\n"; | |||||
die($msg); | |||||
$msg = ($argv[0] . ": wrong argument count\n" . | |||||
"usage: " . $argv[0] . " [file] <format>\n" . | |||||
"where <format> is one of:\n"); | |||||
foreach($exports as $format => $name) | |||||
$msg .= " \"" . $name . "\" (" . $format . ")\n"; | |||||
die($msg); | |||||
} | } | ||||
if($argc == 2) | if($argc == 2) | ||||
{ | { | ||||
$file = NULL; | |||||
$format = $argv[1]; | |||||
$file = NULL; | |||||
$format = $argv[1]; | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
$file = $argv[1]; | |||||
$format = $argv[2]; | |||||
$file = $argv[1]; | |||||
$format = $argv[2]; | |||||
} | } | ||||
if(! array_key_exists($format, $exports)) | if(! array_key_exists($format, $exports)) | ||||
{ | { | ||||
$msg = ($argv[0] . ": unknown format `" . $format . "'\n" . | |||||
"please use one of:\n"); | |||||
foreach($exports as $format => $name) | |||||
$msg .= " \"" . $name . "\" (" . $format . ")\n"; | |||||
die($msg); | |||||
$msg = ($argv[0] . ": unknown format `" . $format . "'\n" . | |||||
"please use one of:\n"); | |||||
foreach($exports as $format => $name) | |||||
$msg .= " \"" . $name . "\" (" . $format . ")\n"; | |||||
die($msg); | |||||
} | } | ||||
if($file) | if($file) | ||||
{ | { | ||||
$cv = caca_create_canvas(0, 0); | |||||
if(caca_import_file($cv, $file, "") < 0) | |||||
{ | |||||
die($argv[0] . ": `" . $file . "' has unknown format\n"); | |||||
} | |||||
$cv = caca_create_canvas(0, 0); | |||||
if(caca_import_file($cv, $file, "") < 0) | |||||
{ | |||||
die($argv[0] . ": `" . $file . "' has unknown format\n"); | |||||
} | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
$cv = caca_create_canvas(WIDTH, HEIGHT); | |||||
for($y = 0; $y < 256; $y++) | |||||
{ | |||||
for($x = 0; $x < 256; $x++) | |||||
{ | |||||
$r = $x; | |||||
$g = (255 - $y + $x) / 2; | |||||
$b = $y * (255 - $x) / 256; | |||||
imagesetpixel($pixels, $x, $y, imagecolorallocate($pixels, $r, $g, $b)); | |||||
} | |||||
} | |||||
$dither = caca_create_dither($pixels); | |||||
if(($format == "ansi") || ($format == "utf8")) | |||||
caca_set_dither_charset($dither, "shades"); | |||||
caca_dither_bitmap($cv, 0, 0, caca_get_canvas_width($cv), | |||||
caca_get_canvas_height($cv), $dither, $pixels); | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_BLACK); | |||||
caca_draw_thin_box($cv, 0, 0, WIDTH - 1, HEIGHT - 1); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_fill_ellipse($cv, WIDTH / 2, HEIGHT / 2, | |||||
WIDTH / 4, HEIGHT / 4, ord(' ')); | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 6, | |||||
" lightgray on black "); | |||||
caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 5, | |||||
" default on transparent "); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 4, | |||||
" black on white "); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_put_str($cv, WIDTH / 2 - 8, HEIGHT / 2 - 3, "[<><><><> <>--<>]"); | |||||
caca_put_str($cv, WIDTH / 2 - 8, HEIGHT / 2 - 2, "[ドラゴン ボーレ]"); | |||||
caca_put_str($cv, WIDTH / 2 - 7, HEIGHT / 2 + 2, "äβç ░▒▓█▓▒░ ΔЗҒ"); | |||||
caca_put_str($cv, WIDTH / 2 - 5, HEIGHT / 2 + 4, "(\") \\o/ <&>"); | |||||
caca_set_attr($cv, CACA_BOLD); | |||||
caca_put_str($cv, WIDTH / 2 - 16, HEIGHT / 2 + 3, "Bold"); | |||||
caca_set_attr($cv, CACA_BLINK); | |||||
caca_put_str($cv, WIDTH / 2 - 9, HEIGHT / 2 + 3, "Blink"); | |||||
caca_set_attr($cv, CACA_ITALICS); | |||||
caca_put_str($cv, WIDTH / 2 - 1, HEIGHT / 2 + 3, "Italics"); | |||||
caca_set_attr($cv, CACA_UNDERLINE); | |||||
caca_put_str($cv, WIDTH / 2 + 8, HEIGHT / 2 + 3, "Underline"); | |||||
caca_set_attr($cv, 0); | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE); | |||||
caca_put_str($cv, WIDTH / 2 - 7, HEIGHT / 2, " LIBCACA "); | |||||
for($x = 0; $x < 16; $x++) | |||||
{ | |||||
caca_set_color_argb($cv, 0xff00 | $x, 0xf00f | ($x << 4)); | |||||
caca_put_char($cv, WIDTH / 2 - 7 + $x, HEIGHT / 2 + 6, ord('#')); | |||||
} | |||||
$cv = caca_create_canvas(WIDTH, HEIGHT); | |||||
for($y = 0; $y < 256; $y++) | |||||
{ | |||||
for($x = 0; $x < 256; $x++) | |||||
{ | |||||
$r = $x; | |||||
$g = (255 - $y + $x) / 2; | |||||
$b = $y * (255 - $x) / 256; | |||||
imagesetpixel($pixels, $x, $y, imagecolorallocate($pixels, $r, $g, $b)); | |||||
} | |||||
} | |||||
$dither = caca_create_dither($pixels); | |||||
if(($format == "ansi") || ($format == "utf8")) | |||||
caca_set_dither_charset($dither, "shades"); | |||||
caca_dither_bitmap($cv, 0, 0, caca_get_canvas_width($cv), | |||||
caca_get_canvas_height($cv), $dither, $pixels); | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_BLACK); | |||||
caca_draw_thin_box($cv, 0, 0, WIDTH - 1, HEIGHT - 1); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_fill_ellipse($cv, WIDTH / 2, HEIGHT / 2, | |||||
WIDTH / 4, HEIGHT / 4, ord(' ')); | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 6, | |||||
" lightgray on black "); | |||||
caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 5, | |||||
" default on transparent "); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 4, | |||||
" black on white "); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_put_str($cv, WIDTH / 2 - 8, HEIGHT / 2 - 3, "[<><><><> <>--<>]"); | |||||
caca_put_str($cv, WIDTH / 2 - 8, HEIGHT / 2 - 2, "[ドラゴン ボーレ]"); | |||||
caca_put_str($cv, WIDTH / 2 - 7, HEIGHT / 2 + 2, "äβç ░▒▓█▓▒░ ΔЗҒ"); | |||||
caca_put_str($cv, WIDTH / 2 - 5, HEIGHT / 2 + 4, "(\") \\o/ <&>"); | |||||
caca_set_attr($cv, CACA_BOLD); | |||||
caca_put_str($cv, WIDTH / 2 - 16, HEIGHT / 2 + 3, "Bold"); | |||||
caca_set_attr($cv, CACA_BLINK); | |||||
caca_put_str($cv, WIDTH / 2 - 9, HEIGHT / 2 + 3, "Blink"); | |||||
caca_set_attr($cv, CACA_ITALICS); | |||||
caca_put_str($cv, WIDTH / 2 - 1, HEIGHT / 2 + 3, "Italics"); | |||||
caca_set_attr($cv, CACA_UNDERLINE); | |||||
caca_put_str($cv, WIDTH / 2 + 8, HEIGHT / 2 + 3, "Underline"); | |||||
caca_set_attr($cv, 0); | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE); | |||||
caca_put_str($cv, WIDTH / 2 - 7, HEIGHT / 2, " LIBCACA "); | |||||
for($x = 0; $x < 16; $x++) | |||||
{ | |||||
caca_set_color_argb($cv, 0xff00 | $x, 0xf00f | ($x << 4)); | |||||
caca_put_char($cv, WIDTH / 2 - 7 + $x, HEIGHT / 2 + 6, ord('#')); | |||||
} | |||||
} | } | ||||
echo caca_export_string($cv, $format); | echo caca_export_string($cv, $format); | ||||
@@ -11,37 +11,37 @@ | |||||
* http://sam.zoy.org/wtfpl/COPYING for more details. | * http://sam.zoy.org/wtfpl/COPYING for more details. | ||||
*/ | */ | ||||
function unistr_to_ords($str, $encoding = 'UTF-8'){ | |||||
$str = mb_convert_encoding($str, "UCS-4BE", $encoding); | |||||
$result = array(); | |||||
for ($i = 0; $i < mb_strlen($str, "UCS-4BE"); $i++){ | |||||
$c = mb_substr($str, $i, 1, "UCS-4BE"); | |||||
$val = unpack("N", $c); | |||||
$result[] = $val[1]; | |||||
} | |||||
return $result; | |||||
function unistr_to_ords($str, $encoding = 'UTF-8'){ | |||||
$str = mb_convert_encoding($str, "UCS-4BE", $encoding); | |||||
$result = array(); | |||||
for ($i = 0; $i < mb_strlen($str, "UCS-4BE"); $i++){ | |||||
$c = mb_substr($str, $i, 1, "UCS-4BE"); | |||||
$val = unpack("N", $c); | |||||
$result[] = $val[1]; | |||||
} | |||||
return $result; | |||||
} | } | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
if ($argc < 3) { | if ($argc < 3) { | ||||
die("Too few arguments.\nUsage: cmd <path of font> <utf8 string>\n"); | |||||
die("Too few arguments.\nUsage: cmd <path of font> <utf8 string>\n"); | |||||
} | } | ||||
$cv = caca_create_canvas(0, 0); | $cv = caca_create_canvas(0, 0); | ||||
if (!caca_canvas_set_figfont($cv, $argv[1])) { | if (!caca_canvas_set_figfont($cv, $argv[1])) { | ||||
die("Could not open font\n"); | |||||
die("Could not open font\n"); | |||||
} | } | ||||
$chars = unistr_to_ords($argv[2]); | $chars = unistr_to_ords($argv[2]); | ||||
$color = 0; | $color = 0; | ||||
foreach ($chars as $c) { | foreach ($chars as $c) { | ||||
caca_set_color_ansi($cv, 1 + (($color += 4) % 15), CACA_TRANSPARENT); | |||||
caca_put_figchar($cv, $c); | |||||
caca_set_color_ansi($cv, 1 + (($color += 4) % 15), CACA_TRANSPARENT); | |||||
caca_put_figchar($cv, $c); | |||||
} | } | ||||
echo caca_export_string($cv, "utf8"); | echo caca_export_string($cv, "utf8"); | ||||
@@ -5,12 +5,10 @@ | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/fullwidth.c" | * This file is a Php port of "examples/fullwidth.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -19,7 +17,7 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"); | define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"); | ||||
@@ -27,12 +25,12 @@ define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"); | |||||
$cv = caca_create_canvas(0, 0); | $cv = caca_create_canvas(0, 0); | ||||
if(! $cv) | if(! $cv) | ||||
{ | { | ||||
die("Can't created canvas\n"); | |||||
die("Can't created canvas\n"); | |||||
} | } | ||||
$dp = caca_create_display($cv); | $dp = caca_create_display($cv); | ||||
if(! $dp) | if(! $dp) | ||||
{ | { | ||||
die("Can't create display\n"); | |||||
die("Can't create display\n"); | |||||
} | } | ||||
$caca = caca_create_canvas(6, 10); | $caca = caca_create_canvas(6, 10); | ||||
@@ -41,10 +39,10 @@ $line = caca_create_canvas(2, 1); | |||||
/* Line of x's */ | /* Line of x's */ | ||||
for($i = 0; $i < 10; $i++) | for($i = 0; $i < 10; $i++) | ||||
{ | { | ||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_RED); | |||||
caca_put_char($caca, $i - 2, $i, ord('x')); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_RED); | |||||
caca_put_char($caca, $i - 2, $i, ord('x')); | |||||
} | } | ||||
caca_blit($cv, 1, 1, $caca); | caca_blit($cv, 1, 1, $caca); | ||||
@@ -52,10 +50,10 @@ caca_blit($cv, 1, 1, $caca); | |||||
/* Line of ホ's */ | /* Line of ホ's */ | ||||
for($i = 0; $i < 10; $i++) | for($i = 0; $i < 10; $i++) | ||||
{ | { | ||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_GREEN); | |||||
caca_put_str($caca, $i - 2, $i, "ホ"); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_GREEN); | |||||
caca_put_str($caca, $i - 2, $i, "ホ"); | |||||
} | } | ||||
caca_blit($cv, 15, 1, $caca); | caca_blit($cv, 15, 1, $caca); | ||||
@@ -65,9 +63,9 @@ caca_set_color_ansi($line, CACA_WHITE, CACA_MAGENTA); | |||||
caca_put_str($line, 0, 0, "ほ"); | caca_put_str($line, 0, 0, "ほ"); | ||||
for($i = 0; $i < 10; $i++) | for($i = 0; $i < 10; $i++) | ||||
{ | { | ||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_blit($caca, $i - 2, $i, $line); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_blit($caca, $i - 2, $i, $line); | |||||
} | } | ||||
caca_blit($cv, 29, 1, $caca); | caca_blit($cv, 29, 1, $caca); | ||||
@@ -5,13 +5,11 @@ | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "src/img2txt.c" | * This file is a Php port of "src/img2txt.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* 2007 Jean-Yves Lamoureux <jylam@lnxscene.org> | * 2007 Jean-Yves Lamoureux <jylam@lnxscene.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -20,7 +18,7 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
class MygetoptException extends Exception | class MygetoptException extends Exception | ||||
@@ -31,368 +29,368 @@ $myoptind = 0; | |||||
function mygetopt($shortopts, $longopts) | function mygetopt($shortopts, $longopts) | ||||
{ | { | ||||
global $argc, $argv, $myoptind; | |||||
if($myoptind < 0) | |||||
{ | |||||
$myoptind = 0; | |||||
} | |||||
if(($myoptind + 1) >= $argc) | |||||
{ | |||||
return NULL; | |||||
} | |||||
$myoptind ++; | |||||
$nextarg = $argv[$myoptind]; | |||||
$ret = NULL; | |||||
if((substr($nextarg, 0, 1) != '-') | |||||
|| | |||||
($nextarg == '-')) | |||||
{ | |||||
$myoptind = $argc - 1; | |||||
} | |||||
else | |||||
{ | |||||
$skipopt = $myoptind; | |||||
$skipopts = 1; | |||||
if($nextarg == '--') | |||||
{ | |||||
$myoptind = $argc - 1; | |||||
} | |||||
else | |||||
{ | |||||
$opt = NULL; | |||||
$arg = NULL; | |||||
foreach($longopts as $longopt) | |||||
{ | |||||
$optional = false; | |||||
$hasarg = false; | |||||
if(($longopt != '::') && substr($longopt, -2) == '::') | |||||
{ | |||||
$optional = true; | |||||
$hasarg = true; | |||||
$longopt = substr($longopt, 0, -2); | |||||
} | |||||
else if(($longopt != ':') && substr($longopt, -1) == ':') | |||||
{ | |||||
$optional = false; | |||||
$hasarg = true; | |||||
$longopt = substr($longopt, 0, -1); | |||||
} | |||||
if($nextarg == ('--' . $longopt)) | |||||
{ | |||||
$opt = '--' . $longopt; | |||||
if($hasarg && ! $optional) | |||||
{ | |||||
if(($myoptind + 1) < $argc) | |||||
{ | |||||
$myoptind ++; | |||||
$skipopts ++; | |||||
$arg = $argv[$myoptind]; | |||||
} | |||||
else | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" requires an argument"); | |||||
} | |||||
} | |||||
break; | |||||
} | |||||
else if(substr($nextarg, 0, strlen('--' . $longopt . '=')) | |||||
== | |||||
('--' . $longopt . '=')) | |||||
{ | |||||
$opt = '--' . $longopt; | |||||
$arg = substr($nextarg, strlen($opt . '=')); | |||||
if(! $hasarg) | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" does not allow an argument"); | |||||
} | |||||
break; | |||||
} | |||||
} | |||||
if($opt === NULL) | |||||
{ | |||||
for($i = 0; $i < strlen($shortopts); $i ++) | |||||
{ | |||||
$optional = false; | |||||
$hasarg = false; | |||||
$shortopt = substr($shortopts, $i, 1); | |||||
if(substr($shortopts, $i + 1, 2) == '::') | |||||
{ | |||||
$optional = true; | |||||
$hasarg = true; | |||||
$i += 2; | |||||
} | |||||
else if(substr($shortopts, $i + 1, 1) == ':') | |||||
{ | |||||
$hasarg = true; | |||||
} | |||||
if($nextarg | |||||
== | |||||
('-' . $shortopt)) | |||||
{ | |||||
$opt = '-' . $shortopt; | |||||
if($hasarg && ! $optional) | |||||
{ | |||||
if(($myoptind + 1) < $argc) | |||||
{ | |||||
$myoptind ++; | |||||
$skipopts ++; | |||||
$arg = $argv[$myoptind]; | |||||
} | |||||
else | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" requires an argument"); | |||||
} | |||||
} | |||||
break; | |||||
} | |||||
else if(substr($nextarg, 0, strlen('-' . $shortopt)) | |||||
== | |||||
('-' . $shortopt)) | |||||
{ | |||||
$opt = '-' . $shortopt; | |||||
if($hasarg) | |||||
{ | |||||
$arg = substr($nextarg, strlen($opt)); | |||||
} | |||||
else | |||||
{ | |||||
$argv[$myoptind] = '-' . substr($nextarg, strlen($opt)); | |||||
$myoptind --; | |||||
$skipopts = 0; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
if($opt === NULL) | |||||
{ | |||||
if(substr($nextarg, 0, strlen('--')) == '--') | |||||
{ | |||||
$longopt = substr($nextarg, strlen('--')); | |||||
if(strpos($longopt, '=') !== false) | |||||
{ | |||||
$longopt = substr($longopt, 0, strpos($longopt, '=')); | |||||
} | |||||
throw new MygetoptException("option \"--$longopt\" is not recognized"); | |||||
} | |||||
$shortopt = substr($nextarg, strlen('-'), 1); | |||||
throw new MygetoptException("option \"-$shortopt\" is not recognized"); | |||||
} | |||||
$ret = array($opt, $arg); | |||||
} | |||||
if ($skipopts > 0) | |||||
{ | |||||
for($i = 0; $i < $argc; $i ++) | |||||
{ | |||||
if(($i < $skipopt) || ($i >= ($skipopt + $skipopts))) | |||||
{ | |||||
$new_argv[] = $argv[$i]; | |||||
} | |||||
} | |||||
if($myoptind >= $skipopt) | |||||
{ | |||||
$myoptind -= $skipopts; | |||||
} | |||||
$argv = $new_argv; | |||||
$argc = count($argv); | |||||
} | |||||
} | |||||
return $ret; | |||||
global $argc, $argv, $myoptind; | |||||
if($myoptind < 0) | |||||
{ | |||||
$myoptind = 0; | |||||
} | |||||
if(($myoptind + 1) >= $argc) | |||||
{ | |||||
return NULL; | |||||
} | |||||
$myoptind ++; | |||||
$nextarg = $argv[$myoptind]; | |||||
$ret = NULL; | |||||
if((substr($nextarg, 0, 1) != '-') | |||||
|| | |||||
($nextarg == '-')) | |||||
{ | |||||
$myoptind = $argc - 1; | |||||
} | |||||
else | |||||
{ | |||||
$skipopt = $myoptind; | |||||
$skipopts = 1; | |||||
if($nextarg == '--') | |||||
{ | |||||
$myoptind = $argc - 1; | |||||
} | |||||
else | |||||
{ | |||||
$opt = NULL; | |||||
$arg = NULL; | |||||
foreach($longopts as $longopt) | |||||
{ | |||||
$optional = false; | |||||
$hasarg = false; | |||||
if(($longopt != '::') && substr($longopt, -2) == '::') | |||||
{ | |||||
$optional = true; | |||||
$hasarg = true; | |||||
$longopt = substr($longopt, 0, -2); | |||||
} | |||||
else if(($longopt != ':') && substr($longopt, -1) == ':') | |||||
{ | |||||
$optional = false; | |||||
$hasarg = true; | |||||
$longopt = substr($longopt, 0, -1); | |||||
} | |||||
if($nextarg == ('--' . $longopt)) | |||||
{ | |||||
$opt = '--' . $longopt; | |||||
if($hasarg && ! $optional) | |||||
{ | |||||
if(($myoptind + 1) < $argc) | |||||
{ | |||||
$myoptind ++; | |||||
$skipopts ++; | |||||
$arg = $argv[$myoptind]; | |||||
} | |||||
else | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" requires an argument"); | |||||
} | |||||
} | |||||
break; | |||||
} | |||||
else if(substr($nextarg, 0, strlen('--' . $longopt . '=')) | |||||
== | |||||
('--' . $longopt . '=')) | |||||
{ | |||||
$opt = '--' . $longopt; | |||||
$arg = substr($nextarg, strlen($opt . '=')); | |||||
if(! $hasarg) | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" does not allow an argument"); | |||||
} | |||||
break; | |||||
} | |||||
} | |||||
if($opt === NULL) | |||||
{ | |||||
for($i = 0; $i < strlen($shortopts); $i ++) | |||||
{ | |||||
$optional = false; | |||||
$hasarg = false; | |||||
$shortopt = substr($shortopts, $i, 1); | |||||
if(substr($shortopts, $i + 1, 2) == '::') | |||||
{ | |||||
$optional = true; | |||||
$hasarg = true; | |||||
$i += 2; | |||||
} | |||||
else if(substr($shortopts, $i + 1, 1) == ':') | |||||
{ | |||||
$hasarg = true; | |||||
} | |||||
if($nextarg | |||||
== | |||||
('-' . $shortopt)) | |||||
{ | |||||
$opt = '-' . $shortopt; | |||||
if($hasarg && ! $optional) | |||||
{ | |||||
if(($myoptind + 1) < $argc) | |||||
{ | |||||
$myoptind ++; | |||||
$skipopts ++; | |||||
$arg = $argv[$myoptind]; | |||||
} | |||||
else | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" requires an argument"); | |||||
} | |||||
} | |||||
break; | |||||
} | |||||
else if(substr($nextarg, 0, strlen('-' . $shortopt)) | |||||
== | |||||
('-' . $shortopt)) | |||||
{ | |||||
$opt = '-' . $shortopt; | |||||
if($hasarg) | |||||
{ | |||||
$arg = substr($nextarg, strlen($opt)); | |||||
} | |||||
else | |||||
{ | |||||
$argv[$myoptind] = '-' . substr($nextarg, strlen($opt)); | |||||
$myoptind --; | |||||
$skipopts = 0; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
if($opt === NULL) | |||||
{ | |||||
if(substr($nextarg, 0, strlen('--')) == '--') | |||||
{ | |||||
$longopt = substr($nextarg, strlen('--')); | |||||
if(strpos($longopt, '=') !== false) | |||||
{ | |||||
$longopt = substr($longopt, 0, strpos($longopt, '=')); | |||||
} | |||||
throw new MygetoptException("option \"--$longopt\" is not recognized"); | |||||
} | |||||
$shortopt = substr($nextarg, strlen('-'), 1); | |||||
throw new MygetoptException("option \"-$shortopt\" is not recognized"); | |||||
} | |||||
$ret = array($opt, $arg); | |||||
} | |||||
if ($skipopts > 0) | |||||
{ | |||||
for($i = 0; $i < $argc; $i ++) | |||||
{ | |||||
if(($i < $skipopt) || ($i >= ($skipopt + $skipopts))) | |||||
{ | |||||
$new_argv[] = $argv[$i]; | |||||
} | |||||
} | |||||
if($myoptind >= $skipopt) | |||||
{ | |||||
$myoptind -= $skipopts; | |||||
} | |||||
$argv = $new_argv; | |||||
$argc = count($argv); | |||||
} | |||||
} | |||||
return $ret; | |||||
} | } | ||||
function usage($argc, $argv) | function usage($argc, $argv) | ||||
{ | { | ||||
fprintf(STDERR, "Usage: %s [OPTIONS]... <IMAGE>\n", $argv[0]); | |||||
fprintf(STDERR, "Convert IMAGE to any text based available format.\n"); | |||||
fprintf(STDERR, "Example : %s -W 80 -f ansi ./caca.png\n\n", $argv[0]); | |||||
fprintf(STDERR, "Options:\n"); | |||||
fprintf(STDERR, " -h, --help\t\t\tThis help\n"); | |||||
fprintf(STDERR, " -v, --version\t\t\tVersion of the program\n"); | |||||
fprintf(STDERR, " -W, --width=WIDTH\t\tWidth of resulting image\n"); | |||||
fprintf(STDERR, " -H, --height=HEIGHT\t\tHeight of resulting image\n"); | |||||
fprintf(STDERR, " -x, --font-width=WIDTH\t\tWidth of output font\n"); | |||||
fprintf(STDERR, " -y, --font-height=HEIGHT\t\tHeight of output font\n"); | |||||
fprintf(STDERR, " -b, --brightness=BRIGHTNESS\tBrightness of resulting image\n"); | |||||
fprintf(STDERR, " -c, --contrast=CONTRAST\tContrast of resulting image\n"); | |||||
fprintf(STDERR, " -g, --gamma=GAMMA\t\tGamma of resulting image\n"); | |||||
fprintf(STDERR, " -d, --dither=DITHER\t\tDithering algorithm to use :\n"); | |||||
$list = caca_get_dither_algorithm_list(caca_create_dither(imagecreate(1, 1))); | |||||
foreach($list as $type => $name) | |||||
{ | |||||
fprintf(STDERR, "\t\t\t%s: %s\n", $type, $name); | |||||
} | |||||
fprintf(STDERR, "Usage: %s [OPTIONS]... <IMAGE>\n", $argv[0]); | |||||
fprintf(STDERR, "Convert IMAGE to any text based available format.\n"); | |||||
fprintf(STDERR, "Example : %s -W 80 -f ansi ./caca.png\n\n", $argv[0]); | |||||
fprintf(STDERR, "Options:\n"); | |||||
fprintf(STDERR, " -h, --help\t\t\tThis help\n"); | |||||
fprintf(STDERR, " -v, --version\t\t\tVersion of the program\n"); | |||||
fprintf(STDERR, " -W, --width=WIDTH\t\tWidth of resulting image\n"); | |||||
fprintf(STDERR, " -H, --height=HEIGHT\t\tHeight of resulting image\n"); | |||||
fprintf(STDERR, " -x, --font-width=WIDTH\t\tWidth of output font\n"); | |||||
fprintf(STDERR, " -y, --font-height=HEIGHT\t\tHeight of output font\n"); | |||||
fprintf(STDERR, " -b, --brightness=BRIGHTNESS\tBrightness of resulting image\n"); | |||||
fprintf(STDERR, " -c, --contrast=CONTRAST\tContrast of resulting image\n"); | |||||
fprintf(STDERR, " -g, --gamma=GAMMA\t\tGamma of resulting image\n"); | |||||
fprintf(STDERR, " -d, --dither=DITHER\t\tDithering algorithm to use :\n"); | |||||
$list = caca_get_dither_algorithm_list(caca_create_dither(imagecreate(1, 1))); | |||||
foreach($list as $type => $name) | |||||
{ | |||||
fprintf(STDERR, "\t\t\t%s: %s\n", $type, $name); | |||||
} | |||||
fprintf(STDERR, " -f, --format=FORMAT\t\tFormat of the resulting image :\n"); | |||||
$list = caca_get_export_list(); | |||||
foreach($list as $type => $name) | |||||
{ | |||||
fprintf(STDERR, "\t\t\t%s: %s\n", $type, $name); | |||||
} | |||||
fprintf(STDERR, " -f, --format=FORMAT\t\tFormat of the resulting image :\n"); | |||||
$list = caca_get_export_list(); | |||||
foreach($list as $type => $name) | |||||
{ | |||||
fprintf(STDERR, "\t\t\t%s: %s\n", $type, $name); | |||||
} | |||||
} | } | ||||
function version() | function version() | ||||
{ | { | ||||
printf( | |||||
"img2txt Copyright 2006-2007 Sam Hocevar and Jean-Yves Lamoureux\n" . | |||||
" Copyright 2008 Benjamin C. Wiley Sittler\n" . | |||||
"Internet: <sam@hocevar.net> <jylam@lnxscene.org>\n" . | |||||
" <bsittler@gmail.com> Version: %s\n" . | |||||
"\n" . | |||||
"img2txt, along with its documentation, may be freely copied and distributed.\n" . | |||||
"\n" . | |||||
"The latest version of img2txt is available from the web site,\n" . | |||||
" http://caca.zoy.org/wiki/libcaca in the libcaca package.\n" . | |||||
"\n", | |||||
caca_get_version()); | |||||
printf( | |||||
"img2txt Copyright 2006-2007 Sam Hocevar and Jean-Yves Lamoureux\n" . | |||||
" Copyright 2008 Benjamin C. Wiley Sittler\n" . | |||||
"Internet: <sam@hocevar.net> <jylam@lnxscene.org>\n" . | |||||
" <bsittler@gmail.com> Version: %s\n" . | |||||
"\n" . | |||||
"img2txt, along with its documentation, may be freely copied and distributed.\n" . | |||||
"\n" . | |||||
"The latest version of img2txt is available from the web site,\n" . | |||||
" http://caca.zoy.org/wiki/libcaca in the libcaca package.\n" . | |||||
"\n", | |||||
caca_get_version()); | |||||
} | } | ||||
function main() | function main() | ||||
{ | { | ||||
global $argc, $argv; | |||||
$cols = 0; | |||||
$lines = 0; | |||||
$font_width = 6; | |||||
$font_height = 10; | |||||
$format = NULL; | |||||
$dither = NULL; | |||||
$gamma = $brightness = $contrast = -1.0; | |||||
global $argc, $argv; | |||||
$cols = 0; | |||||
$lines = 0; | |||||
$font_width = 6; | |||||
$font_height = 10; | |||||
$format = NULL; | |||||
$dither = NULL; | |||||
$gamma = $brightness = $contrast = -1.0; | |||||
$long_options = array( | |||||
"width:" => 'W', | |||||
"height:" => 'H', | |||||
"font-width:" => 'x', | |||||
"font-height:" => 'y', | |||||
"format:" => 'f', | |||||
"dither:" => 'd', | |||||
"gamma:" => 'g', | |||||
"brightness:" => 'b', | |||||
"contrast:" => 'c', | |||||
"help" => 'h', | |||||
"version" => 'v' | |||||
); | |||||
$long_options = array( | |||||
"width:" => 'W', | |||||
"height:" => 'H', | |||||
"font-width:" => 'x', | |||||
"font-height:" => 'y', | |||||
"format:" => 'f', | |||||
"dither:" => 'd', | |||||
"gamma:" => 'g', | |||||
"brightness:" => 'b', | |||||
"contrast:" => 'c', | |||||
"help" => 'h', | |||||
"version" => 'v' | |||||
); | |||||
try { | |||||
while($opt_and_arg = mygetopt("W:H:f:d:g:b:c:hvx:y:", array_keys($long_options))) | |||||
{ | |||||
$opt = $opt_and_arg[0]; | |||||
$arg = $opt_and_arg[1]; | |||||
if((substr($opt, 0, 2) == '--') | |||||
&& | |||||
array_key_exists(substr($opt, strlen('--')) . (($arg !== NULL) ? ':' : ''), $long_options)) | |||||
{ | |||||
$opt = '-' . $long_options[substr($opt, strlen('--')) . (($arg !== NULL) ? ':' : '')]; | |||||
} | |||||
switch($opt) | |||||
{ | |||||
case '-W': /* --width */ | |||||
$cols = intval($arg); | |||||
break; | |||||
case '-H': /* --height */ | |||||
$lines = intval($arg); | |||||
break; | |||||
case '-x': /* --width */ | |||||
$font_width = intval($arg); | |||||
break; | |||||
case '-y': /* --height */ | |||||
$font_height = intval($arg); | |||||
break; | |||||
case '-f': /* --format */ | |||||
$format = $arg; | |||||
break; | |||||
case '-d': /* --dither */ | |||||
$dither = $arg; | |||||
break; | |||||
case '-g': /* --gamma */ | |||||
$gamma = floatval($arg); | |||||
break; | |||||
case '-b': /* --brightness */ | |||||
$brightness = floatval($arg); | |||||
break; | |||||
case '-c': /* --contrast */ | |||||
$contrast = floatval($arg); | |||||
break; | |||||
case '-h': /* --help */ | |||||
usage($argc, $argv); | |||||
return 0; | |||||
case '-v': /* --version */ | |||||
version(); | |||||
return 0; | |||||
default: | |||||
return 1; | |||||
} | |||||
} | |||||
} | |||||
catch (MygetoptException $e) | |||||
{ | |||||
fprintf(STDERR, "%s", $argv[0] . ": " . $e->getMessage() . "\n"); | |||||
usage($argc, $argv); | |||||
return 2; | |||||
} | |||||
try { | |||||
while($opt_and_arg = mygetopt("W:H:f:d:g:b:c:hvx:y:", array_keys($long_options))) | |||||
{ | |||||
$opt = $opt_and_arg[0]; | |||||
$arg = $opt_and_arg[1]; | |||||
if((substr($opt, 0, 2) == '--') | |||||
&& | |||||
array_key_exists(substr($opt, strlen('--')) . (($arg !== NULL) ? ':' : ''), $long_options)) | |||||
{ | |||||
$opt = '-' . $long_options[substr($opt, strlen('--')) . (($arg !== NULL) ? ':' : '')]; | |||||
} | |||||
switch($opt) | |||||
{ | |||||
case '-W': /* --width */ | |||||
$cols = intval($arg); | |||||
break; | |||||
case '-H': /* --height */ | |||||
$lines = intval($arg); | |||||
break; | |||||
case '-x': /* --width */ | |||||
$font_width = intval($arg); | |||||
break; | |||||
case '-y': /* --height */ | |||||
$font_height = intval($arg); | |||||
break; | |||||
case '-f': /* --format */ | |||||
$format = $arg; | |||||
break; | |||||
case '-d': /* --dither */ | |||||
$dither = $arg; | |||||
break; | |||||
case '-g': /* --gamma */ | |||||
$gamma = floatval($arg); | |||||
break; | |||||
case '-b': /* --brightness */ | |||||
$brightness = floatval($arg); | |||||
break; | |||||
case '-c': /* --contrast */ | |||||
$contrast = floatval($arg); | |||||
break; | |||||
case '-h': /* --help */ | |||||
usage($argc, $argv); | |||||
return 0; | |||||
case '-v': /* --version */ | |||||
version(); | |||||
return 0; | |||||
default: | |||||
return 1; | |||||
} | |||||
} | |||||
} | |||||
catch (MygetoptException $e) | |||||
{ | |||||
fprintf(STDERR, "%s", $argv[0] . ": " . $e->getMessage() . "\n"); | |||||
usage($argc, $argv); | |||||
return 2; | |||||
} | |||||
if($argc != 2) | |||||
{ | |||||
fprintf(STDERR, "%s: wrong argument count\n", $argv[0]); | |||||
usage($argc, $argv); | |||||
return 1; | |||||
} | |||||
if($argc != 2) | |||||
{ | |||||
fprintf(STDERR, "%s: wrong argument count\n", $argv[0]); | |||||
usage($argc, $argv); | |||||
return 1; | |||||
} | |||||
$cv = caca_create_canvas(0, 0); | |||||
if(!$cv) | |||||
{ | |||||
fprintf(STDERR, "%s: unable to initialise libcaca\n", $argv[0]); | |||||
return 1; | |||||
} | |||||
$cv = caca_create_canvas(0, 0); | |||||
if(!$cv) | |||||
{ | |||||
fprintf(STDERR, "%s: unable to initialise libcaca\n", $argv[0]); | |||||
return 1; | |||||
} | |||||
$i_str = file_get_contents($argv[$argc-1]); | |||||
$i = $i_str ? imagecreatefromstring($i_str) : NULL; | |||||
if(!$i) | |||||
{ | |||||
fprintf(STDERR, "%s: unable to load %s\n", $argv[0], $argv[$argc-1]); | |||||
return 1; | |||||
} | |||||
$i_str = file_get_contents($argv[$argc-1]); | |||||
$i = $i_str ? imagecreatefromstring($i_str) : NULL; | |||||
if(!$i) | |||||
{ | |||||
fprintf(STDERR, "%s: unable to load %s\n", $argv[0], $argv[$argc-1]); | |||||
return 1; | |||||
} | |||||
/* Assume a 6×10 font */ | |||||
if(!$cols && !$lines) | |||||
{ | |||||
$cols = 60; | |||||
$lines = $cols * imagesy($i) * $font_width / imagesx($i) / $font_height; | |||||
} | |||||
else if($cols && !$lines) | |||||
{ | |||||
$lines = $cols * imagesy($i) * $font_width / imagesx($i) / $font_height; | |||||
} | |||||
else if(!$cols && $lines) | |||||
{ | |||||
$cols = $lines * imagesx($i) * $font_height / imagesy($i) / $font_width; | |||||
} | |||||
/* Assume a 6×10 font */ | |||||
if(!$cols && !$lines) | |||||
{ | |||||
$cols = 60; | |||||
$lines = $cols * imagesy($i) * $font_width / imagesx($i) / $font_height; | |||||
} | |||||
else if($cols && !$lines) | |||||
{ | |||||
$lines = $cols * imagesy($i) * $font_width / imagesx($i) / $font_height; | |||||
} | |||||
else if(!$cols && $lines) | |||||
{ | |||||
$cols = $lines * imagesx($i) * $font_height / imagesy($i) / $font_width; | |||||
} | |||||
caca_set_canvas_size($cv, $cols, $lines); | |||||
caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||||
caca_clear_canvas($cv); | |||||
$i_dither = caca_create_dither($i); | |||||
if(! caca_set_dither_algorithm($i_dither, $dither?$dither:"fstein")) | |||||
{ | |||||
fprintf(STDERR, "%s: Can't dither image with algorithm '%s'\n", $argv[0], $dither?$dither:"fstein"); | |||||
return -1; | |||||
} | |||||
caca_set_canvas_size($cv, $cols, $lines); | |||||
caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||||
caca_clear_canvas($cv); | |||||
$i_dither = caca_create_dither($i); | |||||
if(! caca_set_dither_algorithm($i_dither, $dither?$dither:"fstein")) | |||||
{ | |||||
fprintf(STDERR, "%s: Can't dither image with algorithm '%s'\n", $argv[0], $dither?$dither:"fstein"); | |||||
return -1; | |||||
} | |||||
if($brightness!=-1) caca_set_dither_brightness ($i_dither, $brightness); | |||||
if($contrast!=-1) caca_set_dither_contrast ($i_dither, $contrast); | |||||
if($gamma!=-1) caca_set_dither_gamma ($i_dither, $gamma); | |||||
if($brightness!=-1) caca_set_dither_brightness ($i_dither, $brightness); | |||||
if($contrast!=-1) caca_set_dither_contrast ($i_dither, $contrast); | |||||
if($gamma!=-1) caca_set_dither_gamma ($i_dither, $gamma); | |||||
caca_dither_bitmap($cv, 0, 0, $cols, $lines, $i_dither, $i); | |||||
caca_dither_bitmap($cv, 0, 0, $cols, $lines, $i_dither, $i); | |||||
$export = caca_export_string($cv, $format?$format:"ansi"); | |||||
if(!$export) | |||||
{ | |||||
fprintf(STDERR, "%s: Can't export to format '%s'\n", $argv[0], $format?$format:"ansi"); | |||||
return -1; | |||||
} | |||||
else | |||||
{ | |||||
echo $export; | |||||
} | |||||
$export = caca_export_string($cv, $format?$format:"ansi"); | |||||
if(!$export) | |||||
{ | |||||
fprintf(STDERR, "%s: Can't export to format '%s'\n", $argv[0], $format?$format:"ansi"); | |||||
return -1; | |||||
} | |||||
else | |||||
{ | |||||
echo $export; | |||||
} | |||||
return 0; | |||||
return 0; | |||||
} | } | ||||
exit(main()); | exit(main()); | ||||
?> | ?> |
@@ -5,12 +5,10 @@ | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/import.c" | * This file is a Php port of "examples/import.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -19,36 +17,36 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
$imports = caca_get_import_list(); | $imports = caca_get_import_list(); | ||||
if($argc < 2 || $argc > 3) | if($argc < 2 || $argc > 3) | ||||
{ | { | ||||
$msg = ($argv[0] . ": wrong argument count\n" . | |||||
"usage: " . $argv[0] . " file [<format>]\n" . | |||||
"where <format> is one of:\n"); | |||||
foreach($imports as $format => $name) | |||||
$msg .= " \"" . $name . "\" (" . $format . ")\n"; | |||||
die($msg); | |||||
$msg = ($argv[0] . ": wrong argument count\n" . | |||||
"usage: " . $argv[0] . " file [<format>]\n" . | |||||
"where <format> is one of:\n"); | |||||
foreach($imports as $format => $name) | |||||
$msg .= " \"" . $name . "\" (" . $format . ")\n"; | |||||
die($msg); | |||||
} | } | ||||
$cv = caca_create_canvas(0, 0); | $cv = caca_create_canvas(0, 0); | ||||
if(! $cv) | if(! $cv) | ||||
{ | { | ||||
die("Can't create canvas\n"); | |||||
die("Can't create canvas\n"); | |||||
} | } | ||||
if(caca_import_file($cv, $argv[1], $argc >= 3 ? $argv[2] : "") < 0) | if(caca_import_file($cv, $argv[1], $argc >= 3 ? $argv[2] : "") < 0) | ||||
{ | { | ||||
die($argv[0] . ": could not open `" . $argv[1] . "'.\n"); | |||||
die($argv[0] . ": could not open `" . $argv[1] . "'.\n"); | |||||
} | } | ||||
$dp = caca_create_display($cv); | $dp = caca_create_display($cv); | ||||
if(! $dp) | if(! $dp) | ||||
{ | { | ||||
die("Can't create display\n"); | |||||
die("Can't create display\n"); | |||||
} | } | ||||
caca_refresh_display($dp); | caca_refresh_display($dp); | ||||
@@ -12,42 +12,42 @@ | |||||
*/ | */ | ||||
function transform($tbl, $tx, $ty, $sx, $sy) { | function transform($tbl, $tx, $ty, $sx, $sy) { | ||||
$result = array(); | |||||
foreach($tbl as $pt) | |||||
$result[] = array($pt[0] * $sx + $tx, $pt[1] * $sy + $ty); | |||||
return $result; | |||||
$result = array(); | |||||
foreach($tbl as $pt) | |||||
$result[] = array($pt[0] * $sx + $tx, $pt[1] * $sy + $ty); | |||||
return $result; | |||||
} | } | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
$canvas = caca_create_canvas(0, 0); | $canvas = caca_create_canvas(0, 0); | ||||
$display = caca_create_display($canvas); | $display = caca_create_display($canvas); | ||||
if (!$display) { | if (!$display) { | ||||
die("Error while attaching canvas to display\n"); | |||||
die("Error while attaching canvas to display\n"); | |||||
} | } | ||||
$tbl = array( | $tbl = array( | ||||
array(5, 2), | |||||
array(15, 2), | |||||
array(20, 4), | |||||
array(25, 2), | |||||
array(34, 2), | |||||
array(37, 4), | |||||
array(36, 9), | |||||
array(20, 16), | |||||
array(3, 9), | |||||
array(2, 4), | |||||
array(5, 2) | |||||
array(5, 2), | |||||
array(15, 2), | |||||
array(20, 4), | |||||
array(25, 2), | |||||
array(34, 2), | |||||
array(37, 4), | |||||
array(36, 9), | |||||
array(20, 16), | |||||
array(3, 9), | |||||
array(2, 4), | |||||
array(5, 2) | |||||
); | ); | ||||
for ($i = 0; $i < 10; $i++) { | for ($i = 0; $i < 10; $i++) { | ||||
caca_set_color_ansi($canvas, 1 + (($color += 4) % 15), CACA_TRANSPARENT); | |||||
$scale = caca_rand(4, 10) / 10; | |||||
$translate = array(caca_rand(-5, 55), caca_rand(-2, 25)); | |||||
$pts = transform($tbl, $translate[0], $translate[1], $scale, $scale); | |||||
caca_draw_thin_polyline($canvas, $pts); | |||||
caca_set_color_ansi($canvas, 1 + (($color += 4) % 15), CACA_TRANSPARENT); | |||||
$scale = caca_rand(4, 10) / 10; | |||||
$translate = array(caca_rand(-5, 55), caca_rand(-2, 25)); | |||||
$pts = transform($tbl, $translate[0], $translate[1], $scale, $scale); | |||||
caca_draw_thin_polyline($canvas, $pts); | |||||
} | } | ||||
caca_put_str($canvas, 1, 1, "Caca forever..."); | caca_put_str($canvas, 1, 1, "Caca forever..."); | ||||
@@ -2,24 +2,24 @@ | |||||
<? | <? | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
$pig_str = <<<EOT | $pig_str = <<<EOT | ||||
_._ _..._ .-', _.._(`)) | |||||
'-. ` ' /-._.-' ',/ | |||||
) \ '. | |||||
/ _ _ | \ | |||||
| a a / PHP | | |||||
\ .-. ; | |||||
'-('' ).-' ,' ; | |||||
'-; | .' | |||||
\ \ / | |||||
| 7 .__ _.-\ \ | |||||
| | | ``/ /` / | |||||
jgs /,_| | /,_/ / | |||||
/,_/ '`-' | |||||
_._ _..._ .-', _.._(`)) | |||||
'-. ` ' /-._.-' ',/ | |||||
) \ '. | |||||
/ _ _ | \ | |||||
| a a / PHP | | |||||
\ .-. ; | |||||
'-('' ).-' ,' ; | |||||
'-; | .' | |||||
\ \ / | |||||
| 7 .__ _.-\ \ | |||||
| | | ``/ /` / | |||||
jgs /,_| | /,_/ / | |||||
/,_/ '`-' | |||||
EOT; | EOT; | ||||
$canvas = caca_create_canvas(0, 0); | $canvas = caca_create_canvas(0, 0); | ||||
@@ -10,8 +10,6 @@ | |||||
* 2007 Sam Hocevar <sam@hocevar.net> | * 2007 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -20,127 +18,127 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
include dirname($argv[0]) . '/../caca.php'; | include dirname($argv[0]) . '/../caca.php'; | ||||
class DemoCanvas extends Canvas | class DemoCanvas extends Canvas | ||||
{ | { | ||||
private $image; | |||||
private $startTime; | |||||
private $d; | |||||
private $scroll; | |||||
function __construct() | |||||
{ | |||||
parent::__construct(); | |||||
$this->startTime = gettimeofday(true); | |||||
$message = " --- POWERED BY LIBCACA --- OLDSCHOOL TEXT EFFECTS ARE 100% PURE WIN"; | |||||
$this->scroll = new Canvas(strlen($message), 1); | |||||
$this->scroll->setColorAnsi(AnsiColor::WHITE, AnsiColor::TRANSPARENT); | |||||
$this->scroll->putStr(0, 0, $message); | |||||
$fontList = Font::getList(); | |||||
$f = new Font($fontList[1]); | |||||
$w = $f->getWidth() * strlen($message); | |||||
$h = $f->getHeight(); | |||||
$this->image = imagecreatetruecolor($w, $h); | |||||
imagealphablending($this->image, false); | |||||
imagesavealpha($this->image, true); | |||||
$this->d = new Dither($this->image); | |||||
$f->Render($this->scroll, $this->image); | |||||
} | |||||
function Draw() | |||||
{ | |||||
$barCount = 6; | |||||
$t = (gettimeofday(true) - $this->startTime) * 1000; | |||||
$this->Clear(); | |||||
$this->setColorAnsi(AnsiColor::WHITE, AnsiColor::BLACK); | |||||
for($i = 0; $i < $barCount; $i++) | |||||
{ | |||||
$v = ((sin(($t / 500.0) | |||||
+ (1.0 * $i / $barCount)) + 1) / 2) * $this->getHeight(); | |||||
$p1_x = 0; $p1_y = intval($v); | |||||
$p2_x = $this->getWidth() - 1; $p2_y = intval($v); | |||||
$this->setColorAnsi(($i + 9), AnsiColor::BLACK); | |||||
/* drawLine is already clipped, we don't care about overflows */ | |||||
$this->drawLine($p1_x + 0, $p1_y - 2, $p2_x + 0, $p2_y - 2, ord('-')); | |||||
$this->drawLine($p1_x + 0, $p1_y - 1, $p2_x + 0, $p2_y - 1, ord('*')); | |||||
$this->drawLine($p1_x, $p1_y, $p2_x, $p2_y, ord('#')); | |||||
$this->drawLine($p1_x + 0, $p1_y + 1, $p2_x + 0, $p2_y + 1, ord('*')); | |||||
$this->drawLine($p1_x + 0, $p1_y + 2, $p2_x + 0, $p2_y + 2, ord('-')); | |||||
} | |||||
$w = $this->getWidth(); | |||||
$h = $this->getHeight(); | |||||
$x = intval(($t / 10) % (12 * $w)); | |||||
$y = intval($h * (2.0 + sin($t / 200.0)) / 4); | |||||
$this->d->bitmap($this, - $x, $h / 2 - $y, $w * 12, $y * 2); | |||||
$this->d->bitmap($this, 12 * $w - $x, $h / 2 - $y, $w * 12, $y * 2); | |||||
$this->setColorAnsi(AnsiColor::WHITE, AnsiColor::BLUE); | |||||
$this->putStr($this->getWidth() - 30, $this->getHeight() - 2, " -=[ Powered by libcaca ]=- "); | |||||
$this->setColorAnsi(AnsiColor::WHITE, AnsiColor::BLACK); | |||||
} | |||||
private $image; | |||||
private $startTime; | |||||
private $d; | |||||
private $scroll; | |||||
function __construct() | |||||
{ | |||||
parent::__construct(); | |||||
$this->startTime = gettimeofday(true); | |||||
$message = " --- POWERED BY LIBCACA --- OLDSCHOOL TEXT EFFECTS ARE 100% PURE WIN"; | |||||
$this->scroll = new Canvas(strlen($message), 1); | |||||
$this->scroll->setColorAnsi(AnsiColor::WHITE, AnsiColor::TRANSPARENT); | |||||
$this->scroll->putStr(0, 0, $message); | |||||
$fontList = Font::getList(); | |||||
$f = new Font($fontList[1]); | |||||
$w = $f->getWidth() * strlen($message); | |||||
$h = $f->getHeight(); | |||||
$this->image = imagecreatetruecolor($w, $h); | |||||
imagealphablending($this->image, false); | |||||
imagesavealpha($this->image, true); | |||||
$this->d = new Dither($this->image); | |||||
$f->Render($this->scroll, $this->image); | |||||
} | |||||
function Draw() | |||||
{ | |||||
$barCount = 6; | |||||
$t = (gettimeofday(true) - $this->startTime) * 1000; | |||||
$this->Clear(); | |||||
$this->setColorAnsi(AnsiColor::WHITE, AnsiColor::BLACK); | |||||
for($i = 0; $i < $barCount; $i++) | |||||
{ | |||||
$v = ((sin(($t / 500.0) | |||||
+ (1.0 * $i / $barCount)) + 1) / 2) * $this->getHeight(); | |||||
$p1_x = 0; $p1_y = intval($v); | |||||
$p2_x = $this->getWidth() - 1; $p2_y = intval($v); | |||||
$this->setColorAnsi(($i + 9), AnsiColor::BLACK); | |||||
/* drawLine is already clipped, we don't care about overflows */ | |||||
$this->drawLine($p1_x + 0, $p1_y - 2, $p2_x + 0, $p2_y - 2, ord('-')); | |||||
$this->drawLine($p1_x + 0, $p1_y - 1, $p2_x + 0, $p2_y - 1, ord('*')); | |||||
$this->drawLine($p1_x, $p1_y, $p2_x, $p2_y, ord('#')); | |||||
$this->drawLine($p1_x + 0, $p1_y + 1, $p2_x + 0, $p2_y + 1, ord('*')); | |||||
$this->drawLine($p1_x + 0, $p1_y + 2, $p2_x + 0, $p2_y + 2, ord('-')); | |||||
} | |||||
$w = $this->getWidth(); | |||||
$h = $this->getHeight(); | |||||
$x = intval(($t / 10) % (12 * $w)); | |||||
$y = intval($h * (2.0 + sin($t / 200.0)) / 4); | |||||
$this->d->bitmap($this, - $x, $h / 2 - $y, $w * 12, $y * 2); | |||||
$this->d->bitmap($this, 12 * $w - $x, $h / 2 - $y, $w * 12, $y * 2); | |||||
$this->setColorAnsi(AnsiColor::WHITE, AnsiColor::BLUE); | |||||
$this->putStr($this->getWidth() - 30, $this->getHeight() - 2, " -=[ Powered by libcaca ]=- "); | |||||
$this->setColorAnsi(AnsiColor::WHITE, AnsiColor::BLACK); | |||||
} | |||||
} | } | ||||
class DemoDisplay extends Display | class DemoDisplay extends Display | ||||
{ | { | ||||
private $cv; | |||||
function __construct(DemoCanvas $_cv) | |||||
{ | |||||
parent::__construct($_cv); | |||||
$this->setTitle("libcaca PHP Bindings test suite"); | |||||
$this->setDisplayTime(20000); // Refresh every 20 ms | |||||
$this->cv = $_cv; | |||||
} | |||||
function EventLoop() | |||||
{ | |||||
while(! ($ev = $this->getEvent(EventType::KEY_RELEASE, 10))) | |||||
{ | |||||
$this->cv->Draw(); | |||||
$this->Refresh(); | |||||
} | |||||
if($ev->getKeyCh() > 0x20 && $ev->getKeyCh() < 0x7f) | |||||
printf("Key pressed: %c\n", $ev->getKeyCh()); | |||||
else | |||||
printf("Key pressed: 0x%x\n", $ev->getKeyCh()); | |||||
} | |||||
private $cv; | |||||
function __construct(DemoCanvas $_cv) | |||||
{ | |||||
parent::__construct($_cv); | |||||
$this->setTitle("libcaca PHP Bindings test suite"); | |||||
$this->setDisplayTime(20000); // Refresh every 20 ms | |||||
$this->cv = $_cv; | |||||
} | |||||
function EventLoop() | |||||
{ | |||||
while(! ($ev = $this->getEvent(EventType::KEY_RELEASE, 10))) | |||||
{ | |||||
$this->cv->Draw(); | |||||
$this->Refresh(); | |||||
} | |||||
if($ev->getKeyCh() > 0x20 && $ev->getKeyCh() < 0x7f) | |||||
printf("Key pressed: %c\n", $ev->getKeyCh()); | |||||
else | |||||
printf("Key pressed: 0x%x\n", $ev->getKeyCh()); | |||||
} | |||||
} | } | ||||
class Test | class Test | ||||
{ | { | ||||
static function Main() | |||||
{ | |||||
printf("libcaca %s PHP test\n", Libcaca::getVersion()); | |||||
printf("(c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>\n"); | |||||
printf("(c) 2007 Sam Hocevar <sam@hocevar.net>\n"); | |||||
printf("(c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com>\n"); | |||||
static function Main() | |||||
{ | |||||
printf("libcaca %s PHP test\n", Libcaca::getVersion()); | |||||
printf("(c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>\n"); | |||||
printf("(c) 2007 Sam Hocevar <sam@hocevar.net>\n"); | |||||
printf("(c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com>\n"); | |||||
/* Instanciate a caca canvas */ | |||||
$cv = new DemoCanvas(); | |||||
/* Instanciate a caca canvas */ | |||||
$cv = new DemoCanvas(); | |||||
/* We have a proper canvas, let's display it using Caca */ | |||||
$dp = new DemoDisplay($cv); | |||||
/* We have a proper canvas, let's display it using Caca */ | |||||
$dp = new DemoDisplay($cv); | |||||
/* Random number. This is a static method, | |||||
not to be used with previous instance */ | |||||
printf("A random number: %d\n", Libcaca::Rand(0, 1337)); | |||||
/* Random number. This is a static method, | |||||
not to be used with previous instance */ | |||||
printf("A random number: %d\n", Libcaca::Rand(0, 1337)); | |||||
$dp->EventLoop(); | |||||
} | |||||
$dp->EventLoop(); | |||||
} | |||||
} | } | ||||
Test::Main(); | Test::Main(); | ||||
@@ -4,8 +4,8 @@ | |||||
* demo.php demo for libcaca php binding | * demo.php demo for libcaca php binding | ||||
* Copyright (c) 2008 Nicolas Vion <nico@yojik.eu> | * Copyright (c) 2008 Nicolas Vion <nico@yojik.eu> | ||||
* | * | ||||
* This file is a Php port of the official libcaca's sample program "demo.c" | |||||
* which is: | |||||
* This file is a Php port of the official libcaca's sample program "demo.c" | |||||
* which is: | |||||
* Copyright (c) 2003 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2003 Sam Hocevar <sam@hocevar.net> | ||||
* | * | ||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
@@ -16,27 +16,27 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
$string = <<<EOT | $string = <<<EOT | ||||
|_| | |||||
_,----._ | | | |||||
(/ @ @ \) __ | |||||
| OO | |_ | |||||
\ `--' / |__ | |||||
`----' | |||||
|_| | |||||
Hello world! | | |||||
|_| | |||||
_,----._ | | | |||||
(/ @ @ \) __ | |||||
| OO | |_ | |||||
\ `--' / |__ | |||||
`----' | |||||
|_| | |||||
Hello world! | | |||||
EOT; | EOT; | ||||
$pig = caca_create_canvas(0, 0); | $pig = caca_create_canvas(0, 0); | ||||
caca_import_string($pig, $string, "text"); | caca_import_string($pig, $string, "text"); | ||||
$cv = caca_create_canvas(caca_get_canvas_width($pig) * 2, caca_get_canvas_height($pig) * 2); | $cv = caca_create_canvas(caca_get_canvas_width($pig) * 2, caca_get_canvas_height($pig) * 2); | ||||
if (!$cv or !$pig) { | if (!$cv or !$pig) { | ||||
die("Can't created canvas\n"); | |||||
die("Can't created canvas\n"); | |||||
} | } | ||||
caca_blit($cv, 0, 0, $pig); | caca_blit($cv, 0, 0, $pig); | ||||
@@ -50,12 +50,12 @@ caca_rotate_180($pig); | |||||
caca_blit($cv, caca_get_canvas_width($pig), caca_get_canvas_height($pig), $pig); | caca_blit($cv, caca_get_canvas_width($pig), caca_get_canvas_height($pig), $pig); | ||||
for($j = 0; $j < caca_get_canvas_height($cv); $j++) { | for($j = 0; $j < caca_get_canvas_height($cv); $j++) { | ||||
for($i = 0; $i < caca_get_canvas_width($cv); $i += 2) { | |||||
caca_set_color_ansi($cv, CACA_LIGHTBLUE + ($i + $j) % 6, CACA_DEFAULT); | |||||
$a = caca_get_attr($cv, -1, -1); | |||||
caca_put_attr($cv, $i, $j, $a); | |||||
caca_put_attr($cv, $i + 1, $j, $a); | |||||
} | |||||
for($i = 0; $i < caca_get_canvas_width($cv); $i += 2) { | |||||
caca_set_color_ansi($cv, CACA_LIGHTBLUE + ($i + $j) % 6, CACA_DEFAULT); | |||||
$a = caca_get_attr($cv, -1, -1); | |||||
caca_put_attr($cv, $i, $j, $a); | |||||
caca_put_attr($cv, $i + 1, $j, $a); | |||||
} | |||||
} | } | ||||
echo caca_export_string($cv, "utf8"); | echo caca_export_string($cv, "utf8"); | ||||
@@ -5,12 +5,10 @@ | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/transform.c" | * This file is a Php port of "examples/transform.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -19,33 +17,33 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
$pig = ( | $pig = ( | ||||
",--. ,--.\n" . | |||||
"\\ /-~-\\ /\n" . | |||||
" )' o O `(\n" . | |||||
"( ,---. )\n" . | |||||
" `(_o_o_)'\n" . | |||||
" )`-'(\n"); | |||||
",--. ,--.\n" . | |||||
"\\ /-~-\\ /\n" . | |||||
" )' o O `(\n" . | |||||
"( ,---. )\n" . | |||||
" `(_o_o_)'\n" . | |||||
" )`-'(\n"); | |||||
$duck = ( | $duck = ( | ||||
" ,~~.\n" . | |||||
" __ , ( O )>\n" . | |||||
"___( o)> )`~~' (\n" . | |||||
"\\ <_. ) ( .__) )\n" . | |||||
" `---' `-.____,'\n"); | |||||
" ,~~.\n" . | |||||
" __ , ( O )>\n" . | |||||
"___( o)> )`~~' (\n" . | |||||
"\\ <_. ) ( .__) )\n" . | |||||
" `---' `-.____,'\n"); | |||||
$cv = caca_create_canvas(0, 0); | $cv = caca_create_canvas(0, 0); | ||||
if(! $cv) | if(! $cv) | ||||
{ | { | ||||
die("Can't created canvas\n"); | |||||
die("Can't created canvas\n"); | |||||
} | } | ||||
$dp = caca_create_display($cv); | $dp = caca_create_display($cv); | ||||
if(! $dp) | if(! $dp) | ||||
{ | { | ||||
die("Can't create display\n"); | |||||
die("Can't create display\n"); | |||||
} | } | ||||
$image = caca_create_canvas(70, 6); | $image = caca_create_canvas(70, 6); | ||||
@@ -1,15 +1,13 @@ | |||||
#!/usr/bin/php5 | #!/usr/bin/php5 | ||||
<?php | <?php | ||||
/* | /* | ||||
* truecolor truecolor canvas features | |||||
* truecolor truecolor canvas features | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/truecolor.c" | * This file is a Php port of "examples/truecolor.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | |||||
* | |||||
* $Id$ | |||||
* All Rights Reserved | |||||
* | * | ||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
@@ -19,28 +17,28 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
$cv = caca_create_canvas(32, 16); | $cv = caca_create_canvas(32, 16); | ||||
if(!$cv) { | if(!$cv) { | ||||
die("Failed to create canvas\n"); | |||||
die("Failed to create canvas\n"); | |||||
} | } | ||||
$dp = caca_create_display($cv); | $dp = caca_create_display($cv); | ||||
if(!$dp) { | if(!$dp) { | ||||
die("Failed to create display\n"); | |||||
die("Failed to create display\n"); | |||||
} | } | ||||
for($y = 0; $y < 16; $y++) | for($y = 0; $y < 16; $y++) | ||||
for($x = 0; $x < 16; $x++) | |||||
{ | |||||
$bgcolor = 0xff00 | ($y << 4) | $x; | |||||
$fgcolor = 0xf000 | ((15 - $y) << 4) | ((15 - $x) << 8); | |||||
caca_set_color_argb($cv, $fgcolor, $bgcolor); | |||||
caca_put_str($cv, $x * 2, $y, "CA"); | |||||
} | |||||
for($x = 0; $x < 16; $x++) | |||||
{ | |||||
$bgcolor = 0xff00 | ($y << 4) | $x; | |||||
$fgcolor = 0xf000 | ((15 - $y) << 4) | ((15 - $x) << 8); | |||||
caca_set_color_argb($cv, $fgcolor, $bgcolor); | |||||
caca_put_str($cv, $x * 2, $y, "CA"); | |||||
} | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE); | caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE); | ||||
caca_put_str($cv, 2, 1, " truecolor libcaca "); | caca_put_str($cv, 2, 1, " truecolor libcaca "); | ||||
@@ -5,12 +5,10 @@ | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/unicode.c" | * This file is a Php port of "examples/unicode.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -19,18 +17,18 @@ | |||||
*/ | */ | ||||
if (php_sapi_name() != "cli") { | if (php_sapi_name() != "cli") { | ||||
die("You have to run this program with php-cli!\n"); | |||||
die("You have to run this program with php-cli!\n"); | |||||
} | } | ||||
$cv = caca_create_canvas(0, 0); | $cv = caca_create_canvas(0, 0); | ||||
if(! $cv) | if(! $cv) | ||||
{ | { | ||||
die("Can't created canvas\n"); | |||||
die("Can't created canvas\n"); | |||||
} | } | ||||
$dp = caca_create_display($cv); | $dp = caca_create_display($cv); | ||||
if(! $dp) | if(! $dp) | ||||
{ | { | ||||
die("Can't create display\n"); | |||||
die("Can't create display\n"); | |||||
} | } | ||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE); | caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE); | ||||
caca_put_str($cv, 1, 1, "Basic Unicode support"); | caca_put_str($cv, 1, 1, "Basic Unicode support"); | ||||
@@ -31,33 +31,33 @@ function just_for_fun() { | |||||
$moo = <<<EOT | $moo = <<<EOT | ||||
(__) | (__) | ||||
(oo) | (oo) | ||||
/------\/ | |||||
/ | || | |||||
* /\---/\ | |||||
~~ ~~ | |||||
/------\/ | |||||
/ | || | |||||
* /\---/\ | |||||
~~ ~~ | |||||
EOT; | EOT; | ||||
$cv = caca_create_canvas(0, 0); | |||||
caca_set_color_ansi($cv, CACA_LIGHTBLUE, CACA_DEFAULT); | |||||
caca_import_string($cv, $moo, "text"); | |||||
for($j = 0; $j < caca_get_canvas_height($cv); $j++) { | |||||
for($i = 0; $i < caca_get_canvas_width($cv); $i += 2) { | |||||
caca_set_color_ansi($cv, (caca_rand(1, 10) > 5 ? CACA_LIGHTBLUE : CACA_WHITE), CACA_DEFAULT); | |||||
$a = caca_get_attr($cv, -1, -1); | |||||
caca_put_attr($cv, $i, $j, $a); | |||||
caca_put_attr($cv, $i + 1, $j, $a); | |||||
} | |||||
} | |||||
caca_set_canvas_size($cv, 18, 6); | |||||
caca_set_color_ansi($cv, CACA_LIGHTGREEN, CACA_DEFAULT); | |||||
caca_put_str($cv, 14, 0, "Moo!"); | |||||
caca_set_color_ansi($cv, CACA_LIGHTRED, CACA_DEFAULT); | |||||
caca_put_char($cv, 14, 1, hexdec("2765")); //U+2765 | |||||
caca_put_char($cv, 16, 1, hexdec("2764")); //U+2764 | |||||
echo caca_export_string($cv, "html3"); | |||||
$cv = caca_create_canvas(0, 0); | |||||
caca_set_color_ansi($cv, CACA_LIGHTBLUE, CACA_DEFAULT); | |||||
caca_import_string($cv, $moo, "text"); | |||||
for($j = 0; $j < caca_get_canvas_height($cv); $j++) { | |||||
for($i = 0; $i < caca_get_canvas_width($cv); $i += 2) { | |||||
caca_set_color_ansi($cv, (caca_rand(1, 10) > 5 ? CACA_LIGHTBLUE : CACA_WHITE), CACA_DEFAULT); | |||||
$a = caca_get_attr($cv, -1, -1); | |||||
caca_put_attr($cv, $i, $j, $a); | |||||
caca_put_attr($cv, $i + 1, $j, $a); | |||||
} | |||||
} | |||||
caca_set_canvas_size($cv, 18, 6); | |||||
caca_set_color_ansi($cv, CACA_LIGHTGREEN, CACA_DEFAULT); | |||||
caca_put_str($cv, 14, 0, "Moo!"); | |||||
caca_set_color_ansi($cv, CACA_LIGHTRED, CACA_DEFAULT); | |||||
caca_put_char($cv, 14, 1, hexdec("2765")); //U+2765 | |||||
caca_put_char($cv, 16, 1, hexdec("2764")); //U+2764 | |||||
echo caca_export_string($cv, "html3"); | |||||
} | } | ||||
just_for_fun(); | just_for_fun(); | ||||
@@ -74,7 +74,7 @@ just_for_fun(); | |||||
<?php | <?php | ||||
$list = caca_get_display_driver_list(); | $list = caca_get_display_driver_list(); | ||||
foreach($list as $type => $name) | foreach($list as $type => $name) | ||||
echo '<li>' . htmlspecialchars("$name ($type)") . '</li>'; | |||||
echo '<li>' . htmlspecialchars("$name ($type)") . '</li>'; | |||||
?> | ?> | ||||
</ul> | </ul> | ||||
@@ -83,7 +83,7 @@ foreach($list as $type => $name) | |||||
<?php | <?php | ||||
$list = caca_get_import_list(); | $list = caca_get_import_list(); | ||||
foreach($list as $format => $name) | foreach($list as $format => $name) | ||||
echo '<li>' . htmlspecialchars("$name ($format)") . '</li>'; | |||||
echo '<li>' . htmlspecialchars("$name ($format)") . '</li>'; | |||||
?> | ?> | ||||
</ul> | </ul> | ||||
@@ -92,7 +92,7 @@ foreach($list as $format => $name) | |||||
<?php | <?php | ||||
$list = caca_get_export_list(); | $list = caca_get_export_list(); | ||||
foreach($list as $format => $name) | foreach($list as $format => $name) | ||||
echo '<li>' . htmlspecialchars("$name ($format)") . '</li>'; | |||||
echo '<li>' . htmlspecialchars("$name ($format)") . '</li>'; | |||||
?> | ?> | ||||
</ul> | </ul> | ||||
@@ -101,7 +101,7 @@ foreach($list as $format => $name) | |||||
<?php | <?php | ||||
$list = caca_get_font_list(); | $list = caca_get_font_list(); | ||||
foreach($list as $name) | foreach($list as $name) | ||||
echo '<li>' . htmlspecialchars("$name") . '</li>'; | |||||
echo '<li>' . htmlspecialchars("$name") . '</li>'; | |||||
?> | ?> | ||||
</ul> | </ul> | ||||
@@ -14,8 +14,6 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
* Copyright (c) 2003-2004 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2003-2004 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -33,21 +31,21 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
$cv = caca_create_canvas(80, 24); | $cv = caca_create_canvas(80, 24); | ||||
if(!$cv) | if(!$cv) | ||||
{ | { | ||||
die("Failed to create canvas\n"); | |||||
die("Failed to create canvas\n"); | |||||
} | } | ||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | ||||
caca_clear_canvas($cv); | caca_clear_canvas($cv); | ||||
for($i = 0; $i < 16; $i++) | for($i = 0; $i < 16; $i++) | ||||
{ | { | ||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_put_str($cv, 3, $i + ($i >= 8 ? 3 : 2), "ANSI " . $i); | |||||
for($j = 0; $j < 16; $j++) | |||||
{ | |||||
caca_set_color_ansi($cv, $i, $j); | |||||
caca_put_str($cv, ($j >= 8 ? 13 : 12) + $j * 4, $i + ($i >= 8 ? 3 : 2), | |||||
"Aaホ"); | |||||
} | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_put_str($cv, 3, $i + ($i >= 8 ? 3 : 2), "ANSI " . $i); | |||||
for($j = 0; $j < 16; $j++) | |||||
{ | |||||
caca_set_color_ansi($cv, $i, $j); | |||||
caca_put_str($cv, ($j >= 8 ? 13 : 12) + $j * 4, $i + ($i >= 8 ? 3 : 2), | |||||
"Aaホ"); | |||||
} | |||||
} | } | ||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | ||||
@@ -25,12 +25,12 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
$src = "logo-caca.png"; | $src = "logo-caca.png"; | ||||
$img = imagecreatefrompng(dirname(__FILE__)."/".$src); | $img = imagecreatefrompng(dirname(__FILE__)."/".$src); | ||||
if (!$img) { | if (!$img) { | ||||
die("Can not open image.\n"); | |||||
die("Can not open image.\n"); | |||||
} | } | ||||
$dither = caca_create_dither($img); | $dither = caca_create_dither($img); | ||||
if (!$dither) { | if (!$dither) { | ||||
die("Can not create dither. Maybe you compiled caca-php without gd support.\n"); | |||||
die("Can not create dither. Maybe you compiled caca-php without gd support.\n"); | |||||
} | } | ||||
$canvas = caca_create_canvas(100, 40); | $canvas = caca_create_canvas(100, 40); | ||||
@@ -4,12 +4,10 @@ | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/export.c" | * This file is a Php port of "examples/export.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -30,7 +28,7 @@ $format = isset($_REQUEST['format']) ? $_REQUEST['format'] : NULL; | |||||
if((! $format) || (! array_key_exists($format, $exports))) | if((! $format) || (! array_key_exists($format, $exports))) | ||||
{ | { | ||||
header("Content-type: text/html; charset=UTF-8"); | |||||
header("Content-type: text/html; charset=UTF-8"); | |||||
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||||
@@ -43,33 +41,33 @@ if((! $format) || (! array_key_exists($format, $exports))) | |||||
/*<![CDATA[*/ | /*<![CDATA[*/ | ||||
update_preview = function (select) | update_preview = function (select) | ||||
{ | { | ||||
var iframe_map = { | |||||
'html': true, | |||||
'html3': true, | |||||
'bbfr': true | |||||
}; | |||||
if (self.opera | |||||
|| | |||||
(('' + navigator.userAgent).match(/.*(WebKit|Gecko).*/))) | |||||
{ | |||||
iframe_map['svg'] = true; | |||||
} | |||||
var e; | |||||
try | |||||
{ | |||||
var format = select.options[select.selectedIndex].value; | |||||
var newLocation = 'about:blank'; | |||||
if (iframe_map[format]) | |||||
{ | |||||
newLocation = self.location.pathname + '?format=' + encodeURIComponent(format); | |||||
} | |||||
self.frames[0].location.replace(newLocation, true); | |||||
} | |||||
catch (e) | |||||
{ | |||||
alert('e' + e); | |||||
} | |||||
return true; | |||||
var iframe_map = { | |||||
'html': true, | |||||
'html3': true, | |||||
'bbfr': true | |||||
}; | |||||
if (self.opera | |||||
|| | |||||
(('' + navigator.userAgent).match(/.*(WebKit|Gecko).*/))) | |||||
{ | |||||
iframe_map['svg'] = true; | |||||
} | |||||
var e; | |||||
try | |||||
{ | |||||
var format = select.options[select.selectedIndex].value; | |||||
var newLocation = 'about:blank'; | |||||
if (iframe_map[format]) | |||||
{ | |||||
newLocation = self.location.pathname + '?format=' + encodeURIComponent(format); | |||||
} | |||||
self.frames[0].location.replace(newLocation, true); | |||||
} | |||||
catch (e) | |||||
{ | |||||
alert('e' + e); | |||||
} | |||||
return true; | |||||
}; | }; | ||||
/*]]>*/ | /*]]>*/ | ||||
</script> | </script> | ||||
@@ -84,138 +82,138 @@ update_preview = function (select) | |||||
<label for="format">as</label> | <label for="format">as</label> | ||||
<select name="format" id="format" onchange="update_preview(this);"> | <select name="format" id="format" onchange="update_preview(this);"> | ||||
<?php | <?php | ||||
foreach($exports as $format => $name) | |||||
{ | |||||
?><option value="<?= htmlspecialchars($format) ?>"<?= | |||||
($format == 'html') ? ' selected="selected"' : '' ?>><?= | |||||
htmlspecialchars($name . " (" . $format . ")") ?></option><?php | |||||
} | |||||
foreach($exports as $format => $name) | |||||
{ | |||||
?><option value="<?= htmlspecialchars($format) ?>"<?= | |||||
($format == 'html') ? ' selected="selected"' : '' ?>><?= | |||||
htmlspecialchars($name . " (" . $format . ")") ?></option><?php | |||||
} | |||||
?> | ?> | ||||
</select> | </select> | ||||
</form> | </form> | ||||
<?php | <?php | ||||
$export_php = isset($_SERVER['SCRIPT_NAME']) | $export_php = isset($_SERVER['SCRIPT_NAME']) | ||||
? | |||||
$_SERVER['SCRIPT_NAME'] | |||||
: | |||||
'export.php'; | |||||
? | |||||
$_SERVER['SCRIPT_NAME'] | |||||
: | |||||
'export.php'; | |||||
?><iframe frameborder="0" name="preview" id="preview" width="820" height="620" style="margin: 0; padding: 0; border: none; width: 100%"></iframe> | ?><iframe frameborder="0" name="preview" id="preview" width="820" height="620" style="margin: 0; padding: 0; border: none; width: 100%"></iframe> | ||||
</body> | </body> | ||||
</html> | </html> | ||||
<?php | <?php | ||||
exit(0); | |||||
exit(0); | |||||
} | } | ||||
if($file) | if($file) | ||||
{ | { | ||||
$cv = caca_create_canvas(0, 0); | |||||
if(caca_import_file($cv, $file, "") < 0) | |||||
{ | |||||
die("`" . htmlspecialchars($filename) . "' has unknown format\n"); | |||||
} | |||||
$cv = caca_create_canvas(0, 0); | |||||
if(caca_import_file($cv, $file, "") < 0) | |||||
{ | |||||
die("`" . htmlspecialchars($filename) . "' has unknown format\n"); | |||||
} | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
$cv = caca_create_canvas(WIDTH, HEIGHT); | |||||
for($y = 0; $y < 256; $y++) | |||||
{ | |||||
for($x = 0; $x < 256; $x++) | |||||
{ | |||||
$r = $x; | |||||
$g = (255 - $y + $x) / 2; | |||||
$b = $y * (255 - $x) / 256; | |||||
imagesetpixel($pixels, $x, $y, imagecolorallocate($pixels, $r, $g, $b)); | |||||
} | |||||
} | |||||
$dither = caca_create_dither($pixels); | |||||
if(($format == "ansi") || ($format == "utf8")) | |||||
caca_set_dither_charset($dither, "shades"); | |||||
caca_dither_bitmap($cv, 0, 0, caca_get_canvas_width($cv), | |||||
caca_get_canvas_height($cv), $dither, $pixels); | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_BLACK); | |||||
caca_draw_thin_box($cv, 0, 0, WIDTH - 1, HEIGHT - 1); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_fill_ellipse($cv, WIDTH / 2, HEIGHT / 2, | |||||
WIDTH / 4, HEIGHT / 4, ord(' ')); | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 6, | |||||
" lightgray on black "); | |||||
caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 5, | |||||
" default on transparent "); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 4, | |||||
" black on white "); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_put_str($cv, WIDTH / 2 - 8, HEIGHT / 2 - 3, "[<><><><> <>--<>]"); | |||||
caca_put_str($cv, WIDTH / 2 - 8, HEIGHT / 2 - 2, "[ドラゴン ボーレ]"); | |||||
caca_put_str($cv, WIDTH / 2 - 7, HEIGHT / 2 + 2, "äβç ░▒▓█▓▒░ ΔЗҒ"); | |||||
caca_put_str($cv, WIDTH / 2 - 5, HEIGHT / 2 + 4, "(\") \\o/ <&>"); | |||||
caca_set_attr($cv, CACA_BOLD); | |||||
caca_put_str($cv, WIDTH / 2 - 16, HEIGHT / 2 + 3, "Bold"); | |||||
caca_set_attr($cv, CACA_BLINK); | |||||
caca_put_str($cv, WIDTH / 2 - 9, HEIGHT / 2 + 3, "Blink"); | |||||
caca_set_attr($cv, CACA_ITALICS); | |||||
caca_put_str($cv, WIDTH / 2 - 1, HEIGHT / 2 + 3, "Italics"); | |||||
caca_set_attr($cv, CACA_UNDERLINE); | |||||
caca_put_str($cv, WIDTH / 2 + 8, HEIGHT / 2 + 3, "Underline"); | |||||
caca_set_attr($cv, 0); | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE); | |||||
caca_put_str($cv, WIDTH / 2 - 7, HEIGHT / 2, " LIBCACA "); | |||||
for($x = 0; $x < 16; $x++) | |||||
{ | |||||
caca_set_color_argb($cv, 0xff00 | $x, 0xf00f | ($x << 4)); | |||||
caca_put_char($cv, WIDTH / 2 - 7 + $x, HEIGHT / 2 + 6, ord('#')); | |||||
} | |||||
$cv = caca_create_canvas(WIDTH, HEIGHT); | |||||
for($y = 0; $y < 256; $y++) | |||||
{ | |||||
for($x = 0; $x < 256; $x++) | |||||
{ | |||||
$r = $x; | |||||
$g = (255 - $y + $x) / 2; | |||||
$b = $y * (255 - $x) / 256; | |||||
imagesetpixel($pixels, $x, $y, imagecolorallocate($pixels, $r, $g, $b)); | |||||
} | |||||
} | |||||
$dither = caca_create_dither($pixels); | |||||
if(($format == "ansi") || ($format == "utf8")) | |||||
caca_set_dither_charset($dither, "shades"); | |||||
caca_dither_bitmap($cv, 0, 0, caca_get_canvas_width($cv), | |||||
caca_get_canvas_height($cv), $dither, $pixels); | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_BLACK); | |||||
caca_draw_thin_box($cv, 0, 0, WIDTH - 1, HEIGHT - 1); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_fill_ellipse($cv, WIDTH / 2, HEIGHT / 2, | |||||
WIDTH / 4, HEIGHT / 4, ord(' ')); | |||||
caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 6, | |||||
" lightgray on black "); | |||||
caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 5, | |||||
" default on transparent "); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_put_str($cv, WIDTH / 2 - 12, HEIGHT / 2 - 4, | |||||
" black on white "); | |||||
caca_set_color_ansi($cv, CACA_BLACK, CACA_WHITE); | |||||
caca_put_str($cv, WIDTH / 2 - 8, HEIGHT / 2 - 3, "[<><><><> <>--<>]"); | |||||
caca_put_str($cv, WIDTH / 2 - 8, HEIGHT / 2 - 2, "[ドラゴン ボーレ]"); | |||||
caca_put_str($cv, WIDTH / 2 - 7, HEIGHT / 2 + 2, "äβç ░▒▓█▓▒░ ΔЗҒ"); | |||||
caca_put_str($cv, WIDTH / 2 - 5, HEIGHT / 2 + 4, "(\") \\o/ <&>"); | |||||
caca_set_attr($cv, CACA_BOLD); | |||||
caca_put_str($cv, WIDTH / 2 - 16, HEIGHT / 2 + 3, "Bold"); | |||||
caca_set_attr($cv, CACA_BLINK); | |||||
caca_put_str($cv, WIDTH / 2 - 9, HEIGHT / 2 + 3, "Blink"); | |||||
caca_set_attr($cv, CACA_ITALICS); | |||||
caca_put_str($cv, WIDTH / 2 - 1, HEIGHT / 2 + 3, "Italics"); | |||||
caca_set_attr($cv, CACA_UNDERLINE); | |||||
caca_put_str($cv, WIDTH / 2 + 8, HEIGHT / 2 + 3, "Underline"); | |||||
caca_set_attr($cv, 0); | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE); | |||||
caca_put_str($cv, WIDTH / 2 - 7, HEIGHT / 2, " LIBCACA "); | |||||
for($x = 0; $x < 16; $x++) | |||||
{ | |||||
caca_set_color_argb($cv, 0xff00 | $x, 0xf00f | ($x << 4)); | |||||
caca_put_char($cv, WIDTH / 2 - 7 + $x, HEIGHT / 2 + 6, ord('#')); | |||||
} | |||||
} | } | ||||
$content_type_map = array( | $content_type_map = array( | ||||
'ansi' => 'text/plain; charset=CP437', | |||||
'utf8' => 'text/plain; charset=UTF-8', | |||||
'utf8cr' => 'text/plain; charset=UTF-8', | |||||
'html' => 'text/html; charset=UTF-8', | |||||
'html3' => 'text/html; charset=UTF-8', | |||||
'bbfr' => 'text/plain; charset=UTF-8', | |||||
'irc' => 'text/plain; charset=UTF-8', | |||||
'ps' => 'application/postscript', | |||||
'svg' => 'image/svg+xml', | |||||
'tga' => 'image/x-targa' | |||||
); | |||||
'ansi' => 'text/plain; charset=CP437', | |||||
'utf8' => 'text/plain; charset=UTF-8', | |||||
'utf8cr' => 'text/plain; charset=UTF-8', | |||||
'html' => 'text/html; charset=UTF-8', | |||||
'html3' => 'text/html; charset=UTF-8', | |||||
'bbfr' => 'text/plain; charset=UTF-8', | |||||
'irc' => 'text/plain; charset=UTF-8', | |||||
'ps' => 'application/postscript', | |||||
'svg' => 'image/svg+xml', | |||||
'tga' => 'image/x-targa' | |||||
); | |||||
$download_extension_map = array( | $download_extension_map = array( | ||||
'caca' => 'caca', | |||||
'ansi' => 'txt', | |||||
'utf8' => 'txt', | |||||
'utf8cr' => 'txt', | |||||
'irc' => 'txt', | |||||
'tga' => 'tga' | |||||
); | |||||
'caca' => 'caca', | |||||
'ansi' => 'txt', | |||||
'utf8' => 'txt', | |||||
'utf8cr' => 'txt', | |||||
'irc' => 'txt', | |||||
'tga' => 'tga' | |||||
); | |||||
$inline_extension_map = array( | $inline_extension_map = array( | ||||
'bbfr' => 'txt', | |||||
'ps' => 'ps', | |||||
'svg' => 'svg' | |||||
); | |||||
'bbfr' => 'txt', | |||||
'ps' => 'ps', | |||||
'svg' => 'svg' | |||||
); | |||||
if (! array_key_exists($format, $content_type_map)) | if (! array_key_exists($format, $content_type_map)) | ||||
$content_type = 'application/octet-stream'; | |||||
$content_type = 'application/octet-stream'; | |||||
else | else | ||||
$content_type = $content_type_map[$format]; | |||||
$content_type = $content_type_map[$format]; | |||||
header('Content-Type: ' . $content_type); | header('Content-Type: ' . $content_type); | ||||
if (array_key_exists($format, $download_extension_map)) | if (array_key_exists($format, $download_extension_map)) | ||||
header('Content-Disposition: attachment; filename=export.' . $download_extension_map[$format]); | |||||
header('Content-Disposition: attachment; filename=export.' . $download_extension_map[$format]); | |||||
else if (array_key_exists($format, $inline_extension_map)) | else if (array_key_exists($format, $inline_extension_map)) | ||||
header('Content-Disposition: inline; filename=export.' . $inline_extension_map[$format]); | |||||
header('Content-Disposition: inline; filename=export.' . $inline_extension_map[$format]); | |||||
echo caca_export_string($cv, $format); | echo caca_export_string($cv, $format); | ||||
@@ -22,46 +22,46 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
* http://sam.zoy.org/wtfpl/COPYING for more details. | * http://sam.zoy.org/wtfpl/COPYING for more details. | ||||
*/ | */ | ||||
function unistr_to_ords($str, $encoding = 'UTF-8'){ | |||||
$str = mb_convert_encoding($str, "UCS-4BE", $encoding); | |||||
$result = array(); | |||||
function unistr_to_ords($str, $encoding = 'UTF-8'){ | |||||
$str = mb_convert_encoding($str, "UCS-4BE", $encoding); | |||||
$result = array(); | |||||
for ($i = 0; $i < mb_strlen($str, "UCS-4BE"); $i++){ | |||||
$c = mb_substr($str, $i, 1, "UCS-4BE"); | |||||
$val = unpack("N", $c); | |||||
$result[] = $val[1]; | |||||
} | |||||
return $result; | |||||
for ($i = 0; $i < mb_strlen($str, "UCS-4BE"); $i++){ | |||||
$c = mb_substr($str, $i, 1, "UCS-4BE"); | |||||
$val = unpack("N", $c); | |||||
$result[] = $val[1]; | |||||
} | |||||
return $result; | |||||
} | } | ||||
function show_figlet($str, $font) { | function show_figlet($str, $font) { | ||||
$cv = caca_create_canvas(0, 0); | |||||
$cv = caca_create_canvas(0, 0); | |||||
if (!caca_canvas_set_figfont($cv, $font)) { | |||||
return false; | |||||
} | |||||
$chars = unistr_to_ords($str); | |||||
$color = 0; | |||||
foreach ($chars as $c) { | |||||
caca_set_color_ansi($cv, 1 + (($color += 1) % 13), CACA_WHITE); | |||||
caca_put_figchar($cv, $c); | |||||
} | |||||
if (!caca_canvas_set_figfont($cv, $font)) { | |||||
return false; | |||||
} | |||||
echo caca_export_string($cv, "html3"); | |||||
$chars = unistr_to_ords($str); | |||||
$color = 0; | |||||
foreach ($chars as $c) { | |||||
caca_set_color_ansi($cv, 1 + (($color += 1) % 13), CACA_WHITE); | |||||
caca_put_figchar($cv, $c); | |||||
} | |||||
echo caca_export_string($cv, "html3"); | |||||
} | } | ||||
$path = "/usr/share/figlet/"; | $path = "/usr/share/figlet/"; | ||||
if (!is_dir($path)) { | if (!is_dir($path)) { | ||||
die("can not open directory $path.\n"); | |||||
die("can not open directory $path.\n"); | |||||
} | } | ||||
$dir = opendir($path); | $dir = opendir($path); | ||||
while (($it = readdir($dir)) != false) { | while (($it = readdir($dir)) != false) { | ||||
if (is_file($path.$it) and ereg("\.[tf]lf$", $it)) { | |||||
echo "<b>font : $it</b>\n"; | |||||
show_figlet(isset($_GET["str"]) ? $_GET["str"] : "Libcaca", $path.$it); | |||||
} | |||||
if (is_file($path.$it) and ereg("\.[tf]lf$", $it)) { | |||||
echo "<b>font : $it</b>\n"; | |||||
show_figlet(isset($_GET["str"]) ? $_GET["str"] : "Libcaca", $path.$it); | |||||
} | |||||
} | } | ||||
?> | ?> | ||||
</body> | </body> | ||||
@@ -11,12 +11,10 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/fullwidth.c" | * This file is a Php port of "examples/fullwidth.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -36,7 +34,7 @@ define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"); | |||||
$cv = caca_create_canvas(36, 12); | $cv = caca_create_canvas(36, 12); | ||||
if(! $cv) | if(! $cv) | ||||
{ | { | ||||
die("Can't created canvas\n"); | |||||
die("Can't created canvas\n"); | |||||
} | } | ||||
$caca = caca_create_canvas(6, 10); | $caca = caca_create_canvas(6, 10); | ||||
@@ -45,10 +43,10 @@ $line = caca_create_canvas(2, 1); | |||||
/* Line of x's */ | /* Line of x's */ | ||||
for($i = 0; $i < 10; $i++) | for($i = 0; $i < 10; $i++) | ||||
{ | { | ||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_RED); | |||||
caca_put_char($caca, $i - 2, $i, ord('x')); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_RED); | |||||
caca_put_char($caca, $i - 2, $i, ord('x')); | |||||
} | } | ||||
caca_blit($cv, 1, 1, $caca); | caca_blit($cv, 1, 1, $caca); | ||||
@@ -56,10 +54,10 @@ caca_blit($cv, 1, 1, $caca); | |||||
/* Line of ホ's */ | /* Line of ホ's */ | ||||
for($i = 0; $i < 10; $i++) | for($i = 0; $i < 10; $i++) | ||||
{ | { | ||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_GREEN); | |||||
caca_put_str($caca, $i - 2, $i, "ホ"); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_GREEN); | |||||
caca_put_str($caca, $i - 2, $i, "ホ"); | |||||
} | } | ||||
caca_blit($cv, 15, 1, $caca); | caca_blit($cv, 15, 1, $caca); | ||||
@@ -69,9 +67,9 @@ caca_set_color_ansi($line, CACA_WHITE, CACA_MAGENTA); | |||||
caca_put_str($line, 0, 0, "ほ"); | caca_put_str($line, 0, 0, "ほ"); | ||||
for($i = 0; $i < 10; $i++) | for($i = 0; $i < 10; $i++) | ||||
{ | { | ||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_blit($caca, $i - 2, $i, $line); | |||||
caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); | |||||
caca_put_str($caca, 0, $i, CACA); | |||||
caca_blit($caca, $i - 2, $i, $line); | |||||
} | } | ||||
caca_blit($cv, 29, 1, $caca); | caca_blit($cv, 29, 1, $caca); | ||||
@@ -4,13 +4,11 @@ | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "src/img2txt.c" | * This file is a Php port of "src/img2txt.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* 2007 Jean-Yves Lamoureux <jylam@lnxscene.org> | * 2007 Jean-Yves Lamoureux <jylam@lnxscene.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -19,10 +17,10 @@ | |||||
*/ | */ | ||||
$img2txt_php = isset($_SERVER['SCRIPT_NAME']) | $img2txt_php = isset($_SERVER['SCRIPT_NAME']) | ||||
? | |||||
$_SERVER['SCRIPT_NAME'] | |||||
: | |||||
'img2txt.php'; | |||||
? | |||||
$_SERVER['SCRIPT_NAME'] | |||||
: | |||||
'img2txt.php'; | |||||
$argv = array(basename($img2txt_php)); | $argv = array(basename($img2txt_php)); | ||||
$file = isset($_FILES['file']) ? $_FILES['file']['tmp_name'] : NULL; | $file = isset($_FILES['file']) ? $_FILES['file']['tmp_name'] : NULL; | ||||
@@ -30,14 +28,14 @@ $filename = isset($_FILES['file']) ? $_FILES['file']['name'] : NULL; | |||||
$args = NULL; | $args = NULL; | ||||
if(isset($_REQUEST['args'])) | if(isset($_REQUEST['args'])) | ||||
{ | { | ||||
$args = trim($_REQUEST['args']); | |||||
if(strlen($args)) | |||||
{ | |||||
foreach(explode(' ', $args) as $arg) | |||||
{ | |||||
$argv[] = $arg; | |||||
} | |||||
} | |||||
$args = trim($_REQUEST['args']); | |||||
if(strlen($args)) | |||||
{ | |||||
foreach(explode(' ', $args) as $arg) | |||||
{ | |||||
$argv[] = $arg; | |||||
} | |||||
} | |||||
} | } | ||||
$argc = count($argv); | $argc = count($argv); | ||||
$stderr = ''; | $stderr = ''; | ||||
@@ -51,448 +49,448 @@ $myoptind = 0; | |||||
function mygetopt($shortopts, $longopts) | function mygetopt($shortopts, $longopts) | ||||
{ | { | ||||
global $argc, $argv, $myoptind; | |||||
if($myoptind < 0) | |||||
{ | |||||
$myoptind = 0; | |||||
} | |||||
if(($myoptind + 1) >= $argc) | |||||
{ | |||||
return NULL; | |||||
} | |||||
$myoptind ++; | |||||
$nextarg = $argv[$myoptind]; | |||||
$ret = NULL; | |||||
if((substr($nextarg, 0, 1) != '-') | |||||
|| | |||||
($nextarg == '-')) | |||||
{ | |||||
$myoptind = $argc - 1; | |||||
} | |||||
else | |||||
{ | |||||
$skipopt = $myoptind; | |||||
$skipopts = 1; | |||||
if($nextarg == '--') | |||||
{ | |||||
$myoptind = $argc - 1; | |||||
} | |||||
else | |||||
{ | |||||
$opt = NULL; | |||||
$arg = NULL; | |||||
foreach($longopts as $longopt) | |||||
{ | |||||
$optional = false; | |||||
$hasarg = false; | |||||
if(($longopt != '::') && substr($longopt, -2) == '::') | |||||
{ | |||||
$optional = true; | |||||
$hasarg = true; | |||||
$longopt = substr($longopt, 0, -2); | |||||
} | |||||
else if(($longopt != ':') && substr($longopt, -1) == ':') | |||||
{ | |||||
$optional = false; | |||||
$hasarg = true; | |||||
$longopt = substr($longopt, 0, -1); | |||||
} | |||||
if($nextarg == ('--' . $longopt)) | |||||
{ | |||||
$opt = '--' . $longopt; | |||||
if($hasarg && ! $optional) | |||||
{ | |||||
if(($myoptind + 1) < $argc) | |||||
{ | |||||
$myoptind ++; | |||||
$skipopts ++; | |||||
$arg = $argv[$myoptind]; | |||||
} | |||||
else | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" requires an argument"); | |||||
} | |||||
} | |||||
break; | |||||
} | |||||
else if(substr($nextarg, 0, strlen('--' . $longopt . '=')) | |||||
== | |||||
('--' . $longopt . '=')) | |||||
{ | |||||
$opt = '--' . $longopt; | |||||
$arg = substr($nextarg, strlen($opt . '=')); | |||||
if(! $hasarg) | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" does not allow an argument"); | |||||
} | |||||
break; | |||||
} | |||||
} | |||||
if($opt === NULL) | |||||
{ | |||||
for($i = 0; $i < strlen($shortopts); $i ++) | |||||
{ | |||||
$optional = false; | |||||
$hasarg = false; | |||||
$shortopt = substr($shortopts, $i, 1); | |||||
if(substr($shortopts, $i + 1, 2) == '::') | |||||
{ | |||||
$optional = true; | |||||
$hasarg = true; | |||||
$i += 2; | |||||
} | |||||
else if(substr($shortopts, $i + 1, 1) == ':') | |||||
{ | |||||
$hasarg = true; | |||||
} | |||||
if($nextarg | |||||
== | |||||
('-' . $shortopt)) | |||||
{ | |||||
$opt = '-' . $shortopt; | |||||
if($hasarg && ! $optional) | |||||
{ | |||||
if(($myoptind + 1) < $argc) | |||||
{ | |||||
$myoptind ++; | |||||
$skipopts ++; | |||||
$arg = $argv[$myoptind]; | |||||
} | |||||
else | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" requires an argument"); | |||||
} | |||||
} | |||||
break; | |||||
} | |||||
else if(substr($nextarg, 0, strlen('-' . $shortopt)) | |||||
== | |||||
('-' . $shortopt)) | |||||
{ | |||||
$opt = '-' . $shortopt; | |||||
if($hasarg) | |||||
{ | |||||
$arg = substr($nextarg, strlen($opt)); | |||||
} | |||||
else | |||||
{ | |||||
$argv[$myoptind] = '-' . substr($nextarg, strlen($opt)); | |||||
$myoptind --; | |||||
$skipopts = 0; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
if($opt === NULL) | |||||
{ | |||||
if(substr($nextarg, 0, strlen('--')) == '--') | |||||
{ | |||||
$longopt = substr($nextarg, strlen('--')); | |||||
if(strpos($longopt, '=') !== false) | |||||
{ | |||||
$longopt = substr($longopt, 0, strpos($longopt, '=')); | |||||
} | |||||
throw new MygetoptException("option \"--$longopt\" is not recognized"); | |||||
} | |||||
$shortopt = substr($nextarg, strlen('-'), 1); | |||||
throw new MygetoptException("option \"-$shortopt\" is not recognized"); | |||||
} | |||||
$ret = array($opt, $arg); | |||||
} | |||||
if ($skipopts > 0) | |||||
{ | |||||
for($i = 0; $i < $argc; $i ++) | |||||
{ | |||||
if(($i < $skipopt) || ($i >= ($skipopt + $skipopts))) | |||||
{ | |||||
$new_argv[] = $argv[$i]; | |||||
} | |||||
} | |||||
if($myoptind >= $skipopt) | |||||
{ | |||||
$myoptind -= $skipopts; | |||||
} | |||||
$argv = $new_argv; | |||||
$argc = count($argv); | |||||
} | |||||
} | |||||
return $ret; | |||||
global $argc, $argv, $myoptind; | |||||
if($myoptind < 0) | |||||
{ | |||||
$myoptind = 0; | |||||
} | |||||
if(($myoptind + 1) >= $argc) | |||||
{ | |||||
return NULL; | |||||
} | |||||
$myoptind ++; | |||||
$nextarg = $argv[$myoptind]; | |||||
$ret = NULL; | |||||
if((substr($nextarg, 0, 1) != '-') | |||||
|| | |||||
($nextarg == '-')) | |||||
{ | |||||
$myoptind = $argc - 1; | |||||
} | |||||
else | |||||
{ | |||||
$skipopt = $myoptind; | |||||
$skipopts = 1; | |||||
if($nextarg == '--') | |||||
{ | |||||
$myoptind = $argc - 1; | |||||
} | |||||
else | |||||
{ | |||||
$opt = NULL; | |||||
$arg = NULL; | |||||
foreach($longopts as $longopt) | |||||
{ | |||||
$optional = false; | |||||
$hasarg = false; | |||||
if(($longopt != '::') && substr($longopt, -2) == '::') | |||||
{ | |||||
$optional = true; | |||||
$hasarg = true; | |||||
$longopt = substr($longopt, 0, -2); | |||||
} | |||||
else if(($longopt != ':') && substr($longopt, -1) == ':') | |||||
{ | |||||
$optional = false; | |||||
$hasarg = true; | |||||
$longopt = substr($longopt, 0, -1); | |||||
} | |||||
if($nextarg == ('--' . $longopt)) | |||||
{ | |||||
$opt = '--' . $longopt; | |||||
if($hasarg && ! $optional) | |||||
{ | |||||
if(($myoptind + 1) < $argc) | |||||
{ | |||||
$myoptind ++; | |||||
$skipopts ++; | |||||
$arg = $argv[$myoptind]; | |||||
} | |||||
else | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" requires an argument"); | |||||
} | |||||
} | |||||
break; | |||||
} | |||||
else if(substr($nextarg, 0, strlen('--' . $longopt . '=')) | |||||
== | |||||
('--' . $longopt . '=')) | |||||
{ | |||||
$opt = '--' . $longopt; | |||||
$arg = substr($nextarg, strlen($opt . '=')); | |||||
if(! $hasarg) | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" does not allow an argument"); | |||||
} | |||||
break; | |||||
} | |||||
} | |||||
if($opt === NULL) | |||||
{ | |||||
for($i = 0; $i < strlen($shortopts); $i ++) | |||||
{ | |||||
$optional = false; | |||||
$hasarg = false; | |||||
$shortopt = substr($shortopts, $i, 1); | |||||
if(substr($shortopts, $i + 1, 2) == '::') | |||||
{ | |||||
$optional = true; | |||||
$hasarg = true; | |||||
$i += 2; | |||||
} | |||||
else if(substr($shortopts, $i + 1, 1) == ':') | |||||
{ | |||||
$hasarg = true; | |||||
} | |||||
if($nextarg | |||||
== | |||||
('-' . $shortopt)) | |||||
{ | |||||
$opt = '-' . $shortopt; | |||||
if($hasarg && ! $optional) | |||||
{ | |||||
if(($myoptind + 1) < $argc) | |||||
{ | |||||
$myoptind ++; | |||||
$skipopts ++; | |||||
$arg = $argv[$myoptind]; | |||||
} | |||||
else | |||||
{ | |||||
throw new MygetoptException("option \"$opt\" requires an argument"); | |||||
} | |||||
} | |||||
break; | |||||
} | |||||
else if(substr($nextarg, 0, strlen('-' . $shortopt)) | |||||
== | |||||
('-' . $shortopt)) | |||||
{ | |||||
$opt = '-' . $shortopt; | |||||
if($hasarg) | |||||
{ | |||||
$arg = substr($nextarg, strlen($opt)); | |||||
} | |||||
else | |||||
{ | |||||
$argv[$myoptind] = '-' . substr($nextarg, strlen($opt)); | |||||
$myoptind --; | |||||
$skipopts = 0; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
if($opt === NULL) | |||||
{ | |||||
if(substr($nextarg, 0, strlen('--')) == '--') | |||||
{ | |||||
$longopt = substr($nextarg, strlen('--')); | |||||
if(strpos($longopt, '=') !== false) | |||||
{ | |||||
$longopt = substr($longopt, 0, strpos($longopt, '=')); | |||||
} | |||||
throw new MygetoptException("option \"--$longopt\" is not recognized"); | |||||
} | |||||
$shortopt = substr($nextarg, strlen('-'), 1); | |||||
throw new MygetoptException("option \"-$shortopt\" is not recognized"); | |||||
} | |||||
$ret = array($opt, $arg); | |||||
} | |||||
if ($skipopts > 0) | |||||
{ | |||||
for($i = 0; $i < $argc; $i ++) | |||||
{ | |||||
if(($i < $skipopt) || ($i >= ($skipopt + $skipopts))) | |||||
{ | |||||
$new_argv[] = $argv[$i]; | |||||
} | |||||
} | |||||
if($myoptind >= $skipopt) | |||||
{ | |||||
$myoptind -= $skipopts; | |||||
} | |||||
$argv = $new_argv; | |||||
$argc = count($argv); | |||||
} | |||||
} | |||||
return $ret; | |||||
} | } | ||||
function usage($argc, $argv) | function usage($argc, $argv) | ||||
{ | { | ||||
global $stdout; | |||||
$stdout .= sprintf("Usage: %s [OPTIONS]... <IMAGE>\n", $argv[0]); | |||||
$stdout .= sprintf("Convert IMAGE to any text based available format.\n"); | |||||
$stdout .= sprintf("Example : -W 80 -f html logo-caca.png\n\n", $argv[0]); | |||||
$stdout .= sprintf("Options:\n"); | |||||
$stdout .= sprintf(" -h, --help\t\t\tThis help\n"); | |||||
$stdout .= sprintf(" -v, --version\t\t\tVersion of the program\n"); | |||||
$stdout .= sprintf(" -W, --width=WIDTH\t\tWidth of resulting image\n"); | |||||
$stdout .= sprintf(" -H, --height=HEIGHT\t\tHeight of resulting image\n"); | |||||
$stdout .= sprintf(" -x, --font-width=WIDTH\t\tWidth of output font\n"); | |||||
$stdout .= sprintf(" -y, --font-height=HEIGHT\t\tHeight of output font\n"); | |||||
$stdout .= sprintf(" -b, --brightness=BRIGHTNESS\tBrightness of resulting image\n"); | |||||
$stdout .= sprintf(" -c, --contrast=CONTRAST\tContrast of resulting image\n"); | |||||
$stdout .= sprintf(" -g, --gamma=GAMMA\t\tGamma of resulting image\n"); | |||||
$stdout .= sprintf(" -d, --dither=DITHER\t\tDithering algorithm to use :\n"); | |||||
$list = caca_get_dither_algorithm_list(caca_create_dither(imagecreate(1, 1))); | |||||
foreach($list as $type => $name) | |||||
{ | |||||
$stdout .= sprintf("\t\t\t%s: %s\n", $type, $name); | |||||
} | |||||
global $stdout; | |||||
$stdout .= sprintf("Usage: %s [OPTIONS]... <IMAGE>\n", $argv[0]); | |||||
$stdout .= sprintf("Convert IMAGE to any text based available format.\n"); | |||||
$stdout .= sprintf("Example : -W 80 -f html logo-caca.png\n\n", $argv[0]); | |||||
$stdout .= sprintf("Options:\n"); | |||||
$stdout .= sprintf(" -h, --help\t\t\tThis help\n"); | |||||
$stdout .= sprintf(" -v, --version\t\t\tVersion of the program\n"); | |||||
$stdout .= sprintf(" -W, --width=WIDTH\t\tWidth of resulting image\n"); | |||||
$stdout .= sprintf(" -H, --height=HEIGHT\t\tHeight of resulting image\n"); | |||||
$stdout .= sprintf(" -x, --font-width=WIDTH\t\tWidth of output font\n"); | |||||
$stdout .= sprintf(" -y, --font-height=HEIGHT\t\tHeight of output font\n"); | |||||
$stdout .= sprintf(" -b, --brightness=BRIGHTNESS\tBrightness of resulting image\n"); | |||||
$stdout .= sprintf(" -c, --contrast=CONTRAST\tContrast of resulting image\n"); | |||||
$stdout .= sprintf(" -g, --gamma=GAMMA\t\tGamma of resulting image\n"); | |||||
$stdout .= sprintf(" -d, --dither=DITHER\t\tDithering algorithm to use :\n"); | |||||
$list = caca_get_dither_algorithm_list(caca_create_dither(imagecreate(1, 1))); | |||||
foreach($list as $type => $name) | |||||
{ | |||||
$stdout .= sprintf("\t\t\t%s: %s\n", $type, $name); | |||||
} | |||||
$stdout .= sprintf(" -f, --format=FORMAT\t\tFormat of the resulting image :\n"); | |||||
$list = caca_get_export_list(); | |||||
foreach($list as $type => $name) | |||||
{ | |||||
$stdout .= sprintf("\t\t\t%s: %s\n", $type, $name); | |||||
} | |||||
$stdout .= sprintf(" -f, --format=FORMAT\t\tFormat of the resulting image :\n"); | |||||
$list = caca_get_export_list(); | |||||
foreach($list as $type => $name) | |||||
{ | |||||
$stdout .= sprintf("\t\t\t%s: %s\n", $type, $name); | |||||
} | |||||
} | } | ||||
function version() | function version() | ||||
{ | { | ||||
global $stdout; | |||||
$stdout .= sprintf( | |||||
"img2txt Copyright 2006-2007 Sam Hocevar and Jean-Yves Lamoureux\n" . | |||||
" Copyright 2008 Benjamin C. Wiley Sittler\n" . | |||||
"Internet: <sam@hocevar.net> <jylam@lnxscene.org>\n" . | |||||
" <bsittler@gmail.com> Version: %s\n" . | |||||
"\n" . | |||||
"img2txt, along with its documentation, may be freely copied and distributed.\n" . | |||||
"\n" . | |||||
"The latest version of img2txt is available from the web site,\n" . | |||||
" http://caca.zoy.org/wiki/libcaca in the libcaca package.\n" . | |||||
"\n", | |||||
caca_get_version()); | |||||
global $stdout; | |||||
$stdout .= sprintf( | |||||
"img2txt Copyright 2006-2007 Sam Hocevar and Jean-Yves Lamoureux\n" . | |||||
" Copyright 2008 Benjamin C. Wiley Sittler\n" . | |||||
"Internet: <sam@hocevar.net> <jylam@lnxscene.org>\n" . | |||||
" <bsittler@gmail.com> Version: %s\n" . | |||||
"\n" . | |||||
"img2txt, along with its documentation, may be freely copied and distributed.\n" . | |||||
"\n" . | |||||
"The latest version of img2txt is available from the web site,\n" . | |||||
" http://caca.zoy.org/wiki/libcaca in the libcaca package.\n" . | |||||
"\n", | |||||
caca_get_version()); | |||||
} | } | ||||
function main() | function main() | ||||
{ | { | ||||
global $file, $filename; | |||||
global $argc, $argv; | |||||
global $stderr; | |||||
$cols = 0; | |||||
$lines = 0; | |||||
$font_width = 6; | |||||
$font_height = 10; | |||||
$format = NULL; | |||||
$dither = NULL; | |||||
$gamma = $brightness = $contrast = -1.0; | |||||
global $file, $filename; | |||||
global $argc, $argv; | |||||
global $stderr; | |||||
$cols = 0; | |||||
$lines = 0; | |||||
$font_width = 6; | |||||
$font_height = 10; | |||||
$format = NULL; | |||||
$dither = NULL; | |||||
$gamma = $brightness = $contrast = -1.0; | |||||
$long_options = array( | |||||
"width:" => 'W', | |||||
"height:" => 'H', | |||||
"font-width:" => 'x', | |||||
"font-height:" => 'y', | |||||
"format:" => 'f', | |||||
"dither:" => 'd', | |||||
"gamma:" => 'g', | |||||
"brightness:" => 'b', | |||||
"contrast:" => 'c', | |||||
"help" => 'h', | |||||
"version" => 'v' | |||||
); | |||||
$long_options = array( | |||||
"width:" => 'W', | |||||
"height:" => 'H', | |||||
"font-width:" => 'x', | |||||
"font-height:" => 'y', | |||||
"format:" => 'f', | |||||
"dither:" => 'd', | |||||
"gamma:" => 'g', | |||||
"brightness:" => 'b', | |||||
"contrast:" => 'c', | |||||
"help" => 'h', | |||||
"version" => 'v' | |||||
); | |||||
try { | |||||
while($opt_and_arg = mygetopt("W:H:f:d:g:b:c:hvx:y:", array_keys($long_options))) | |||||
{ | |||||
$opt = $opt_and_arg[0]; | |||||
$arg = $opt_and_arg[1]; | |||||
if((substr($opt, 0, 2) == '--') | |||||
&& | |||||
array_key_exists(substr($opt, strlen('--')) . (($arg !== NULL) ? ':' : ''), $long_options)) | |||||
{ | |||||
$opt = '-' . $long_options[substr($opt, strlen('--')) . (($arg !== NULL) ? ':' : '')]; | |||||
} | |||||
switch($opt) | |||||
{ | |||||
case '-W': /* --width */ | |||||
$cols = intval($arg); | |||||
break; | |||||
case '-H': /* --height */ | |||||
$lines = intval($arg); | |||||
break; | |||||
case '-x': /* --width */ | |||||
$font_width = intval($arg); | |||||
break; | |||||
case '-y': /* --height */ | |||||
$font_height = intval($arg); | |||||
break; | |||||
case '-f': /* --format */ | |||||
$format = $arg; | |||||
break; | |||||
case '-d': /* --dither */ | |||||
$dither = $arg; | |||||
break; | |||||
case '-g': /* --gamma */ | |||||
$gamma = floatval($arg); | |||||
break; | |||||
case '-b': /* --brightness */ | |||||
$brightness = floatval($arg); | |||||
break; | |||||
case '-c': /* --contrast */ | |||||
$contrast = floatval($arg); | |||||
break; | |||||
case '-h': /* --help */ | |||||
usage($argc, $argv); | |||||
return 0; | |||||
case '-v': /* --version */ | |||||
version(); | |||||
return 0; | |||||
default: | |||||
return 1; | |||||
} | |||||
} | |||||
} | |||||
catch (MygetoptException $e) | |||||
{ | |||||
$stderr .= $argv[0] . ": " . $e->getMessage() . "\n"; | |||||
usage($argc, $argv); | |||||
return 2; | |||||
} | |||||
try { | |||||
while($opt_and_arg = mygetopt("W:H:f:d:g:b:c:hvx:y:", array_keys($long_options))) | |||||
{ | |||||
$opt = $opt_and_arg[0]; | |||||
$arg = $opt_and_arg[1]; | |||||
if((substr($opt, 0, 2) == '--') | |||||
&& | |||||
array_key_exists(substr($opt, strlen('--')) . (($arg !== NULL) ? ':' : ''), $long_options)) | |||||
{ | |||||
$opt = '-' . $long_options[substr($opt, strlen('--')) . (($arg !== NULL) ? ':' : '')]; | |||||
} | |||||
switch($opt) | |||||
{ | |||||
case '-W': /* --width */ | |||||
$cols = intval($arg); | |||||
break; | |||||
case '-H': /* --height */ | |||||
$lines = intval($arg); | |||||
break; | |||||
case '-x': /* --width */ | |||||
$font_width = intval($arg); | |||||
break; | |||||
case '-y': /* --height */ | |||||
$font_height = intval($arg); | |||||
break; | |||||
case '-f': /* --format */ | |||||
$format = $arg; | |||||
break; | |||||
case '-d': /* --dither */ | |||||
$dither = $arg; | |||||
break; | |||||
case '-g': /* --gamma */ | |||||
$gamma = floatval($arg); | |||||
break; | |||||
case '-b': /* --brightness */ | |||||
$brightness = floatval($arg); | |||||
break; | |||||
case '-c': /* --contrast */ | |||||
$contrast = floatval($arg); | |||||
break; | |||||
case '-h': /* --help */ | |||||
usage($argc, $argv); | |||||
return 0; | |||||
case '-v': /* --version */ | |||||
version(); | |||||
return 0; | |||||
default: | |||||
return 1; | |||||
} | |||||
} | |||||
} | |||||
catch (MygetoptException $e) | |||||
{ | |||||
$stderr .= $argv[0] . ": " . $e->getMessage() . "\n"; | |||||
usage($argc, $argv); | |||||
return 2; | |||||
} | |||||
if((! $file) && ($argc == 2) && ($argv[1] == 'logo-caca.png')) | |||||
{ | |||||
$file = 'logo-caca.png'; | |||||
$argc = 1; | |||||
} | |||||
else if($filename && $file && ($argc == 2) | |||||
&& | |||||
(strtolower(basename($argv[1])) == strtolower(basename($filename)))) | |||||
{ | |||||
$argc = 1; | |||||
} | |||||
if((! $file) && ($argc == 2) && ($argv[1] == 'logo-caca.png')) | |||||
{ | |||||
$file = 'logo-caca.png'; | |||||
$argc = 1; | |||||
} | |||||
else if($filename && $file && ($argc == 2) | |||||
&& | |||||
(strtolower(basename($argv[1])) == strtolower(basename($filename)))) | |||||
{ | |||||
$argc = 1; | |||||
} | |||||
if($argc == 2) | |||||
{ | |||||
$stderr .= sprintf("%s: image not found\n", $argv[1]); | |||||
return 1; | |||||
} | |||||
if($argc == 2) | |||||
{ | |||||
$stderr .= sprintf("%s: image not found\n", $argv[1]); | |||||
return 1; | |||||
} | |||||
if($argc > 2) | |||||
{ | |||||
$stderr .= sprintf("%s: too many arguments\n", $argv[0]); | |||||
usage($argc, $argv); | |||||
return 1; | |||||
} | |||||
if($argc > 2) | |||||
{ | |||||
$stderr .= sprintf("%s: too many arguments\n", $argv[0]); | |||||
usage($argc, $argv); | |||||
return 1; | |||||
} | |||||
if(! $file) | |||||
{ | |||||
$stderr .= sprintf("%s: no image was provided\n", $argv[0]); | |||||
usage($argc, $argv); | |||||
return 1; | |||||
} | |||||
if(! $file) | |||||
{ | |||||
$stderr .= sprintf("%s: no image was provided\n", $argv[0]); | |||||
usage($argc, $argv); | |||||
return 1; | |||||
} | |||||
$cv = caca_create_canvas(0, 0); | |||||
if(!$cv) | |||||
{ | |||||
$stderr .= sprintf("%s: unable to initialise libcaca\n", $argv[0]); | |||||
return 1; | |||||
} | |||||
$cv = caca_create_canvas(0, 0); | |||||
if(!$cv) | |||||
{ | |||||
$stderr .= sprintf("%s: unable to initialise libcaca\n", $argv[0]); | |||||
return 1; | |||||
} | |||||
$i_str = $file ? file_get_contents($file) : NULL; | |||||
$i = $i_str ? imagecreatefromstring($i_str) : NULL; | |||||
if(!$i) | |||||
{ | |||||
$stderr .= sprintf("%s: unable to load %s\n", $argv[0], $filename); | |||||
return 1; | |||||
} | |||||
$i_str = $file ? file_get_contents($file) : NULL; | |||||
$i = $i_str ? imagecreatefromstring($i_str) : NULL; | |||||
if(!$i) | |||||
{ | |||||
$stderr .= sprintf("%s: unable to load %s\n", $argv[0], $filename); | |||||
return 1; | |||||
} | |||||
/* Assume a 6×10 font */ | |||||
if(!$cols && !$lines) | |||||
{ | |||||
$cols = 60; | |||||
$lines = $cols * imagesy($i) * $font_width / imagesx($i) / $font_height; | |||||
} | |||||
else if($cols && !$lines) | |||||
{ | |||||
$lines = $cols * imagesy($i) * $font_width / imagesx($i) / $font_height; | |||||
} | |||||
else if(!$cols && $lines) | |||||
{ | |||||
$cols = $lines * imagesx($i) * $font_height / imagesy($i) / $font_width; | |||||
} | |||||
/* Assume a 6×10 font */ | |||||
if(!$cols && !$lines) | |||||
{ | |||||
$cols = 60; | |||||
$lines = $cols * imagesy($i) * $font_width / imagesx($i) / $font_height; | |||||
} | |||||
else if($cols && !$lines) | |||||
{ | |||||
$lines = $cols * imagesy($i) * $font_width / imagesx($i) / $font_height; | |||||
} | |||||
else if(!$cols && $lines) | |||||
{ | |||||
$cols = $lines * imagesx($i) * $font_height / imagesy($i) / $font_width; | |||||
} | |||||
caca_set_canvas_size($cv, $cols, $lines); | |||||
caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||||
caca_clear_canvas($cv); | |||||
$i_dither = caca_create_dither($i); | |||||
if(! caca_set_dither_algorithm($i_dither, $dither?$dither:"fstein")) | |||||
{ | |||||
$stderr .= sprintf("%s: Can't dither image with algorithm '%s'\n", $argv[0], $dither?$dither:"fstein"); | |||||
return -1; | |||||
} | |||||
caca_set_canvas_size($cv, $cols, $lines); | |||||
caca_set_color_ansi($cv, CACA_DEFAULT, CACA_TRANSPARENT); | |||||
caca_clear_canvas($cv); | |||||
$i_dither = caca_create_dither($i); | |||||
if(! caca_set_dither_algorithm($i_dither, $dither?$dither:"fstein")) | |||||
{ | |||||
$stderr .= sprintf("%s: Can't dither image with algorithm '%s'\n", $argv[0], $dither?$dither:"fstein"); | |||||
return -1; | |||||
} | |||||
if($brightness!=-1) caca_set_dither_brightness ($i_dither, $brightness); | |||||
if($contrast!=-1) caca_set_dither_contrast ($i_dither, $contrast); | |||||
if($gamma!=-1) caca_set_dither_gamma ($i_dither, $gamma); | |||||
if($brightness!=-1) caca_set_dither_brightness ($i_dither, $brightness); | |||||
if($contrast!=-1) caca_set_dither_contrast ($i_dither, $contrast); | |||||
if($gamma!=-1) caca_set_dither_gamma ($i_dither, $gamma); | |||||
caca_dither_bitmap($cv, 0, 0, $cols, $lines, $i_dither, $i); | |||||
caca_dither_bitmap($cv, 0, 0, $cols, $lines, $i_dither, $i); | |||||
$format = $format ? $format : 'html'; | |||||
$format = $format ? $format : 'html'; | |||||
$export = caca_export_string($cv, $format); | |||||
if(!$export) | |||||
{ | |||||
$stderr .= sprintf("%s: Can't export to format '%s'\n", $argv[0], $format); | |||||
return -1; | |||||
} | |||||
else | |||||
{ | |||||
$content_type_map = array( | |||||
'ansi' => 'text/plain; charset=CP437', | |||||
'utf8' => 'text/plain; charset=UTF-8', | |||||
'utf8cr' => 'text/plain; charset=UTF-8', | |||||
'html' => 'text/html; charset=UTF-8', | |||||
'html3' => 'text/html; charset=UTF-8', | |||||
'bbfr' => 'text/plain; charset=UTF-8', | |||||
'irc' => 'text/plain; charset=UTF-8', | |||||
'ps' => 'application/postscript', | |||||
'svg' => 'image/svg+xml', | |||||
'tga' => 'image/x-targa' | |||||
); | |||||
$export = caca_export_string($cv, $format); | |||||
if(!$export) | |||||
{ | |||||
$stderr .= sprintf("%s: Can't export to format '%s'\n", $argv[0], $format); | |||||
return -1; | |||||
} | |||||
else | |||||
{ | |||||
$content_type_map = array( | |||||
'ansi' => 'text/plain; charset=CP437', | |||||
'utf8' => 'text/plain; charset=UTF-8', | |||||
'utf8cr' => 'text/plain; charset=UTF-8', | |||||
'html' => 'text/html; charset=UTF-8', | |||||
'html3' => 'text/html; charset=UTF-8', | |||||
'bbfr' => 'text/plain; charset=UTF-8', | |||||
'irc' => 'text/plain; charset=UTF-8', | |||||
'ps' => 'application/postscript', | |||||
'svg' => 'image/svg+xml', | |||||
'tga' => 'image/x-targa' | |||||
); | |||||
$download_extension_map = array( | |||||
'caca' => 'caca', | |||||
'ansi' => 'txt', | |||||
'utf8' => 'txt', | |||||
'utf8cr' => 'txt', | |||||
'irc' => 'txt', | |||||
'tga' => 'tga' | |||||
); | |||||
$download_extension_map = array( | |||||
'caca' => 'caca', | |||||
'ansi' => 'txt', | |||||
'utf8' => 'txt', | |||||
'utf8cr' => 'txt', | |||||
'irc' => 'txt', | |||||
'tga' => 'tga' | |||||
); | |||||
$inline_extension_map = array( | |||||
'bbfr' => 'txt', | |||||
'ps' => 'ps', | |||||
'svg' => 'svg' | |||||
); | |||||
$inline_extension_map = array( | |||||
'bbfr' => 'txt', | |||||
'ps' => 'ps', | |||||
'svg' => 'svg' | |||||
); | |||||
if (! array_key_exists($format, $content_type_map)) | |||||
$content_type = 'application/octet-stream'; | |||||
else | |||||
$content_type = $content_type_map[$format]; | |||||
if (! array_key_exists($format, $content_type_map)) | |||||
$content_type = 'application/octet-stream'; | |||||
else | |||||
$content_type = $content_type_map[$format]; | |||||
header('Content-Type: ' . $content_type); | |||||
if (array_key_exists($format, $download_extension_map)) | |||||
header('Content-Disposition: attachment; filename=export.' . $download_extension_map[$format]); | |||||
else if (array_key_exists($format, $inline_extension_map)) | |||||
header('Content-Disposition: inline; filename=export.' . $inline_extension_map[$format]); | |||||
header('Content-Type: ' . $content_type); | |||||
if (array_key_exists($format, $download_extension_map)) | |||||
header('Content-Disposition: attachment; filename=export.' . $download_extension_map[$format]); | |||||
else if (array_key_exists($format, $inline_extension_map)) | |||||
header('Content-Disposition: inline; filename=export.' . $inline_extension_map[$format]); | |||||
echo $export; | |||||
} | |||||
echo $export; | |||||
} | |||||
return 0; | |||||
return 0; | |||||
} | } | ||||
$ret = 1; | $ret = 1; | ||||
if(isset($_REQUEST['args']) || $file) | if(isset($_REQUEST['args']) || $file) | ||||
{ | { | ||||
$ret = main(); | |||||
$ret = main(); | |||||
} | } | ||||
if($ret || strlen($stdout) || strlen($stderr)) | if($ret || strlen($stdout) || strlen($stderr)) | ||||
{ | { | ||||
header('Content-Type: text/html; charset=UTF-8'); | |||||
?> | |||||
header('Content-Type: text/html; charset=UTF-8'); | |||||
?> | |||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||||
@@ -512,21 +510,21 @@ if($ret || strlen($stdout) || strlen($stderr)) | |||||
<input type="submit" /> <input type="reset" /> | <input type="submit" /> <input type="reset" /> | ||||
</form> | </form> | ||||
<?php | <?php | ||||
; | |||||
if(strlen($stderr)) | |||||
{ | |||||
?><pre xml:space="preserve"><strong><?= htmlspecialchars($stderr) ?></strong></pre><?php | |||||
; | |||||
} | |||||
if(strlen($stdout)) | |||||
{ | |||||
?><pre xml:space="preserve"><?= preg_replace('!([&]lt;)([.a-zA-Z0-9]+[@])([-.a-zA-Z0-9]+)([&]gt;)!', '$1<a href="mailto:$2$3">$2...</a>$4', preg_replace('!(\s|^)(https?://[-.:_/0-9a-zA-Z%?=&;#]+)(\s|$)!', '$1<a href="$2">$2</a>$3', htmlspecialchars($stdout))) ?></pre><?php | |||||
; | |||||
} | |||||
?> | |||||
; | |||||
if(strlen($stderr)) | |||||
{ | |||||
?><pre xml:space="preserve"><strong><?= htmlspecialchars($stderr) ?></strong></pre><?php | |||||
; | |||||
} | |||||
if(strlen($stdout)) | |||||
{ | |||||
?><pre xml:space="preserve"><?= preg_replace('!([&]lt;)([.a-zA-Z0-9]+[@])([-.a-zA-Z0-9]+)([&]gt;)!', '$1<a href="mailto:$2$3">$2...</a>$4', preg_replace('!(\s|^)(https?://[-.:_/0-9a-zA-Z%?=&;#]+)(\s|$)!', '$1<a href="$2">$2</a>$3', htmlspecialchars($stdout))) ?></pre><?php | |||||
; | |||||
} | |||||
?> | |||||
</body> | </body> | ||||
</html> | </html> | ||||
<?php | <?php | ||||
; | |||||
; | |||||
} | } | ||||
?> | ?> |
@@ -11,12 +11,10 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/import.c" | * This file is a Php port of "examples/import.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -49,12 +47,12 @@ if ($file == NULL) | |||||
<label for="format">as</label> | <label for="format">as</label> | ||||
<select name="format" id="format" onchange="update_preview(this);"> | <select name="format" id="format" onchange="update_preview(this);"> | ||||
<?php | <?php | ||||
foreach($imports as $import_format => $name) | |||||
{ | |||||
?><option value="<?= htmlspecialchars($import_format) ?>"<?= | |||||
($format == $import_format) ? ' selected="selected"' : '' ?>><?= | |||||
htmlspecialchars($name . " (" . $import_format . ")") ?></option><?php | |||||
} | |||||
foreach($imports as $import_format => $name) | |||||
{ | |||||
?><option value="<?= htmlspecialchars($import_format) ?>"<?= | |||||
($format == $import_format) ? ' selected="selected"' : '' ?>><?= | |||||
htmlspecialchars($name . " (" . $import_format . ")") ?></option><?php | |||||
} | |||||
?> | ?> | ||||
</select> | </select> | ||||
</form> | </form> | ||||
@@ -64,22 +62,22 @@ if ($file == NULL) | |||||
if($file) | if($file) | ||||
{ | { | ||||
$cv = caca_create_canvas(0, 0); | |||||
if(! $cv) | |||||
{ | |||||
die("Can't create canvas\n"); | |||||
} | |||||
if(caca_import_file($cv, $file, ($format == NULL) ? "" : $format) < 0) | |||||
{ | |||||
die("could not import `" . htmlspecialchars($filename) . "'.\n"); | |||||
} | |||||
echo caca_export_string($cv, "html3"); | |||||
$cv = caca_create_canvas(0, 0); | |||||
if(! $cv) | |||||
{ | |||||
die("Can't create canvas\n"); | |||||
} | |||||
if(caca_import_file($cv, $file, ($format == NULL) ? "" : $format) < 0) | |||||
{ | |||||
die("could not import `" . htmlspecialchars($filename) . "'.\n"); | |||||
} | |||||
echo caca_export_string($cv, "html3"); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
?>See the <a href="export.php">libcaca export test program</a> for an <a | |||||
?>See the <a href="export.php">libcaca export test program</a> for an <a | |||||
href="export.php?format=caca">example file</a>.<?php | href="export.php?format=caca">example file</a>.<?php | ||||
} | } | ||||
@@ -2,48 +2,48 @@ | |||||
function pig() { | function pig() { | ||||
$pig_str = <<<EOT | $pig_str = <<<EOT | ||||
_._ _..._ .-', _.._(`)) | |||||
'-. ` ' /-._.-' ',/ | |||||
) \ '. | |||||
/ _ _ | \ | |||||
| a a / PHP | | |||||
\ .-. ; | |||||
'-('' ).-' ,' ; | |||||
'-; | .' | |||||
\ \ / | |||||
| 7 .__ _.-\ \ | |||||
| | | ``/ /` / | |||||
jgs /,_| | /,_/ / | |||||
/,_/ '`-' | |||||
_._ _..._ .-', _.._(`)) | |||||
'-. ` ' /-._.-' ',/ | |||||
) \ '. | |||||
/ _ _ | \ | |||||
| a a / PHP | | |||||
\ .-. ; | |||||
'-('' ).-' ,' ; | |||||
'-; | .' | |||||
\ \ / | |||||
| 7 .__ _.-\ \ | |||||
| | | ``/ /` / | |||||
jgs /,_| | /,_/ / | |||||
/,_/ '`-' | |||||
EOT; | 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, "Я люблю Либкаку"); | |||||
return $canvas; | |||||
$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, "Я люблю Либкаку"); | |||||
return $canvas; | |||||
} | } | ||||
if (isset($_GET["png"])) { | if (isset($_GET["png"])) { | ||||
$canvas = pig(); | |||||
$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); | |||||
header("Content-type: image/png"); | |||||
imagepng($img); | |||||
$canvas = pig(); | |||||
$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); | |||||
header("Content-type: image/png"); | |||||
imagepng($img); | |||||
} | } | ||||
else { | else { | ||||
$render_php = isset($_SERVER['SCRIPT_NAME']) | $render_php = isset($_SERVER['SCRIPT_NAME']) | ||||
? | |||||
$_SERVER['SCRIPT_NAME'] | |||||
: | |||||
'render.php'; | |||||
? | |||||
$_SERVER['SCRIPT_NAME'] | |||||
: | |||||
'render.php'; | |||||
header("Content-type: text/html; charset=UTF-8"); | header("Content-type: text/html; charset=UTF-8"); | ||||
@@ -62,7 +62,7 @@ header("Content-type: text/html; charset=UTF-8"); | |||||
<h1>Generated image:</h1> | <h1>Generated image:</h1> | ||||
<a href="<?= htmlspecialchars($render_php) ?>?png=1"><img alt="[PNG]" | <a href="<?= htmlspecialchars($render_php) ?>?png=1"><img alt="[PNG]" | ||||
src="<?= htmlspecialchars($render_php) ?>?png=1" border="0" /></a> | |||||
src="<?= htmlspecialchars($render_php) ?>?png=1" border="0" /></a> | |||||
</body> | </body> | ||||
</html> | </html> | ||||
@@ -10,8 +10,8 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
* demo.php demo for libcaca php binding | * demo.php demo for libcaca php binding | ||||
* Copyright (c) 2008 Nicolas Vion <nico@yojik.eu> | * Copyright (c) 2008 Nicolas Vion <nico@yojik.eu> | ||||
* | * | ||||
* This file is a Php port of the official libcaca's sample program "demo.c" | |||||
* which is: | |||||
* This file is a Php port of the official libcaca's sample program "demo.c" | |||||
* which is: | |||||
* Copyright (c) 2003 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2003 Sam Hocevar <sam@hocevar.net> | ||||
* | * | ||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
@@ -29,23 +29,23 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
<?php | <?php | ||||
$string = <<<EOT | $string = <<<EOT | ||||
|_| | |||||
_,----._ | | | |||||
(/ @ @ \) __ | |||||
| OO | |_ | |||||
\ `--' / |__ | |||||
`----' | |||||
|_| | |||||
Hello world! | | |||||
|_| | |||||
_,----._ | | | |||||
(/ @ @ \) __ | |||||
| OO | |_ | |||||
\ `--' / |__ | |||||
`----' | |||||
|_| | |||||
Hello world! | | |||||
EOT; | EOT; | ||||
$pig = caca_create_canvas(0, 0); | $pig = caca_create_canvas(0, 0); | ||||
caca_import_string($pig, $string, "text"); | caca_import_string($pig, $string, "text"); | ||||
$cv = caca_create_canvas(caca_get_canvas_width($pig) * 2, caca_get_canvas_height($pig) * 2); | $cv = caca_create_canvas(caca_get_canvas_width($pig) * 2, caca_get_canvas_height($pig) * 2); | ||||
if (!$cv or !$pig) { | if (!$cv or !$pig) { | ||||
die("Can't created canvas\n"); | |||||
die("Can't created canvas\n"); | |||||
} | } | ||||
caca_blit($cv, 0, 0, $pig); | caca_blit($cv, 0, 0, $pig); | ||||
@@ -59,12 +59,12 @@ caca_rotate_180($pig); | |||||
caca_blit($cv, caca_get_canvas_width($pig), caca_get_canvas_height($pig), $pig); | caca_blit($cv, caca_get_canvas_width($pig), caca_get_canvas_height($pig), $pig); | ||||
for($j = 0; $j < caca_get_canvas_height($cv); $j++) { | for($j = 0; $j < caca_get_canvas_height($cv); $j++) { | ||||
for($i = 0; $i < caca_get_canvas_width($cv); $i += 2) { | |||||
caca_set_color_ansi($cv, CACA_LIGHTBLUE + ($i + $j) % 6, CACA_DEFAULT); | |||||
$a = caca_get_attr($cv, -1, -1); | |||||
caca_put_attr($cv, $i, $j, $a); | |||||
caca_put_attr($cv, $i + 1, $j, $a); | |||||
} | |||||
for($i = 0; $i < caca_get_canvas_width($cv); $i += 2) { | |||||
caca_set_color_ansi($cv, CACA_LIGHTBLUE + ($i + $j) % 6, CACA_DEFAULT); | |||||
$a = caca_get_attr($cv, -1, -1); | |||||
caca_put_attr($cv, $i, $j, $a); | |||||
caca_put_attr($cv, $i + 1, $j, $a); | |||||
} | |||||
} | } | ||||
echo caca_export_string($cv, "html3"); | echo caca_export_string($cv, "html3"); | ||||
@@ -11,12 +11,10 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/transform.c" | * This file is a Php port of "examples/transform.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -32,24 +30,24 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
<?php | <?php | ||||
$pig = ( | $pig = ( | ||||
",--. ,--.\n" . | |||||
"\\ /-~-\\ /\n" . | |||||
" )' o O `(\n" . | |||||
"( ,---. )\n" . | |||||
" `(_o_o_)'\n" . | |||||
" )`-'(\n"); | |||||
",--. ,--.\n" . | |||||
"\\ /-~-\\ /\n" . | |||||
" )' o O `(\n" . | |||||
"( ,---. )\n" . | |||||
" `(_o_o_)'\n" . | |||||
" )`-'(\n"); | |||||
$duck = ( | $duck = ( | ||||
" ,~~.\n" . | |||||
" __ , ( O )>\n" . | |||||
"___( o)> )`~~' (\n" . | |||||
"\\ <_. ) ( .__) )\n" . | |||||
" `---' `-.____,'\n"); | |||||
" ,~~.\n" . | |||||
" __ , ( O )>\n" . | |||||
"___( o)> )`~~' (\n" . | |||||
"\\ <_. ) ( .__) )\n" . | |||||
" `---' `-.____,'\n"); | |||||
$cv = caca_create_canvas(80, 25); | $cv = caca_create_canvas(80, 25); | ||||
if(! $cv) | if(! $cv) | ||||
{ | { | ||||
die("Can't created canvas\n"); | |||||
die("Can't created canvas\n"); | |||||
} | } | ||||
$image = caca_create_canvas(70, 6); | $image = caca_create_canvas(70, 6); | ||||
@@ -7,15 +7,13 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||||
<?php | <?php | ||||
/* | /* | ||||
* truecolor truecolor canvas features | |||||
* truecolor truecolor canvas features | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/truecolor.c" | * This file is a Php port of "examples/truecolor.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | |||||
* | |||||
* $Id$ | |||||
* All Rights Reserved | |||||
* | * | ||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
@@ -33,18 +31,18 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
$cv = caca_create_canvas(32, 16); | $cv = caca_create_canvas(32, 16); | ||||
if(!$cv) { | if(!$cv) { | ||||
die("Failed to create canvas\n"); | |||||
die("Failed to create canvas\n"); | |||||
} | } | ||||
for($y = 0; $y < 16; $y++) | for($y = 0; $y < 16; $y++) | ||||
for($x = 0; $x < 16; $x++) | |||||
{ | |||||
$bgcolor = 0xff00 | ($y << 4) | $x; | |||||
$fgcolor = 0xf000 | ((15 - $y) << 4) | ((15 - $x) << 8); | |||||
caca_set_color_argb($cv, $fgcolor, $bgcolor); | |||||
caca_put_str($cv, $x * 2, $y, "CA"); | |||||
} | |||||
for($x = 0; $x < 16; $x++) | |||||
{ | |||||
$bgcolor = 0xff00 | ($y << 4) | $x; | |||||
$fgcolor = 0xf000 | ((15 - $y) << 4) | ((15 - $x) << 8); | |||||
caca_set_color_argb($cv, $fgcolor, $bgcolor); | |||||
caca_put_str($cv, $x * 2, $y, "CA"); | |||||
} | |||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE); | caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE); | ||||
caca_put_str($cv, 2, 1, " truecolor libcaca "); | caca_put_str($cv, 2, 1, " truecolor libcaca "); | ||||
@@ -11,12 +11,10 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
* Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> | ||||
* | * | ||||
* This file is a Php port of "examples/unicode.c" | * This file is a Php port of "examples/unicode.c" | ||||
* which is: | |||||
* which is: | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -34,7 +32,7 @@ header('Content-Type: text/html; charset=UTF-8'); | |||||
$cv = caca_create_canvas(80, 25); | $cv = caca_create_canvas(80, 25); | ||||
if(! $cv) | if(! $cv) | ||||
{ | { | ||||
die("Can't created canvas\n"); | |||||
die("Can't created canvas\n"); | |||||
} | } | ||||
caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE); | caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE); | ||||
caca_put_str($cv, 1, 1, "Basic Unicode support"); | caca_put_str($cv, 1, 1, "Basic Unicode support"); | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2007 Sam Hocevar <sam@hocevar.net> | * 2007 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2007 Sam Hocevar <sam@@hocevar.net> | * 2007 Sam Hocevar <sam@@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2007-2009 Sam Hocevar <sam@hocevar.net> | * 2007-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2007 Sam Hocevar <sam@hocevar.net> | * 2007 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2007 Sam Hocevar <sam@hocevar.net> | * 2007 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2007 Sam Hocevar <sam@hocevar.net> | * 2007 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2007 Sam Hocevar <sam@hocevar.net> | * 2007 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -1,4 +1,3 @@ | |||||
# $Id: $ | |||||
# We need to install the .config file ourselves because of a gacutil | # We need to install the .config file ourselves because of a gacutil | ||||
# bug (https://bugzilla.novell.com/show_bug.cgi?id=363341) | # bug (https://bugzilla.novell.com/show_bug.cgi?id=363341) | ||||
@@ -4,8 +4,6 @@ | |||||
* 2007 Sam Hocevar <sam@hocevar.net> | * 2007 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This program is free software. It comes without any warranty, to | * This program is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -1,4 +1,3 @@ | |||||
# $Id$ | |||||
EXTRA_DIST = caca_types.h.in caca.pc.in \ | EXTRA_DIST = caca_types.h.in caca.pc.in \ | ||||
mono9.data monobold12.data \ | mono9.data monobold12.data \ | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2006-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2010 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2010 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -13,7 +11,6 @@ | |||||
*/ | */ | ||||
/** \file caca.h | /** \file caca.h | ||||
* \version \$Id$ | |||||
* \author Sam Hocevar <sam@hocevar.net> | * \author Sam Hocevar <sam@hocevar.net> | ||||
* \brief The \e libcaca public header. | * \brief The \e libcaca public header. | ||||
* | * | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2010 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2010 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,11 +3,10 @@ | |||||
* Copyright (c) 2006-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software; you can redistribute it and/or | |||||
* modify it under the terms of the Do What The Fuck You Want To | |||||
* Public License, Version 2, as published by Sam Hocevar. See | |||||
* This library is free software. It comes without any warranty, to | |||||
* the extent permitted by applicable law. You can redistribute it | |||||
* and/or modify it under the terms of the Do What The Fuck You Want | |||||
* To Public License, Version 2, as published by Sam Hocevar. See | |||||
* http://sam.zoy.org/wtfpl/COPYING for more details. | * http://sam.zoy.org/wtfpl/COPYING for more details. | ||||
*/ | */ | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,11 +3,10 @@ | |||||
* Copyright (c) 2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software; you can redistribute it and/or | |||||
* modify it under the terms of the Do What The Fuck You Want To | |||||
* Public License, Version 2, as published by Sam Hocevar. See | |||||
* This library is free software. It comes without any warranty, to | |||||
* the extent permitted by applicable law. You can redistribute it | |||||
* and/or modify it under the terms of the Do What The Fuck You Want | |||||
* To Public License, Version 2, as published by Sam Hocevar. See | |||||
* http://sam.zoy.org/wtfpl/COPYING for more details. | * http://sam.zoy.org/wtfpl/COPYING for more details. | ||||
*/ | */ | ||||
@@ -3,11 +3,10 @@ | |||||
* Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software; you can redistribute it and/or | |||||
* modify it under the terms of the Do What The Fuck You Want To | |||||
* Public License, Version 2, as published by Sam Hocevar. See | |||||
* This library is free software. It comes without any warranty, to | |||||
* the extent permitted by applicable law. You can redistribute it | |||||
* and/or modify it under the terms of the Do What The Fuck You Want | |||||
* To Public License, Version 2, as published by Sam Hocevar. See | |||||
* http://sam.zoy.org/wtfpl/COPYING for more details. | * http://sam.zoy.org/wtfpl/COPYING for more details. | ||||
*/ | */ | ||||
@@ -4,11 +4,10 @@ | |||||
* Copyright (c) 2008 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2008 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software; you can redistribute it and/or | |||||
* modify it under the terms of the Do What The Fuck You Want To | |||||
* Public License, Version 2, as published by Sam Hocevar. See | |||||
* This library is free software. It comes without any warranty, to | |||||
* the extent permitted by applicable law. You can redistribute it | |||||
* and/or modify it under the terms of the Do What The Fuck You Want | |||||
* To Public License, Version 2, as published by Sam Hocevar. See | |||||
* http://sam.zoy.org/wtfpl/COPYING for more details. | * http://sam.zoy.org/wtfpl/COPYING for more details. | ||||
*/ | */ | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2007 Ben Wiley Sittler <bsittler@gmail.com> | * 2007 Ben Wiley Sittler <bsittler@gmail.com> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | * 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | * 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | * 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2006 Colin Delacroix <colin@zoy.org> | * Copyright (c) 2006 Colin Delacroix <colin@zoy.org> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -5,8 +5,6 @@ | |||||
* 2007 Ben Wiley Sittler <bsittler@gmail.com> | * 2007 Ben Wiley Sittler <bsittler@gmail.com> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2007 Ben Wiley Sittler <bsittler@gmail.com> | * 2007 Ben Wiley Sittler <bsittler@gmail.com> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -4,8 +4,6 @@ | |||||
* 2007 Ben Wiley Sittler <bsittler@gmail.com> | * 2007 Ben Wiley Sittler <bsittler@gmail.com> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2006-2007 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2006-2007 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -3,8 +3,6 @@ | |||||
* Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | * Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* $Id$ | |||||
* | |||||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | ||||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | ||||
* and/or modify it under the terms of the Do What The Fuck You Want | * and/or modify it under the terms of the Do What The Fuck You Want | ||||
@@ -1,4 +1,3 @@ | |||||
# $Id$ | |||||
AC_INIT(libcaca, 0.99.beta17) | AC_INIT(libcaca, 0.99.beta17) | ||||
AC_PREREQ(2.50) | AC_PREREQ(2.50) | ||||
@@ -1,4 +1,3 @@ | |||||
# $Id: Makefile.am 552 2006-04-13 16:10:16Z jylam $ | |||||
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I../caca | AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I../caca | ||||