add wide mode
authorLaurent MAZET <laurent.mazet@thalesgroup.com>
Fri, 13 Sep 2024 13:40:56 +0000 (15:40 +0200)
committerLaurent MAZET <laurent.mazet@thalesgroup.com>
Fri, 13 Sep 2024 13:40:56 +0000 (15:40 +0200)
display.c

index 5586260ed10cf5c332ecab723742508f275f4889..b2aa9e7f4134745c0ece70943105d78af2c4da4b 100644 (file)
--- 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] <file>\n", progname);
+    fprintf (fd, "usage: %s [-g gamma] [-h] [-t|-w] <file>\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");
     }