[GRASS-SVN] r54645 - grass/trunk/general/g.pnmcomp

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 15 07:12:44 PST 2013


Author: martinl
Date: 2013-01-15 07:12:43 -0800 (Tue, 15 Jan 2013)
New Revision: 54645

Modified:
   grass/trunk/general/g.pnmcomp/g.pnmcomp.html
   grass/trunk/general/g.pnmcomp/main.c
Log:
g.pnmcomp: fix options
           update manual page


Modified: grass/trunk/general/g.pnmcomp/g.pnmcomp.html
===================================================================
--- grass/trunk/general/g.pnmcomp/g.pnmcomp.html	2013-01-15 15:00:39 UTC (rev 54644)
+++ grass/trunk/general/g.pnmcomp/g.pnmcomp.html	2013-01-15 15:12:43 UTC (rev 54645)
@@ -1,42 +1,46 @@
 <h2>DESCRIPTION</h2>
 
-(culled from the mailing list)
-<br>
-<pre>
-From: Glynn Clements 
-Subject: Re: [GRASS5] Re: [GRASSLIST:10403] Transparency added
-Date: Sun, 19 Feb 2006 20:17:59 +0000
+<em>g.pnmcomp</em> isn't meant for end users. It's an internal tool
+for use by <em><a href="wxGUI.html">wxGUI</a></em>.
 
-g.pnmcomp isn't meant for end users. It's an internal tool for use by
-a Tcl/Tk GUI.
+<p>
+In essence, <em>g.pnmcomp</em> generates a PPM image by overlaying a
+series of PPM/PGM pairs (PPM = RGB image, PGM = alpha channel).
 
-In essence, g.pnmcomp generates a PPM image by overlaying a series of
-PPM/PGM pairs (PPM = RGB image, PGM = alpha channel).
+<h2>NOTES</h2>
 
-The intention is that d.* programs will emit PPM/PGM pairs (by way of
-the PNG-driver code being integrated into libraster). The GUI will
-manage a set of layers; each layer consists of the data necessary to
-generate a PPM/PGM pair.
+The intention is that <em>d.*</em> modules will emit PPM/PGM pairs (by
+way of the PNG-driver code being integrated into Display Library). The
+GUI will manage a set of layers; each layer consists of the data
+necessary to generate a PPM/PGM pair.
 
-Whenever the layer "stack" changes (by adding, removing, hiding,
-showing or re-ordering layers), the GUI will render any layers for
-which it doesn't already have the PPM/PGM pair, then re-run g.pnmcomp
-to generate the final image (just redoing the composition is a lot
-faster than redrawing everything).
+Whenever the layer "stack" changes (by adding, removing,
+hiding, showing or re-ordering layers), the GUI will render any layers
+for which it doesn't already have the PPM/PGM pair, then re-run
+<em>g.pnmcomp</em> to generate the final image (just redoing the
+composition is a lot faster than redrawing everything).
 
-A C/C++ GUI would either have g.pnmcomp's functionality (image
-composition) built-in, or would use the system's graphics API to
-perform composition (for translucent layers, you would need OpenGL or
-the Render extension, or something else which supports translucent
+<p>
+A C/C++ GUI would either have <em>g.pnmcomp's</em> functionality
+(image composition) built-in, or would use the system's graphics API
+to perform composition (for translucent layers, you would need OpenGL
+or the Render extension, or something else which supports translucent
 rendering).
 
+<p>
 Tk doesn't support transparent (masked) true-colour images (it does
 support transparent GIFs, but that's limited to 256 colours), and an
 image composition routine in Tcl would be unacceptably slow, hence
-the existence of g.pnmcomp.
-</pre>
+the existence of <em>g.pnmcomp</em>.
 
+<h2>SEE ALSO</h2>
+
+<em>
+<a href="g.cairocomp.html">g.cairocomp</a>
+</em>
+
 <h2>AUTHOR</h2>
+
 Glynn Clements
 
 <p><i>Last changed: $Date$</i>

Modified: grass/trunk/general/g.pnmcomp/main.c
===================================================================
--- grass/trunk/general/g.pnmcomp/main.c	2013-01-15 15:00:39 UTC (rev 54644)
+++ grass/trunk/general/g.pnmcomp/main.c	2013-01-15 15:12:43 UTC (rev 54645)
@@ -18,6 +18,7 @@
 #include <stdarg.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/colors.h>
 #include <grass/glocale.h>
 
 static unsigned int width, height;
@@ -33,8 +34,8 @@
     unsigned char bg[3];
     unsigned int row, col, i;
 
-    if (sscanf(color, "%d:%d:%d", &r, &g, &b) != 3)
-	G_fatal_error(_("Invalid color: %s"), color);
+    if (G_str_to_color(color, &r, &g, &b) != 1)
+        G_fatal_error(_("Invalid color: %s"), color);
 
     bg[0] = (unsigned char)r;
     bg[1] = (unsigned char)g;
@@ -279,17 +280,20 @@
 
     module = G_define_module();
     G_add_keyword(_("general"));
-    G_add_keyword(_("support"));
-    G_add_keyword(_("gui"));
+    G_add_keyword(_("display"));
     
-    module->description = _("Overlays multiple PPM image files,");
+    module->description = _("Overlays multiple PPM image files.");
 
-    opt.in = G_define_standard_option(G_OPT_R_INPUTS);
+    opt.in = G_define_standard_option(G_OPT_F_INPUT);
+    opt.in->required = YES;
+    opt.in->multiple = YES;
+    opt.in->description = _("Name of input file(s)");
 
-    opt.mask = G_define_standard_option(G_OPT_R_INPUTS);
+    opt.mask = G_define_standard_option(G_OPT_F_INPUT);
     opt.mask->key = "mask";
     opt.mask->required = NO;
-    opt.mask->description = _("Name of mask files");
+    opt.mask->multiple = YES;
+    opt.mask->description = _("Name of input mask file(s)");
     
     opt.alpha = G_define_option();
     opt.alpha->key = "opacity";
@@ -317,6 +321,7 @@
     opt.height->description = _("Image height");
 
     opt.bg = G_define_standard_option(G_OPT_C_BG);
+    opt.bg->answer = NULL;
     
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);



More information about the grass-commit mailing list