Revision: 57364
          http://sourceforge.net/p/brlcad/code/57364
Author:   mohitdaga
Date:     2013-09-01 15:18:05 +0000 (Sun, 01 Sep 2013)
Log Message:
-----------
Add file information for fast reading. Also this is backward compatible, that 
is if file information is not added still the app will work.

Modified Paths:
--------------
    brlcad/trunk/src/util/pix-bw.c

Modified: brlcad/trunk/src/util/pix-bw.c
===================================================================
--- brlcad/trunk/src/util/pix-bw.c      2013-09-01 13:51:22 UTC (rev 57363)
+++ brlcad/trunk/src/util/pix-bw.c      2013-09-01 15:18:05 UTC (rev 57364)
@@ -50,14 +50,16 @@
 double rweight = 0.0;
 double gweight = 0.0;
 double bweight = 0.0;
+int inx = 0, iny = 0;
 ICV_COLOR color;
 
 char *out_file = NULL;
 char *in_file = NULL;
 
 static const char usage[] = "\
-pix-bw [-h] [ [-N] [-C] [-R red_weight] [-G green_weight] [-B blue_weight] ] 
\n\
-       [-o out_file.bw] [file.bw] > [out_file.bw] \n";
+pix-bw [-h] [-s squaresize] [-w width] [-n height] \n\
+            [ [-e ntsc|crt ] [-R red_weight] [-G green_weight] [-B 
blue_weight] ] \n\
+           [-o out_file.bw] [file.bw] > [out_file.bw] \n";
 
 double multiplier = 0.5;
 
@@ -68,20 +70,24 @@
 
     while ((c = bu_getopt(argc, argv, "R:G:B:o:h?NC")) != -1) {
        switch (c) {
-           case 'N' :
-               rweight = 0.30;
-               gweight = 0.59;
-               bweight = 0.11;
-               red = green = blue = 1;
-               color = ICV_COLOR_RGB;
-               break;
-           case 'C' :
-               rweight = 0.26;
-               gweight = 0.66;
-               bweight = 0.08;
-               red = green = blue = 1;
-               color = ICV_COLOR_RGB;
-               break;
+           case 'e' :
+               if(BU_STR_EQUAL(bu_optarg, "ntsc")) {
+                   rweight = 0.30;
+                   gweight = 0.59;
+                   bweight = 0.11;
+                   red = green = blue = 1;
+                   color = ICV_COLOR_RGB;
+               }
+               else if(BU_STR_EQUAL(bu_optarg, "crt")) {
+                   rweight = 0.26;
+                   gweight = 0.66;
+                   bweight = 0.08;
+                   red = green = blue = 1;
+                   color = ICV_COLOR_RGB;
+               }
+               else
+                   return 0;
+           break;
            case 'R' :
                red++;
                rweight = atof(bu_optarg);
@@ -94,10 +100,19 @@
                blue++;
                bweight = atof(bu_optarg);
                break;
-           case 'o':
+           case 'o' :
                out_file = bu_optarg;
                break;
-           case 'h':
+            case 's' :
+               inx = iny = atoi(bu_optarg);
+               break;
+            case 'w' :
+               inx = atoi(bu_optarg);
+               break;
+            case 'n' :
+               iny = atoi(bu_optarg);
+               break;
+           case 'h' :
            default:            /* '?' */
                return 0;
        }
@@ -134,7 +149,7 @@
        bu_log("%s", usage);
        return 1;
     }
-    img = icv_read(in_file, ICV_IMAGE_PIX, 0,0);
+    img = icv_read(in_file, ICV_IMAGE_PIX, inx, iny);
 
     if (img == NULL)
        return 1;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to