about summary refs log tree commit diff
path: root/lib/pnm.h
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2006-08-19 03:12:28 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2006-08-19 03:12:28 +0000
commit1fd361a1ea06e44286c213ca1f814f49306fdc43 (patch)
tree64c8c96cf54d8718847339a403e5e67b922e8c3f /lib/pnm.h
downloadnetpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.tar.gz
netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.tar.xz
netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.zip
Create Subversion repository
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib/pnm.h')
-rw-r--r--lib/pnm.h134
1 files changed, 134 insertions, 0 deletions
diff --git a/lib/pnm.h b/lib/pnm.h
new file mode 100644
index 00000000..d3b6f84f
--- /dev/null
+++ b/lib/pnm.h
@@ -0,0 +1,134 @@
+/* pnm.h - header file for libpnm portable anymap library
+*/
+
+#ifndef _PNM_H_
+#define _PNM_H_
+
+#include "ppm.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+} /* to fake out automatic code indenters */
+#endif
+
+
+typedef pixel xel;
+typedef pixval xelval;
+#define PNM_OVERALLMAXVAL PPM_OVERALLMAXVAL
+#define PNM_MAXMAXVAL PPM_MAXMAXVAL
+#define PNM_GET1(x) PPM_GETB(x)
+#define PNM_ASSIGN1(x,v) PPM_ASSIGN(x,0,0,v)
+#define PNM_ASSIGN(x,r,g,b) PPM_ASSIGN(x,r,g,b)
+#define PNM_EQUAL(x,y) PPM_EQUAL(x,y)
+#define PNM_FORMAT_TYPE(f) PPM_FORMAT_TYPE(f)
+#define PNM_DEPTH(newp,p,oldmaxval,newmaxval) \
+    PPM_DEPTH(newp,p,oldmaxval,newmaxval)
+
+/* Declarations of routines. */
+
+void pnm_init ARGS(( int* argcP, char* argv[] ));
+
+void
+pnm_nextimage(FILE *file, int * const eofP);
+
+xel *
+pnm_allocrow(unsigned int const cols);
+
+#define pnm_freerow(xelrow) free(xelrow)
+
+#define pnm_allocarray( cols, rows ) \
+  ((xel**) pm_allocarray( cols, rows, sizeof(xel) ))
+#define pnm_freearray( xels, rows ) pm_freearray( (char**) xels, rows )
+
+
+void
+pnm_readpnminit(FILE *   const fileP,
+                int *    const colsP,
+                int *    const rowsP,
+                xelval * const maxvalP,
+                int *    const formatP);
+
+void
+pnm_readpnmrow(FILE * const fileP,
+               xel *  const xelrow,
+               int    const cols,
+               xelval const maxval,
+               int    const format);
+
+xel **
+pnm_readpnm(FILE *   const fileP,
+            int *    const colsP,
+            int *    const rowsP,
+            xelval * const maxvalP,
+            int *    const formatP);
+
+void
+pnm_check(FILE *               const fileP,
+          enum pm_check_type   const check_type, 
+          int                  const format,
+          int                  const cols,
+          int                  const rows,
+          int                  const maxval,
+          enum pm_check_code * const retvalP);
+
+
+void
+pnm_writepnminit(FILE * const fileP, 
+                 int    const cols, 
+                 int    const rows, 
+                 xelval const maxval, 
+                 int    const format, 
+                 int    const forceplain);
+
+void
+pnm_writepnmrow(FILE * const fileP, 
+                xel *  const xelrow, 
+                int    const cols, 
+                xelval const maxval, 
+                int    const format, 
+                int    const forceplain);
+
+void
+pnm_writepnm(FILE * const fileP,
+             xel ** const xels,
+             int    const cols,
+             int    const rows,
+             xelval const maxval,
+             int    const format,
+             int    const forceplain);
+
+xel 
+pnm_backgroundxel (xel** xels, int cols, int rows, xelval maxval, int format);
+
+xel 
+pnm_backgroundxelrow (xel* xelrow, int cols, xelval maxval, int format);
+
+xel 
+pnm_whitexel (xelval maxval, int format);
+
+xel 
+pnm_blackxel(xelval maxval, int format);
+
+void 
+pnm_invertxel(xel *  const x,
+              xelval const maxval,
+              int    const format);
+
+void 
+pnm_promoteformat(xel** xels, int cols, int rows, xelval maxval, int format, 
+                  xelval newmaxval, int newformat);
+void 
+pnm_promoteformatrow(xel* xelrow, int cols, xelval maxval, int format, 
+                     xelval newmaxval, int newformat);
+
+pixel
+xeltopixel(xel const inputxel);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /*_PNM_H_*/