about summary refs log tree commit diff
path: root/generator/pamtris/framebuffer.h
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-08-12 21:59:38 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-08-12 21:59:38 +0000
commitd3cea986a286392f9e52464f7aec932fc9921417 (patch)
treefef21050247bd1cb5401ecb01e9f9befc4e14576 /generator/pamtris/framebuffer.h
parent2c880103c0b55ca5c15bc9e957c3460cdd20d18b (diff)
downloadnetpbm-mirror-d3cea986a286392f9e52464f7aec932fc9921417.tar.gz
netpbm-mirror-d3cea986a286392f9e52464f7aec932fc9921417.tar.xz
netpbm-mirror-d3cea986a286392f9e52464f7aec932fc9921417.zip
split common.h into separate interface header files
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3299 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'generator/pamtris/framebuffer.h')
-rw-r--r--generator/pamtris/framebuffer.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/generator/pamtris/framebuffer.h b/generator/pamtris/framebuffer.h
new file mode 100644
index 00000000..9b3d4dcf
--- /dev/null
+++ b/generator/pamtris/framebuffer.h
@@ -0,0 +1,75 @@
+#ifndef FRAMEBUFFER_H_INCLUDED
+#define FRAMEBUFFER_H_INCLUDED
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "fract.h"
+#include "netpbm/pam.h"
+
+typedef struct framebuffer_info {
+/*----------------------------------------------------------------------------
+   Information about the frame buffer and PAM output
+-----------------------------------------------------------------------------*/
+    /* These fields are initialized once by reading the command line
+       arguments. "maxval" and "num_attribs" may be modified later
+       through "realloc_image_buffer".
+    */
+    int32_t width;
+    int32_t height;
+    int32_t maxval;
+    int32_t num_attribs;
+
+    /* The fields below must be initialized by "init_framebuffer" and
+       freed by "free_framebuffer", except for the tuple_type field in
+       "outpam" which is initialized once by reading the command line
+       arguments and may be modified later through "set_tupletype".
+    */
+    struct {
+        uint16_t * buffer;
+        uint32_t   bytes;
+    } img; /* Image buffer */
+
+    struct {
+        uint32_t * buffer;
+        uint32_t   bytes;
+    } z;  /* Z-buffer */
+
+    struct pam outpam;
+
+    tuple * pamrow;
+} framebuffer_info;
+
+
+
+int
+set_tupletype(const char * str,
+              char         tupletype[256]);
+
+int
+init_framebuffer(framebuffer_info *);
+
+void
+free_framebuffer(framebuffer_info *);
+
+void
+print_framebuffer(framebuffer_info *);
+
+void
+clear_framebuffer(bool               clear_image_buffer,
+                  bool               clear_z_buffer,
+                  framebuffer_info *);
+
+int
+realloc_image_buffer(int32_t            new_maxval,
+                     int32_t            new_num_attribs,
+                     framebuffer_info *);
+
+void
+draw_span(uint32_t           base,
+          uint16_t           length,
+          fract *            attribs_start,
+          const fract *      attribs_steps,
+          int32_t            divisor,
+          framebuffer_info *);
+
+#endif