Debian Codegraph @

generator/pamtris/framebuffer.h

raw
1 #ifndef FRAMEBUFFER_H_INCLUDED
2 #define FRAMEBUFFER_H_INCLUDED
3
4 #include <stdint.h>
5 #include <stdbool.h>
6
7 #include "varying.h"
8 #include "netpbm/pam.h"
9
10 typedef struct framebuffer_info {
11 /*----------------------------------------------------------------------------
12 Information about the frame buffer and PAM output
13 -----------------------------------------------------------------------------*/
14 /* These fields are initialized once by reading the command line
15 arguments. "maxval" and "num_attribs" may be modified later
16 through "realloc_image_buffer"; "correct" may also be modified
17 if the eponymous command is given.
18 */
19 int32_t width;
20 int32_t height;
21 int32_t maxval;
22 int32_t num_attribs;
23
24 /* The fields below must be initialized by "init_framebuffer" and
25 freed by "free_framebuffer", except for the tuple_type field in
26 "outpam" which is initialized once by reading the command line
27 arguments and may be modified later through "set_tupletype".
28 */
29 struct {
30 uint16_t * buffer;
31 uint32_t bytes;
32 } img; /* Image buffer */
33
34 struct {
35 uint32_t * buffer;
36 uint32_t bytes;
37 } z; /* Z-buffer */
38
39 struct pam outpam;
40
41 tuple * pamrow;
42 } framebuffer_info;
43
44
45
46 int
47 set_tupletype(const char * const str,
48 char * const tupletype);
49
50 int
51 init_framebuffer(framebuffer_info * const fbi);
52
53 void
54 free_framebuffer(framebuffer_info * const fbi);
55
56 void
57 print_framebuffer(framebuffer_info * const fbi);
58
59 void
60 clear_framebuffer(bool const clear_image_buffer,
61 bool const clear_z_buffer,
62 framebuffer_info * const fbi);
63
64 int
65 realloc_image_buffer(int32_t const new_maxval,
66 int32_t const new_num_attribs,
67 framebuffer_info * const fbi);
68
69 void
70 draw_span(uint32_t const base,
71 uint16_t const length,
72 varying * const attribs,
73 framebuffer_info * const fbi);
74
75 #endif