|
@@ -25,9 +25,9 @@ |
|
|
|
|
|
|
|
|
static void usage(int argc, char **argv) |
|
|
static void usage(int argc, char **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, "Usage: %s [OPTIONS]...\n", argv[0]); |
|
|
|
|
|
fprintf(stderr, "Display current time in text mode (q to quit)\n"); |
|
|
|
|
|
fprintf(stderr, "Example : %s -d '%%R'\n\n", argv[0]); |
|
|
fprintf(stderr, "Options:\n"); |
|
|
fprintf(stderr, "Options:\n"); |
|
|
fprintf(stderr, " -h, --help\t\t\tThis help\n"); |
|
|
fprintf(stderr, " -h, --help\t\t\tThis help\n"); |
|
|
fprintf(stderr, " -v, --version\t\t\tVersion of the program\n"); |
|
|
fprintf(stderr, " -v, --version\t\t\tVersion of the program\n"); |
|
@@ -51,7 +51,6 @@ static void version(void) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char* get_date(char *format) { |
|
|
static char* get_date(char *format) { |
|
|
time_t currtime; |
|
|
time_t currtime; |
|
|
char *charTime = malloc(101); |
|
|
char *charTime = malloc(101); |
|
@@ -147,7 +146,7 @@ int main(int argc, char *argv[]) { |
|
|
char *d = get_date(format); |
|
|
char *d = get_date(format); |
|
|
uint32_t o = 0; |
|
|
uint32_t o = 0; |
|
|
|
|
|
|
|
|
// figfont API is not complete, and does not alloq us to put a string |
|
|
|
|
|
|
|
|
// figfont API is not complete, and does not allow us to put a string |
|
|
// at another position than 0,0 |
|
|
// at another position than 0,0 |
|
|
// So, we have to create a canvas which will hold the figfont string, |
|
|
// So, we have to create a canvas which will hold the figfont string, |
|
|
// then blit this canvas to the main one at the desired position. |
|
|
// then blit this canvas to the main one at the desired position. |
|
@@ -158,13 +157,13 @@ int main(int argc, char *argv[]) { |
|
|
caca_put_figchar(figcv, d[o++]); |
|
|
caca_put_figchar(figcv, d[o++]); |
|
|
} |
|
|
} |
|
|
caca_flush_figlet (figcv); |
|
|
caca_flush_figlet (figcv); |
|
|
fw = caca_get_canvas_width (figcv); |
|
|
|
|
|
fh = caca_get_canvas_height(figcv); |
|
|
|
|
|
|
|
|
|
|
|
free(d); |
|
|
free(d); |
|
|
|
|
|
|
|
|
w = caca_get_canvas_width (cv); |
|
|
w = caca_get_canvas_width (cv); |
|
|
h = caca_get_canvas_height(cv); |
|
|
|
|
|
|
|
|
h = caca_get_canvas_height(cv); |
|
|
|
|
|
fw = caca_get_canvas_width (figcv); |
|
|
|
|
|
fh = caca_get_canvas_height(figcv); |
|
|
|
|
|
|
|
|
uint32_t x = (w/2) - (fw/2); |
|
|
uint32_t x = (w/2) - (fw/2); |
|
|
uint32_t y = (h/2) - (fh/2); |
|
|
uint32_t y = (h/2) - (fh/2); |
|
|
|
|
|
|
|
|