|
|
@@ -45,9 +45,16 @@ static void usage(int argc, char **argv) |
|
|
|
fprintf(stderr, "Options:\n"); |
|
|
|
fprintf(stderr, " -h, --help\tThis help\n"); |
|
|
|
fprintf(stderr, " -W, --width=WIDTH\tWidth of resulting image\n"); |
|
|
|
fprintf(stderr, " -H, --HEIGHT=HEIGHT\tHeight of resulting image\n"); |
|
|
|
fprintf(stderr, " -H, --height=HEIGHT\tHeight of resulting image\n"); |
|
|
|
fprintf(stderr, " -d, --dither=DITHER\tDithering algorithm to use :\n"); |
|
|
|
fprintf(stderr, "\t\t\tnone : Nearest color\n"); |
|
|
|
fprintf(stderr, "\t\t\tordered2 : Ordered 2x2\n"); |
|
|
|
fprintf(stderr, "\t\t\tordered4 : Ordered 4x4\n"); |
|
|
|
fprintf(stderr, "\t\t\tordered8 : Ordered 8x8\n"); |
|
|
|
fprintf(stderr, "\t\t\trandom : Random\n"); |
|
|
|
fprintf(stderr, "\t\t\tfstein : Floyd Steinberg (default)\n"); |
|
|
|
fprintf(stderr, " -f, --format=FORMAT\tFormat of the resulting image :\n"); |
|
|
|
fprintf(stderr, "\t\t\tansi : coulored ANSI\n"); |
|
|
|
fprintf(stderr, "\t\t\tansi : coulored ANSI (default)\n"); |
|
|
|
fprintf(stderr, "\t\t\tcaca : internal libcaca format\n"); |
|
|
|
fprintf(stderr, "\t\t\tutf8 : UTF8 with CR\n"); |
|
|
|
fprintf(stderr, "\t\t\tutf8 : UTF8 with CRLF (MS Windows)\n"); |
|
|
@@ -68,6 +75,7 @@ int main(int argc, char **argv) |
|
|
|
struct image *i; |
|
|
|
unsigned int cols = 0, lines = 0; |
|
|
|
char *format = NULL; |
|
|
|
char *dither = NULL; |
|
|
|
|
|
|
|
|
|
|
|
if(argc < 2) |
|
|
@@ -85,9 +93,10 @@ int main(int argc, char **argv) |
|
|
|
{ "width", 1, NULL, 'W' }, |
|
|
|
{ "height", 1, NULL, 'H' }, |
|
|
|
{ "format", 1, NULL, 'f' }, |
|
|
|
{ "dither", 1, NULL, 'd' }, |
|
|
|
{ "help", 0, NULL, 'h' }, |
|
|
|
}; |
|
|
|
int c = mygetopt(argc, argv, "W:H:f:h", long_options, &option_index); |
|
|
|
int c = mygetopt(argc, argv, "W:H:f:d:h", long_options, &option_index); |
|
|
|
if(c == -1) |
|
|
|
break; |
|
|
|
|
|
|
@@ -102,6 +111,9 @@ int main(int argc, char **argv) |
|
|
|
case 'f': /* --format */ |
|
|
|
format = myoptarg; |
|
|
|
break; |
|
|
|
case 'd': /* --dither */ |
|
|
|
dither = myoptarg; |
|
|
|
break; |
|
|
|
case 'h': /* --help */ |
|
|
|
usage(argc, argv); |
|
|
|
return 0; |
|
|
@@ -113,7 +125,6 @@ int main(int argc, char **argv) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cv = cucul_create_canvas(0, 0); |
|
|
|
if(!cv) |
|
|
|
{ |
|
|
@@ -148,6 +159,7 @@ int main(int argc, char **argv) |
|
|
|
cucul_set_canvas_size(cv, cols, lines); |
|
|
|
cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); |
|
|
|
cucul_clear_canvas(cv); |
|
|
|
cucul_set_dither_algorithm(i->dither, dither?dither:"fstein"); |
|
|
|
cucul_dither_bitmap(cv, 0, 0, cols, lines, i->dither, i->pixels); |
|
|
|
|
|
|
|
unload_image(i); |
|
|
|