about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-11-30 18:43:10 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-11-30 18:43:10 +0000
commit4c272da2874fc3fb6ea98faf7d2fcf5ded572e8f (patch)
treea265777a582f22c2e9c0a1c85f43288d9b2963d1 /lib
parent5f45f825647e0aaac7ce14c01e6d398c7d2cd3ab (diff)
downloadnetpbm-mirror-4c272da2874fc3fb6ea98faf7d2fcf5ded572e8f.tar.gz
netpbm-mirror-4c272da2874fc3fb6ea98faf7d2fcf5ded572e8f.tar.xz
netpbm-mirror-4c272da2874fc3fb6ea98faf7d2fcf5ded572e8f.zip
Add pnm_formattypenm
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4794 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib')
-rw-r--r--lib/libpnm3.c13
-rw-r--r--lib/pnm.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/libpnm3.c b/lib/libpnm3.c
index ba408bd1..4d88a2c1 100644
--- a/lib/libpnm3.c
+++ b/lib/libpnm3.c
@@ -240,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,
diff --git a/lib/pnm.h b/lib/pnm.h
index a8aad161..fd262566 100644
--- a/lib/pnm.h
+++ b/lib/pnm.h
@@ -136,6 +136,9 @@ pnm_invertxel(xel *  const x,
               xelval const maxval,
               int    const format);
 
+const char *
+pnm_formattypenm(int const format);
+
 void
 pnm_promoteformat(xel** xels, int cols, int rows, xelval maxval, int format,
                   xelval newmaxval, int newformat);