@@ -3,7 +3,7 @@ | |||||
EXTRA_DIST = doxygen.cfg.in footer.html header.html $(man_MANS) $(doxygen_DOX) | EXTRA_DIST = doxygen.cfg.in footer.html header.html $(man_MANS) $(doxygen_DOX) | ||||
doxygen_DOX = libcaca.dox user.dox migrating.dox tutorial.dox style.dox | doxygen_DOX = libcaca.dox user.dox migrating.dox tutorial.dox style.dox | ||||
man_MANS = caca-config.1 cacafire.1 cacaview.1 | |||||
man_MANS = caca-config.1 cacafire.1 cacaview.1 cacaserver.1 img2irc.1 cacaplay.1 | |||||
if BUILD_DOCUMENTATION | if BUILD_DOCUMENTATION | ||||
htmldoc_DATA = html/doxygen.css | htmldoc_DATA = html/doxygen.css | ||||
@@ -0,0 +1,26 @@ | |||||
.TH cacaplay 1 "2006-11-10" "libcaca" | |||||
.SH NAME | |||||
cacaplay \- play libcaca files | |||||
.SH SYNOPSIS | |||||
.B cacaplay [FILE] | |||||
.RI | |||||
.SH DESCRIPTION | |||||
.B cacaplay | |||||
plays libcaca animation files. These files can be created by any libcaca | |||||
program by setting the | |||||
.B CACA_DRIVER | |||||
environment variable to | |||||
.B "raw" | |||||
and storing the program's standard output. | |||||
.SH EXAMPLE | |||||
cacaplay file.caca | |||||
.SH BUGS | |||||
As of now, | |||||
.B cacaplay | |||||
can only play single-image canvases, rendering it pretty useless. See | |||||
.B cacaserver | |||||
for a more usable alternative. | |||||
.SH SEE ALSO | |||||
cacaserver(1) | |||||
.SH AUTHOR | |||||
This manual page was written by Sam Hocevar <sam@zoy.org>. |
@@ -0,0 +1,30 @@ | |||||
.TH cacaserver 1 "2006-11-10" "libcaca" | |||||
.SH NAME | |||||
cacaserver \- telnet server for libcaca | |||||
.SH SYNOPSIS | |||||
.B cacaserver | |||||
.RI | |||||
.SH DESCRIPTION | |||||
.B cacaserver | |||||
reads libcaca animation files in its standard input and serves them as ANSI | |||||
art on network port 51914. These animations can be created by any libcaca | |||||
program by setting the | |||||
.B CACA_DRIVER | |||||
environment variable to | |||||
.B "raw" | |||||
and piping the program's standard output to | |||||
.B cacaserver. | |||||
Clients can then connect to port 51914 using | |||||
.B telnet | |||||
or | |||||
.B netcat | |||||
to see the output. | |||||
.SH EXAMPLE | |||||
CACA_DRIVER=raw cacademo | cacaserver | |||||
telnet localhost 51914 | |||||
.SH SEE ALSO | |||||
cacaplay(1) | |||||
.SH AUTHOR | |||||
This manual page was written by Sam Hocevar <sam@zoy.org>. |
@@ -50,5 +50,7 @@ There is no support for aspect ratio yet. Also, since there is no way | |||||
yet to load an image from | yet to load an image from | ||||
.B cacaview | .B cacaview | ||||
it is completely useless when run without an argument. | it is completely useless when run without an argument. | ||||
.SH SEE ALSO | |||||
img2irc(1) | |||||
.SH AUTHOR | .SH AUTHOR | ||||
This manual page was written by Sam Hocevar <sam@zoy.org>. | This manual page was written by Sam Hocevar <sam@zoy.org>. |
@@ -0,0 +1,27 @@ | |||||
.TH img2irc 1 "2006-11-10" "libcaca" | |||||
.SH NAME | |||||
img2irc \- convert images to IRC coloured files | |||||
.SH SYNOPSIS | |||||
.B img2irc IMAGE [COLUMNS] | |||||
.RI | |||||
.SH DESCRIPTION | |||||
.B img2irc | |||||
convert images to colour ASCII characters and outputs them to text using | |||||
mIRC colour codes. | |||||
.PP | |||||
.B img2irc | |||||
can load the most widespread image formats: PNG, JPEG, GIF, PNG, BMP etc. | |||||
By default the output text is 60 columns wide; this value can be changed | |||||
by appending a second argument to the commandline. | |||||
.SH EXAMPLES | |||||
img2irc hello.jpg > hello.txt | |||||
img2irc hello.jpg 40 > tinyhello.txt | |||||
.SH BUGS | |||||
This program could be merged into | |||||
.B cacaview | |||||
or expanded to support multiple output formats. | |||||
.SH SEE ALSO | |||||
cacaview(1) | |||||
.SH AUTHOR | |||||
This manual page was written by Sam Hocevar <sam@zoy.org>. |
@@ -23,6 +23,13 @@ | |||||
#include "cucul.h" | #include "cucul.h" | ||||
#include "common-image.h" | #include "common-image.h" | ||||
static void usage(int argc, char **argv) | |||||
{ | |||||
fprintf(stderr, "Usage: %s <image>\n", argv[0]); | |||||
fprintf(stderr, " %s <image> <columns>\n", argv[0]); | |||||
fprintf(stderr, " %s [-h|--help]\n", argv[0]); | |||||
} | |||||
int main(int argc, char **argv) | int main(int argc, char **argv) | ||||
{ | { | ||||
/* libcucul context */ | /* libcucul context */ | ||||
@@ -30,14 +37,22 @@ int main(int argc, char **argv) | |||||
void *export; | void *export; | ||||
unsigned long int len; | unsigned long int len; | ||||
struct image *i; | struct image *i; | ||||
int cols = 56, lines; | |||||
int cols, lines; | |||||
if(argc != 2) | |||||
if(argc < 2 || argc > 3) | |||||
{ | { | ||||
fprintf(stderr, "%s: wrong argument count\n", argv[0]); | fprintf(stderr, "%s: wrong argument count\n", argv[0]); | ||||
usage(argc, argv); | |||||
return 1; | return 1; | ||||
} | } | ||||
if(!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) | |||||
{ | |||||
fprintf(stderr, "%s: convert images to IRC file data\n", argv[0]); | |||||
usage(argc, argv); | |||||
return 0; | |||||
} | |||||
cv = cucul_create_canvas(0, 0); | cv = cucul_create_canvas(0, 0); | ||||
if(!cv) | if(!cv) | ||||
{ | { | ||||
@@ -54,6 +69,8 @@ int main(int argc, char **argv) | |||||
} | } | ||||
/* Assume a 6×10 font */ | /* Assume a 6×10 font */ | ||||
cols = argc == 3 ? atoi(argv[2]) : 0; | |||||
cols = cols ? cols : 60; | |||||
lines = cols * i->h * 6 / i->w / 10; | lines = cols * i->h * 6 / i->w / 10; | ||||
cucul_set_canvas_size(cv, cols, lines); | cucul_set_canvas_size(cv, cols, lines); | ||||