From: Laurent MAZET Date: Fri, 13 Sep 2024 13:40:56 +0000 (+0200) Subject: add wide mode X-Git-Tag: v1.0~5 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=cccc5a3dbcd93ccb63010bc802520349dcc046a7;p=display.git add wide mode --- diff --git a/display.c b/display.c index 5586260..b2aa9e7 100644 --- a/display.c +++ b/display.c @@ -19,14 +19,17 @@ char *progname = NULL; char *version = "0.1"; float gf[3] = { 1.0, 1.0, 1.0 }; +int mode = 0; /* help message */ int usage (int ret) { FILE *fd = ret ? stderr : stdout; - fprintf (fd, "usage: %s [-g gamma] [-h] \n", progname); + fprintf (fd, "usage: %s [-g gamma] [-h] [-t|-w] \n", progname); fprintf (fd, " -g: gamma correction (%.1f:%.1f:%.1f)\n", gf[0], gf[1], gf[2]); fprintf (fd, " -h: help message\n"); + fprintf (fd, " -t: thin mode (%s)\n", (mode == 0) ? "on" : "off"); + fprintf (fd, " -w: wide mode (%s)\n", (mode == 1) ? "on" : "off"); fprintf (fd, "%s version %s\n", progname, version); return ret; @@ -81,6 +84,12 @@ int main (int argc, char *argv[]) gf[1] = gf[2] = 0; } break; + case 't': + mode = 0; + break; + case 'w': + mode = 1; + break; case 'h': default: return usage (c != 'h'); @@ -105,7 +114,7 @@ int main (int argc, char *argv[]) for (k = 0; k < image->width; k++) { int ind = k + image->width * l; color_t *color = findcolor (correction (image->red[ind], gf[0]), correction (image->green[ind], gf[1]), correction (image->blue[ind], gf[2])); - cprint (color, " "); + cprint (color, (mode == 0) ? " " : " "); } printf ("\n"); }