about summary refs log tree commit diff
path: root/lib/libpnm3.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libpnm3.c')
-rw-r--r--lib/libpnm3.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/libpnm3.c b/lib/libpnm3.c
index 3970c734..4d88a2c1 100644
--- a/lib/libpnm3.c
+++ b/lib/libpnm3.c
@@ -106,10 +106,14 @@ pnm_backgroundxelrow(xel *  const xelrow,
                      int    const cols,
                      xelval const maxval,
                      int    const format) {
+/*----------------------------------------------------------------------------
+   Guess a good background color for an image that contains row 'xelrow'
+   (probably top or bottom edge).
 
+   'cols', 'maxval', and 'format' describe 'xelrow'.
+-----------------------------------------------------------------------------*/
     xel bgxel, l, r;
 
-    /* Guess a good background value. */
     l = xelrow[0];
     r = xelrow[cols-1];
 
@@ -236,6 +240,19 @@ pnm_invertxel(xel*   const xP,
 
 
 
+const char *
+pnm_formattypenm(int const format) {
+
+    switch (PPM_FORMAT_TYPE(format)) {
+    case PPM_TYPE: return "PPM"; break;
+    case PGM_TYPE: return "PGM"; break;
+    case PBM_TYPE: return "PBM"; break;
+    default: return "???";
+    }
+}
+
+
+
 void
 pnm_promoteformat(xel ** const xels,
                   int    const cols,